diff --git a/.env.docker b/.env.docker index 5c6f8412a4..3a2c4c0e50 100644 --- a/.env.docker +++ b/.env.docker @@ -5,6 +5,7 @@ APP_KEY=${FF_APP_KEY} APP_LOG=daily APP_LOG_LEVEL=warning APP_URL=http://localhost +TRUSTED_PROXIES= DB_CONNECTION=mysql DB_HOST=${FF_DB_HOST} @@ -55,3 +56,5 @@ PUSHER_ID= DEMO_USERNAME= DEMO_PASSWORD= +IS_DOCKER=true +IS_SANDSTORM=false diff --git a/.env.example b/.env.example index 2acecc771e..c7b5705427 100644 --- a/.env.example +++ b/.env.example @@ -56,3 +56,5 @@ PUSHER_ID= DEMO_USERNAME= DEMO_PASSWORD= +IS_DOCKER=false +IS_SANDSTORM=false diff --git a/.env.heroku b/.env.heroku new file mode 100644 index 0000000000..0043f59a0b --- /dev/null +++ b/.env.heroku @@ -0,0 +1,55 @@ +APP_ENV=heroku +APP_DEBUG=true +APP_NAME=FireflyIII +APP_KEY=7ahyYVPVsmxjdhsweWCauGeJfwc92NP2 +APP_LOG=errorlog +APP_LOG_LEVEL=debug +APP_URL=http://localhost +TRUSTED_PROXIES=* + +DB_CONNECTION=pgsql + +BROADCAST_DRIVER=log +CACHE_DRIVER=file +SESSION_DRIVER=file +QUEUE_DRIVER=sync + +COOKIE_PATH="/" +COOKIE_DOMAIN= +COOKIE_SECURE=false + +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_DRIVER=smtp +MAIL_HOST=smtp.mailtrap.io +MAIL_PORT=2525 +MAIL_FROM=changeme@example.com +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_ENCRYPTION=null + +SEND_REGISTRATION_MAIL=true +SEND_ERROR_MESSAGE=true +SHOW_INCOMPLETE_TRANSLATIONS=false + +CACHE_PREFIX=firefly + +SEARCH_RESULT_LIMIT=50 +EXCHANGE_RATE_SERVICE=fixerio + +MAPBOX_API_KEY= +ANALYTICS_ID= +SITE_OWNER=heroku@example.com +USE_ENCRYPTION=true + +PUSHER_KEY= +PUSHER_SECRET= +PUSHER_ID= + +DEMO_USERNAME= +DEMO_PASSWORD= + +IS_DOCKER=false +IS_SANDSTORM=false diff --git a/.env.sandstorm b/.env.sandstorm index 6b5be86f3a..dee887b78d 100755 --- a/.env.sandstorm +++ b/.env.sandstorm @@ -5,6 +5,7 @@ APP_KEY=SomeRandomStringOf32CharsExactly APP_LOG=syslog APP_LOG_LEVEL=info APP_URL=http://localhost +TRUSTED_PROXIES= DB_CONNECTION=mysql DB_HOST=127.0.0.1 @@ -54,3 +55,6 @@ PUSHER_ID= DEMO_USERNAME= DEMO_PASSWORD= + +IS_DOCKER=false +IS_SANDSTORM=true diff --git a/.env.testing b/.env.testing index 4d67254078..b365fabf63 100644 --- a/.env.testing +++ b/.env.testing @@ -5,10 +5,12 @@ APP_KEY=TestTestTestTestTestTestTestTest APP_LOG=daily APP_LOG_LEVEL=debug APP_URL=http://localhost +TRUSTED_PROXIES= DB_CONNECTION=sqlite DB_HOST=127.0.0.1 DB_PORT=3306 +#DB_DATABASE=firefly DB_USERNAME=homestead DB_PASSWORD= @@ -39,9 +41,10 @@ SHOW_INCOMPLETE_TRANSLATIONS=false CACHE_PREFIX=firefly +SEARCH_RESULT_LIMIT=50 EXCHANGE_RATE_SERVICE=fixerio -GOOGLE_MAPS_API_KEY= +MAPBOX_API_KEY= ANALYTICS_ID= SITE_OWNER=mail@example.com USE_ENCRYPTION=true @@ -53,3 +56,5 @@ PUSHER_ID= DEMO_USERNAME= DEMO_PASSWORD= +IS_DOCKER=false +IS_SANDSTORM=false diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 63fa12e078..5d8fff3583 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -7,3 +7,5 @@ I am running Firefly III version x.x.x (please include if this problem also exists on the demo site) #### Other important details (log files, system info): + +Please visit the /debug page to get extra debug information. \ No newline at end of file diff --git a/.sandstorm/changelog.md b/.sandstorm/changelog.md index df4a9b1ed9..f3d84c53e7 100644 --- a/.sandstorm/changelog.md +++ b/.sandstorm/changelog.md @@ -1,3 +1,28 @@ +# 4.6.11 +- A debug page at `/debug` for easier debug. +- Strings translatable (see [issue 976](https://github.com/firefly-iii/firefly-iii/issues/976)), thanks to [Findus23](https://github.com/Findus23) +- Even more strings are translatable (and translated), thanks to [pkoziol](https://github.com/pkoziol) (see [issue 979](https://github.com/firefly-iii/firefly-iii/issues/979)) +- Reconciliation of accounts ([issue 736](https://github.com/firefly-iii/firefly-iii/issues/736)), as requested by [kristophr](https://github.com/kristophr) and several others +- Extended currency list, as suggested by @emuhendis in [issue 994](https://github.com/firefly-iii/firefly-iii/issues/994) +- [Issue 996](https://github.com/firefly-iii/firefly-iii/issues/996) as suggested by [dp87](https://github.com/dp87) +- Disabled Heroku support until I get it working again. +- [Issue 980](https://github.com/firefly-iii/firefly-iii/issues/980), reported by [Tim-Frensch](https://github.com/Tim-Frensch) +- [Issue 987](https://github.com/firefly-iii/firefly-iii/issues/987), reported by [gavu](https://github.com/gavu) +- [Issue 988](https://github.com/firefly-iii/firefly-iii/issues/988), reported by [gavu](https://github.com/gavu) +- [Issue 992](https://github.com/firefly-iii/firefly-iii/issues/992), reported by [ncicovic](https://github.com/ncicovic) +- [Issue 993](https://github.com/firefly-iii/firefly-iii/issues/993), reported by [gavu](https://github.com/gavu) +- [Issue 997](https://github.com/firefly-iii/firefly-iii/issues/997), reported by [gavu](https://github.com/gavu) +- [Issue 1000](https://github.com/firefly-iii/firefly-iii/issues/1000), reported by [xpfgsyb](https://github.com/xpfgsyb) +- [Issue 1001](https://github.com/firefly-iii/firefly-iii/issues/1001), reported by [gavu](https://github.com/gavu) +- [Issue 1002](https://github.com/firefly-iii/firefly-iii/issues/1002), reported by [ursweiss](https://github.com/ursweiss) +- [Issue 1003](https://github.com/firefly-iii/firefly-iii/issues/1003), reported by [ursweiss](https://github.com/ursweiss) +- [Issue 1004](https://github.com/firefly-iii/firefly-iii/issues/1004), reported by [Aquariu](https://github.com/Aquariu) +- [Issue 1010](https://github.com/firefly-iii/firefly-iii/issues/1010) +- [Issue 1014](https://github.com/firefly-iii/firefly-iii/issues/1014), reported by [ursweiss](https://github.com/ursweiss) +- [Issue 1016](https://github.com/firefly-iii/firefly-iii/issues/1016) +- [Issue 1024](https://github.com/firefly-iii/firefly-iii/issues/1024), reported by [gavu](https://github.com/gavu) +- [Issue 1025](https://github.com/firefly-iii/firefly-iii/issues/1025), reported by [gavu](https://github.com/gavu) + # 4.6.10 - Greatly expanded Docker support thanks to [alazare619](https://github.com/alazare619) - [Issue 967](https://github.com/firefly-iii/firefly-iii/issues/967), thanks to [Aquariu](https://github.com/Aquariu) diff --git a/.sandstorm/sandstorm-files.list b/.sandstorm/sandstorm-files.list index 225164d32f..50747bdf7f 100644 --- a/.sandstorm/sandstorm-files.list +++ b/.sandstorm/sandstorm-files.list @@ -204,8 +204,39 @@ opt/app/.dockerignore opt/app/.env opt/app/.env.docker opt/app/.env.example +opt/app/.env.heroku opt/app/.env.sandstorm opt/app/.gitattributes +opt/app/.sandstorm/.gitattributes +opt/app/.sandstorm/.vagrant/machines/default/virtualbox/action_provision +opt/app/.sandstorm/.vagrant/machines/default/virtualbox/action_set_name +opt/app/.sandstorm/.vagrant/machines/default/virtualbox/creator_uid +opt/app/.sandstorm/.vagrant/machines/default/virtualbox/id +opt/app/.sandstorm/.vagrant/machines/default/virtualbox/index_uuid +opt/app/.sandstorm/.vagrant/machines/default/virtualbox/private_key +opt/app/.sandstorm/.vagrant/machines/default/virtualbox/synced_folders +opt/app/.sandstorm/.vagrant/machines/default/virtualbox/vagrant_cwd +opt/app/.sandstorm/Vagrantfile +opt/app/.sandstorm/app-graphics/firefly-iii-128.png +opt/app/.sandstorm/app-graphics/firefly-iii-150.png +opt/app/.sandstorm/app-graphics/firefly-iii-24.png +opt/app/.sandstorm/app-graphics/firefly-iii-48.png +opt/app/.sandstorm/build.sh +opt/app/.sandstorm/changelog.md +opt/app/.sandstorm/description.md +opt/app/.sandstorm/global-setup.sh +opt/app/.sandstorm/launcher.sh +opt/app/.sandstorm/pgp-keyring +opt/app/.sandstorm/pgp-signature +opt/app/.sandstorm/sandstorm-files.list +opt/app/.sandstorm/sandstorm-pkgdef.capnp +opt/app/.sandstorm/screenshots/screenshot-1.png +opt/app/.sandstorm/screenshots/screenshot-2.png +opt/app/.sandstorm/screenshots/screenshot-3.png +opt/app/.sandstorm/service-config/mime.types +opt/app/.sandstorm/service-config/nginx.conf +opt/app/.sandstorm/setup.sh +opt/app/.sandstorm/stack opt/app/CHANGELOG.md opt/app/CODE_OF_CONDUCT.md opt/app/Dockerfile @@ -303,6 +334,7 @@ opt/app/app/Helpers/Report/PopupReport.php opt/app/app/Helpers/Report/PopupReportInterface.php opt/app/app/Helpers/Report/ReportHelper.php opt/app/app/Helpers/Report/ReportHelperInterface.php +opt/app/app/Http/Controllers/Account/ReconcileController.php opt/app/app/Http/Controllers/AccountController.php opt/app/app/Http/Controllers/Admin/ConfigurationController.php opt/app/app/Http/Controllers/Admin/HomeController.php @@ -397,6 +429,7 @@ opt/app/app/Http/Requests/MassEditJournalRequest.php opt/app/app/Http/Requests/NewUserFormRequest.php opt/app/app/Http/Requests/PiggyBankFormRequest.php opt/app/app/Http/Requests/ProfileFormRequest.php +opt/app/app/Http/Requests/ReconciliationFormRequest.php opt/app/app/Http/Requests/ReportFormRequest.php opt/app/app/Http/Requests/Request.php opt/app/app/Http/Requests/RuleFormRequest.php @@ -412,6 +445,8 @@ opt/app/app/Http/breadcrumbs.php opt/app/app/Import/Configurator/ConfiguratorInterface.php opt/app/app/Import/Configurator/CsvConfigurator.php opt/app/app/Import/Converter/Amount.php +opt/app/app/Import/Converter/AmountCredit.php +opt/app/app/Import/Converter/AmountDebet.php opt/app/app/Import/Converter/ConverterInterface.php opt/app/app/Import/Converter/INGDebetCredit.php opt/app/app/Import/Converter/RabobankDebetCredit.php @@ -468,7 +503,6 @@ opt/app/app/Models/Configuration.php opt/app/app/Models/CurrencyExchangeRate.php opt/app/app/Models/ExportJob.php opt/app/app/Models/ImportJob.php -opt/app/app/Models/LimitRepetition.php opt/app/app/Models/LinkType.php opt/app/app/Models/Note.php opt/app/app/Models/PiggyBank.php @@ -616,10 +650,15 @@ opt/app/app/Support/Preferences.php opt/app/app/Support/Search/Modifier.php opt/app/app/Support/Search/Search.php opt/app/app/Support/Search/SearchInterface.php +opt/app/app/Support/SingleCacheProperties.php opt/app/app/Support/Steam.php opt/app/app/Support/Twig/AmountFormat.php +opt/app/app/Support/Twig/Extension/Transaction.php +opt/app/app/Support/Twig/Extension/TransactionJournal.php opt/app/app/Support/Twig/General.php opt/app/app/Support/Twig/Journal.php +opt/app/app/Support/Twig/Loader/TransactionJournalLoader.php +opt/app/app/Support/Twig/Loader/TransactionLoader.php opt/app/app/Support/Twig/PiggyBank.php opt/app/app/Support/Twig/Rule.php opt/app/app/Support/Twig/Transaction.php @@ -688,7 +727,6 @@ opt/app/bootstrap/cache/packages.php opt/app/bootstrap/cache/services.php opt/app/composer.json opt/app/composer.lock -opt/app/composer.phar opt/app/config/app.php opt/app/config/auth.php opt/app/config/broadcasting.php @@ -705,6 +743,7 @@ opt/app/config/session.php opt/app/config/twigbridge.php opt/app/config/upgrade.php opt/app/config/view.php +opt/app/crowdin.yml opt/app/database/factories/ModelFactory.php opt/app/database/migrations/2016_06_16_000000_create_support_tables.php opt/app/database/migrations/2016_06_16_000001_create_users_table.php @@ -719,6 +758,7 @@ opt/app/database/migrations/2016_12_28_203205_changes_for_v431.php opt/app/database/migrations/2017_04_13_163623_changes_for_v440.php opt/app/database/migrations/2017_06_02_105232_changes_for_v450.php opt/app/database/migrations/2017_08_20_062014_changes_for_v470.php +opt/app/database/migrations/2017_11_04_170844_changes_for_v470a.php opt/app/database/seeds/AccountTypeSeeder.php opt/app/database/seeds/DatabaseSeeder.php opt/app/database/seeds/LinkTypeSeeder.php @@ -813,7 +853,9 @@ opt/app/public/images/page_green.png opt/app/public/images/page_white_acrobat.png opt/app/public/index.php opt/app/public/js/ff/accounts/create.js +opt/app/public/js/ff/accounts/edit-reconciliation.js opt/app/public/js/ff/accounts/edit.js +opt/app/public/js/ff/accounts/reconcile.js opt/app/public/js/ff/accounts/show.js opt/app/public/js/ff/bills/create.js opt/app/public/js/ff/bills/edit.js @@ -1061,6 +1103,7 @@ opt/app/resources/lang/sl_SI/list.php opt/app/resources/lang/sl_SI/pagination.php opt/app/resources/lang/sl_SI/passwords.php opt/app/resources/lang/sl_SI/validation.php +opt/app/resources/stubs/binary.bin opt/app/resources/stubs/csv.csv opt/app/resources/stubs/demo-configuration.json opt/app/resources/stubs/demo-import.csv @@ -1069,6 +1112,11 @@ opt/app/resources/views/accounts/create.twig opt/app/resources/views/accounts/delete.twig opt/app/resources/views/accounts/edit.twig opt/app/resources/views/accounts/index.twig +opt/app/resources/views/accounts/reconcile/edit.twig +opt/app/resources/views/accounts/reconcile/index.twig +opt/app/resources/views/accounts/reconcile/overview.twig +opt/app/resources/views/accounts/reconcile/show.twig +opt/app/resources/views/accounts/reconcile/transactions.twig opt/app/resources/views/accounts/show.twig opt/app/resources/views/admin/configuration/index.twig opt/app/resources/views/admin/index.twig @@ -1202,6 +1250,7 @@ opt/app/resources/views/partials/flashes.twig opt/app/resources/views/partials/menu-sidebar.twig opt/app/resources/views/partials/page-header.twig opt/app/resources/views/partials/password-modal.twig +opt/app/resources/views/partials/transaction-row.twig opt/app/resources/views/piggy-banks/add-mobile.twig opt/app/resources/views/piggy-banks/add.twig opt/app/resources/views/piggy-banks/create.twig @@ -2352,6 +2401,7 @@ opt/app/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/Inte opt/app/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithContainer.php opt/app/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php opt/app/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php +opt/app/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithRedis.php opt/app/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithSession.php opt/app/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php opt/app/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.php @@ -3821,6 +3871,9 @@ opt/app/vendor/symfony/console/Command/Command.php opt/app/vendor/symfony/console/Command/HelpCommand.php opt/app/vendor/symfony/console/Command/ListCommand.php opt/app/vendor/symfony/console/Command/LockableTrait.php +opt/app/vendor/symfony/console/CommandLoader/CommandLoaderInterface.php +opt/app/vendor/symfony/console/CommandLoader/ContainerCommandLoader.php +opt/app/vendor/symfony/console/CommandLoader/FactoryCommandLoader.php opt/app/vendor/symfony/console/ConsoleEvents.php opt/app/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php opt/app/vendor/symfony/console/Descriptor/ApplicationDescription.php @@ -3898,6 +3951,8 @@ opt/app/vendor/symfony/console/Tests/Command/CommandTest.php opt/app/vendor/symfony/console/Tests/Command/HelpCommandTest.php opt/app/vendor/symfony/console/Tests/Command/ListCommandTest.php opt/app/vendor/symfony/console/Tests/Command/LockableTraitTest.php +opt/app/vendor/symfony/console/Tests/CommandLoader/ContainerCommandLoaderTest.php +opt/app/vendor/symfony/console/Tests/CommandLoader/FactoryCommandLoaderTest.php opt/app/vendor/symfony/console/Tests/DependencyInjection/AddConsoleCommandPassTest.php opt/app/vendor/symfony/console/Tests/Descriptor/AbstractDescriptorTest.php opt/app/vendor/symfony/console/Tests/Descriptor/JsonDescriptorTest.php @@ -3926,6 +3981,8 @@ opt/app/vendor/symfony/console/Tests/Fixtures/FooCommand.php opt/app/vendor/symfony/console/Tests/Fixtures/FooLock2Command.php opt/app/vendor/symfony/console/Tests/Fixtures/FooLockCommand.php opt/app/vendor/symfony/console/Tests/Fixtures/FooOptCommand.php +opt/app/vendor/symfony/console/Tests/Fixtures/FooSameCaseLowercaseCommand.php +opt/app/vendor/symfony/console/Tests/Fixtures/FooSameCaseUppercaseCommand.php opt/app/vendor/symfony/console/Tests/Fixtures/FooSubnamespaced1Command.php opt/app/vendor/symfony/console/Tests/Fixtures/FooSubnamespaced2Command.php opt/app/vendor/symfony/console/Tests/Fixtures/FoobarCommand.php @@ -4232,12 +4289,17 @@ opt/app/vendor/symfony/debug/Tests/ExceptionHandlerTest.php opt/app/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php opt/app/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php opt/app/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php +opt/app/vendor/symfony/debug/Tests/Fixtures/AnnotatedClass.php opt/app/vendor/symfony/debug/Tests/Fixtures/ClassAlias.php opt/app/vendor/symfony/debug/Tests/Fixtures/DeprecatedClass.php opt/app/vendor/symfony/debug/Tests/Fixtures/DeprecatedInterface.php opt/app/vendor/symfony/debug/Tests/Fixtures/ExtendedFinalMethod.php opt/app/vendor/symfony/debug/Tests/Fixtures/FinalClass.php opt/app/vendor/symfony/debug/Tests/Fixtures/FinalMethod.php +opt/app/vendor/symfony/debug/Tests/Fixtures/InternalClass.php +opt/app/vendor/symfony/debug/Tests/Fixtures/InternalInterface.php +opt/app/vendor/symfony/debug/Tests/Fixtures/InternalTrait.php +opt/app/vendor/symfony/debug/Tests/Fixtures/InternalTrait2.php opt/app/vendor/symfony/debug/Tests/Fixtures/NonDeprecatedInterface.php opt/app/vendor/symfony/debug/Tests/Fixtures/PEARClass.php opt/app/vendor/symfony/debug/Tests/Fixtures/Throwing.php @@ -4390,7 +4452,9 @@ opt/app/vendor/symfony/http-foundation/Session/Flash/FlashBag.php opt/app/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php opt/app/vendor/symfony/http-foundation/Session/Session.php opt/app/vendor/symfony/http-foundation/Session/SessionBagInterface.php +opt/app/vendor/symfony/http-foundation/Session/SessionBagProxy.php opt/app/vendor/symfony/http-foundation/Session/SessionInterface.php +opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -4398,6 +4462,7 @@ opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSession opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php +opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php opt/app/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php opt/app/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php @@ -4442,6 +4507,18 @@ opt/app/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttribu opt/app/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php opt/app/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php opt/app/vendor/symfony/http-foundation/Tests/Session/SessionTest.php +opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php +opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/common.inc +opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.expected +opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.php +opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.expected +opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.php +opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.expected +opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.php +opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.expected +opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.php +opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.expected +opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.php opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -4449,6 +4526,7 @@ opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileS opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php @@ -4724,6 +4802,18 @@ opt/app/vendor/symfony/polyfill-php56/Php56.php opt/app/vendor/symfony/polyfill-php56/README.md opt/app/vendor/symfony/polyfill-php56/bootstrap.php opt/app/vendor/symfony/polyfill-php56/composer.json +opt/app/vendor/symfony/polyfill-php70/LICENSE +opt/app/vendor/symfony/polyfill-php70/Php70.php +opt/app/vendor/symfony/polyfill-php70/README.md +opt/app/vendor/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php +opt/app/vendor/symfony/polyfill-php70/Resources/stubs/AssertionError.php +opt/app/vendor/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php +opt/app/vendor/symfony/polyfill-php70/Resources/stubs/Error.php +opt/app/vendor/symfony/polyfill-php70/Resources/stubs/ParseError.php +opt/app/vendor/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php +opt/app/vendor/symfony/polyfill-php70/Resources/stubs/TypeError.php +opt/app/vendor/symfony/polyfill-php70/bootstrap.php +opt/app/vendor/symfony/polyfill-php70/composer.json opt/app/vendor/symfony/polyfill-util/Binary.php opt/app/vendor/symfony/polyfill-util/BinaryNoFuncOverload.php opt/app/vendor/symfony/polyfill-util/BinaryOnFuncOverload.php @@ -4771,6 +4861,7 @@ opt/app/vendor/symfony/routing/Exception/ExceptionInterface.php opt/app/vendor/symfony/routing/Exception/InvalidParameterException.php opt/app/vendor/symfony/routing/Exception/MethodNotAllowedException.php opt/app/vendor/symfony/routing/Exception/MissingMandatoryParametersException.php +opt/app/vendor/symfony/routing/Exception/NoConfigurationException.php opt/app/vendor/symfony/routing/Exception/ResourceNotFoundException.php opt/app/vendor/symfony/routing/Exception/RouteNotFoundException.php opt/app/vendor/symfony/routing/Generator/ConfigurableRequirementsInterface.php @@ -4784,6 +4875,12 @@ opt/app/vendor/symfony/routing/Loader/AnnotationClassLoader.php opt/app/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php opt/app/vendor/symfony/routing/Loader/AnnotationFileLoader.php opt/app/vendor/symfony/routing/Loader/ClosureLoader.php +opt/app/vendor/symfony/routing/Loader/Configurator/CollectionConfigurator.php +opt/app/vendor/symfony/routing/Loader/Configurator/ImportConfigurator.php +opt/app/vendor/symfony/routing/Loader/Configurator/RouteConfigurator.php +opt/app/vendor/symfony/routing/Loader/Configurator/RoutingConfigurator.php +opt/app/vendor/symfony/routing/Loader/Configurator/Traits/AddTrait.php +opt/app/vendor/symfony/routing/Loader/Configurator/Traits/RouteTrait.php opt/app/vendor/symfony/routing/Loader/DependencyInjection/ServiceRouterLoader.php opt/app/vendor/symfony/routing/Loader/DirectoryLoader.php opt/app/vendor/symfony/routing/Loader/ObjectRouteLoader.php @@ -4830,10 +4927,21 @@ opt/app/vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php opt/app/vendor/symfony/routing/Tests/Fixtures/annotated.php opt/app/vendor/symfony/routing/Tests/Fixtures/bad_format.yml opt/app/vendor/symfony/routing/Tests/Fixtures/bar.xml +opt/app/vendor/symfony/routing/Tests/Fixtures/controller/import__controller.xml +opt/app/vendor/symfony/routing/Tests/Fixtures/controller/import__controller.yml +opt/app/vendor/symfony/routing/Tests/Fixtures/controller/import_controller.xml +opt/app/vendor/symfony/routing/Tests/Fixtures/controller/import_controller.yml +opt/app/vendor/symfony/routing/Tests/Fixtures/controller/import_override_defaults.xml +opt/app/vendor/symfony/routing/Tests/Fixtures/controller/import_override_defaults.yml +opt/app/vendor/symfony/routing/Tests/Fixtures/controller/override_defaults.xml +opt/app/vendor/symfony/routing/Tests/Fixtures/controller/override_defaults.yml +opt/app/vendor/symfony/routing/Tests/Fixtures/controller/routing.xml +opt/app/vendor/symfony/routing/Tests/Fixtures/controller/routing.yml opt/app/vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes1.yml opt/app/vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes2.yml opt/app/vendor/symfony/routing/Tests/Fixtures/directory/routes3.yml opt/app/vendor/symfony/routing/Tests/Fixtures/directory_import/import.yml +opt/app/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher0.php opt/app/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php opt/app/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php opt/app/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php @@ -4866,6 +4974,8 @@ opt/app/vendor/symfony/routing/Tests/Fixtures/nonvalidkeys.yml opt/app/vendor/symfony/routing/Tests/Fixtures/nonvalidnode.xml opt/app/vendor/symfony/routing/Tests/Fixtures/nonvalidroute.xml opt/app/vendor/symfony/routing/Tests/Fixtures/null_values.xml +opt/app/vendor/symfony/routing/Tests/Fixtures/php_dsl.php +opt/app/vendor/symfony/routing/Tests/Fixtures/php_dsl_sub.php opt/app/vendor/symfony/routing/Tests/Fixtures/scalar_defaults.xml opt/app/vendor/symfony/routing/Tests/Fixtures/special_route_name.yml opt/app/vendor/symfony/routing/Tests/Fixtures/validpattern.php @@ -4910,6 +5020,9 @@ opt/app/vendor/symfony/translation/Catalogue/TargetOperation.php opt/app/vendor/symfony/translation/Command/XliffLintCommand.php opt/app/vendor/symfony/translation/DataCollector/TranslationDataCollector.php opt/app/vendor/symfony/translation/DataCollectorTranslator.php +opt/app/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php +opt/app/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php +opt/app/vendor/symfony/translation/DependencyInjection/TranslatorPass.php opt/app/vendor/symfony/translation/Dumper/CsvFileDumper.php opt/app/vendor/symfony/translation/Dumper/DumperInterface.php opt/app/vendor/symfony/translation/Dumper/FileDumper.php @@ -4931,6 +5044,11 @@ opt/app/vendor/symfony/translation/Exception/RuntimeException.php opt/app/vendor/symfony/translation/Extractor/AbstractFileExtractor.php opt/app/vendor/symfony/translation/Extractor/ChainExtractor.php opt/app/vendor/symfony/translation/Extractor/ExtractorInterface.php +opt/app/vendor/symfony/translation/Extractor/PhpExtractor.php +opt/app/vendor/symfony/translation/Extractor/PhpStringTokenParser.php +opt/app/vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php +opt/app/vendor/symfony/translation/Formatter/MessageFormatter.php +opt/app/vendor/symfony/translation/Formatter/MessageFormatterInterface.php opt/app/vendor/symfony/translation/IdentityTranslator.php opt/app/vendor/symfony/translation/Interval.php opt/app/vendor/symfony/translation/LICENSE @@ -4958,12 +5076,17 @@ opt/app/vendor/symfony/translation/MessageSelector.php opt/app/vendor/symfony/translation/MetadataAwareInterface.php opt/app/vendor/symfony/translation/PluralizationRules.php opt/app/vendor/symfony/translation/README.md +opt/app/vendor/symfony/translation/Reader/TranslationReader.php +opt/app/vendor/symfony/translation/Reader/TranslationReaderInterface.php opt/app/vendor/symfony/translation/Resources/schemas/xliff-core-1.2-strict.xsd opt/app/vendor/symfony/translation/Tests/Catalogue/AbstractOperationTest.php opt/app/vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php opt/app/vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php opt/app/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php opt/app/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php +opt/app/vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php +opt/app/vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php +opt/app/vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php opt/app/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php opt/app/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php opt/app/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php @@ -4975,6 +5098,8 @@ opt/app/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php opt/app/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php opt/app/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php opt/app/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php +opt/app/vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php +opt/app/vendor/symfony/translation/Tests/Formatter/MessageFormatterTest.php opt/app/vendor/symfony/translation/Tests/IdentityTranslatorTest.php opt/app/vendor/symfony/translation/Tests/IntervalTest.php opt/app/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php @@ -5009,6 +5134,9 @@ opt/app/vendor/symfony/translation/Tests/fixtures/empty.yml opt/app/vendor/symfony/translation/Tests/fixtures/encoding.xlf opt/app/vendor/symfony/translation/Tests/fixtures/escaped-id-plurals.po opt/app/vendor/symfony/translation/Tests/fixtures/escaped-id.po +opt/app/vendor/symfony/translation/Tests/fixtures/extractor/resource.format.engine +opt/app/vendor/symfony/translation/Tests/fixtures/extractor/this.is.a.template.format.engine +opt/app/vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php opt/app/vendor/symfony/translation/Tests/fixtures/fuzzy-translations.po opt/app/vendor/symfony/translation/Tests/fixtures/invalid-xml-resources.xlf opt/app/vendor/symfony/translation/Tests/fixtures/malformed.json @@ -5030,6 +5158,7 @@ opt/app/vendor/symfony/translation/Tests/fixtures/resourcebundle/res/en.res opt/app/vendor/symfony/translation/Tests/fixtures/resources-2.0-clean.xlf opt/app/vendor/symfony/translation/Tests/fixtures/resources-2.0.xlf opt/app/vendor/symfony/translation/Tests/fixtures/resources-clean.xlf +opt/app/vendor/symfony/translation/Tests/fixtures/resources-notes-meta.xlf opt/app/vendor/symfony/translation/Tests/fixtures/resources-target-attributes.xlf opt/app/vendor/symfony/translation/Tests/fixtures/resources-tool-info.xlf opt/app/vendor/symfony/translation/Tests/fixtures/resources.csv @@ -5051,6 +5180,7 @@ opt/app/vendor/symfony/translation/TranslatorBagInterface.php opt/app/vendor/symfony/translation/TranslatorInterface.php opt/app/vendor/symfony/translation/Util/ArrayConverter.php opt/app/vendor/symfony/translation/Writer/TranslationWriter.php +opt/app/vendor/symfony/translation/Writer/TranslationWriterInterface.php opt/app/vendor/symfony/translation/composer.json opt/app/vendor/symfony/translation/phpunit.xml.dist opt/app/vendor/symfony/var-dumper/CHANGELOG.md @@ -5062,6 +5192,7 @@ opt/app/vendor/symfony/var-dumper/Caster/ConstStub.php opt/app/vendor/symfony/var-dumper/Caster/CutArrayStub.php opt/app/vendor/symfony/var-dumper/Caster/CutStub.php opt/app/vendor/symfony/var-dumper/Caster/DOMCaster.php +opt/app/vendor/symfony/var-dumper/Caster/DateCaster.php opt/app/vendor/symfony/var-dumper/Caster/DoctrineCaster.php opt/app/vendor/symfony/var-dumper/Caster/EnumStub.php opt/app/vendor/symfony/var-dumper/Caster/ExceptionCaster.php @@ -5096,6 +5227,7 @@ opt/app/vendor/symfony/var-dumper/README.md opt/app/vendor/symfony/var-dumper/Resources/functions/dump.php opt/app/vendor/symfony/var-dumper/Test/VarDumperTestTrait.php opt/app/vendor/symfony/var-dumper/Tests/Caster/CasterTest.php +opt/app/vendor/symfony/var-dumper/Tests/Caster/DateCasterTest.php opt/app/vendor/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php opt/app/vendor/symfony/var-dumper/Tests/Caster/PdoCasterTest.php opt/app/vendor/symfony/var-dumper/Tests/Caster/RedisCasterTest.php diff --git a/.sandstorm/sandstorm-pkgdef.capnp b/.sandstorm/sandstorm-pkgdef.capnp index 158e0b088e..c73fcbd69a 100644 --- a/.sandstorm/sandstorm-pkgdef.capnp +++ b/.sandstorm/sandstorm-pkgdef.capnp @@ -15,8 +15,8 @@ const pkgdef :Spk.PackageDefinition = ( manifest = ( appTitle = (defaultText = "Firefly III"), - appVersion = 2, - appMarketingVersion = (defaultText = "4.6.10"), + appVersion = 4, + appMarketingVersion = (defaultText = "4.6.11"), actions = [ # Define your "new document" handlers here. diff --git a/CHANGELOG.md b/CHANGELOG.md index 316ac51876..1805366a62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,39 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [4.6.11] - 2017-11-30 +### Added +- A debug page at `/debug` for easier debug. +- Strings translatable (see [issue 976](https://github.com/firefly-iii/firefly-iii/issues/976)), thanks to [Findus23](https://github.com/Findus23) +- Even more strings are translatable (and translated), thanks to [pkoziol](https://github.com/pkoziol) (see [issue 979](https://github.com/firefly-iii/firefly-iii/issues/979)) +- Reconciliation of accounts ([issue 736](https://github.com/firefly-iii/firefly-iii/issues/736)), as requested by [kristophr](https://github.com/kristophr) and several others + +### Changed +- Extended currency list, as suggested by @emuhendis in [issue 994](https://github.com/firefly-iii/firefly-iii/issues/994) +- [Issue 996](https://github.com/firefly-iii/firefly-iii/issues/996) as suggested by [dp87](https://github.com/dp87) + +### Removed +- Disabled Heroku support until I get it working again. + +### Fixed +- [Issue 980](https://github.com/firefly-iii/firefly-iii/issues/980), reported by [Tim-Frensch](https://github.com/Tim-Frensch) +- [Issue 987](https://github.com/firefly-iii/firefly-iii/issues/987), reported by [gavu](https://github.com/gavu) +- [Issue 988](https://github.com/firefly-iii/firefly-iii/issues/988), reported by [gavu](https://github.com/gavu) +- [Issue 992](https://github.com/firefly-iii/firefly-iii/issues/992), reported by [ncicovic](https://github.com/ncicovic) +- [Issue 993](https://github.com/firefly-iii/firefly-iii/issues/993), reported by [gavu](https://github.com/gavu) +- [Issue 997](https://github.com/firefly-iii/firefly-iii/issues/997), reported by [gavu](https://github.com/gavu) +- [Issue 1000](https://github.com/firefly-iii/firefly-iii/issues/1000), reported by [xpfgsyb](https://github.com/xpfgsyb) +- [Issue 1001](https://github.com/firefly-iii/firefly-iii/issues/1001), reported by [gavu](https://github.com/gavu) +- [Issue 1002](https://github.com/firefly-iii/firefly-iii/issues/1002), reported by [ursweiss](https://github.com/ursweiss) +- [Issue 1003](https://github.com/firefly-iii/firefly-iii/issues/1003), reported by [ursweiss](https://github.com/ursweiss) +- [Issue 1004](https://github.com/firefly-iii/firefly-iii/issues/1004), reported by [Aquariu](https://github.com/Aquariu) +- [Issue 1010](https://github.com/firefly-iii/firefly-iii/issues/1010) +- [Issue 1014](https://github.com/firefly-iii/firefly-iii/issues/1014), reported by [ursweiss](https://github.com/ursweiss) +- [Issue 1016](https://github.com/firefly-iii/firefly-iii/issues/1016) +- [Issue 1024](https://github.com/firefly-iii/firefly-iii/issues/1024), reported by [gavu](https://github.com/gavu) +- [Issue 1025](https://github.com/firefly-iii/firefly-iii/issues/1025), reported by [gavu](https://github.com/gavu) + + ## [4.6.10] - 2017-11-xx ### Added - Greatly expanded Docker support thanks to [alazare619](https://github.com/alazare619) @@ -277,8 +310,8 @@ This will be the last release to support PHP 7.0. - Can now make rules for attachments, see [issue 608](https://github.com/firefly-iii/firefly-iii/issues/608), as suggested by [dzaikos](https://github.com/dzaikos). ### Fixed -- Fixed [issue 629](https://github.com/firefly-iii/firefly-iii/issues/629), reported by forcaeluz -- Fixed [issue 630](https://github.com/firefly-iii/firefly-iii/issues/630), reported by welbert +- Fixed [issue 629](https://github.com/firefly-iii/firefly-iii/issues/629), reported by @forcaeluz +- Fixed [issue 630](https://github.com/firefly-iii/firefly-iii/issues/630), reported by @welbert - And more various bug fixes. ## [4.3.8] - 2017-04-08 diff --git a/README.md b/README.md index eeaeda4df2..e6f1882923 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,8 @@ You can install Firefly III on any Linux or Windows machine. You'll need a web s Register for a free Heroku account and instantly run Firefly III on your very own cloud instance. +_My Heroku configuration is currently broken, but I'm trying to fix it._ + ### Using Sandstorm.io You can find Firefly III in [the Sandstorm.io marketplace](https://apps.sandstorm.io/app/uws252ya9mep4t77tevn85333xzsgrpgth8q4y1rhknn1hammw70). You can run it on your own installation or on Oasis. diff --git a/app.json b/app.json index 35680aa38b..4843baa8d6 100644 --- a/app.json +++ b/app.json @@ -2,6 +2,7 @@ "name": "Firefly III", "description": "A free and open source personal finances manager", "repository": "https://github.com/firefly-iii/firefly-iii", + "website": "https://firefly-iii.github.io/", "logo": "https://raw.githubusercontent.com/firefly-iii/firefly-iii/master/public/mstile-150x150.png", "keywords": [ "finance", @@ -36,14 +37,16 @@ "transfers", "management" ], - "website": "https://firefly-iii.github.io/", "addons": [ { - "plan": "heroku-postgresql" + "plan": "heroku-postgresql", + "options": { + "version": "9.5" + } } ], "scripts": { - "postdeploy": "export APP_KEY=$(php artisan --no-ansi key:generate --show)" + "postdeploy": "php artisan migrate:refresh --seed;php artisan firefly:instructions install" }, "buildpacks": [ { diff --git a/app/Console/Commands/CreateExport.php b/app/Console/Commands/CreateExport.php index d2c95eaa96..0d55833af7 100644 --- a/app/Console/Commands/CreateExport.php +++ b/app/Console/Commands/CreateExport.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII\Console\Commands; use Carbon\Carbon; @@ -34,13 +32,10 @@ use FireflyIII\Repositories\User\UserRepositoryInterface; use Illuminate\Console\Command; use Storage; - /** - * Class CreateExport + * Class CreateExport. * * Generates export from the command line. - * - * @package FireflyIII\Console\Commands */ class CreateExport extends Command { @@ -66,7 +61,6 @@ class CreateExport extends Command /** * Create a new command instance. - * */ public function __construct() { @@ -74,7 +68,6 @@ class CreateExport extends Command } /** - * * @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five its fine. * @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @@ -109,7 +102,7 @@ class CreateExport extends Command // first date $firstJournal = $journalRepository->first(); $first = new Carbon; - if (!is_null($firstJournal->id)) { + if (null !== $firstJournal->id) { $first = $firstJournal->date; } @@ -125,7 +118,6 @@ class CreateExport extends Command 'job' => $job, ]; - /** @var ProcessorInterface $processor */ $processor = app(ProcessorInterface::class); $processor->setSettings($settings); diff --git a/app/Console/Commands/CreateImport.php b/app/Console/Commands/CreateImport.php index d0cc7136dc..69b034ac7d 100644 --- a/app/Console/Commands/CreateImport.php +++ b/app/Console/Commands/CreateImport.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Console\Commands; @@ -35,9 +34,7 @@ use Monolog\Formatter\LineFormatter; use Preferences; /** - * Class CreateImport - * - * @package FireflyIII\Console\Commands + * Class CreateImport. */ class CreateImport extends Command { @@ -65,7 +62,6 @@ class CreateImport extends Command /** * Create a new command instance. - * */ public function __construct() { @@ -98,7 +94,7 @@ class CreateImport extends Command } $configurationData = json_decode(file_get_contents($configuration)); - if (is_null($configurationData)) { + if (null === $configurationData) { $this->error(sprintf('Firefly III cannot read the contents of configuration file "%s" (working directory: "%s").', $configuration, $cwd)); return; @@ -109,25 +105,21 @@ class CreateImport extends Command $this->line(sprintf('Import into user: #%d (%s)', $user->id, $user->email)); $this->line(sprintf('Type of import: %s', $type)); - /** @var ImportJobRepositoryInterface $jobRepository */ $jobRepository = app(ImportJobRepositoryInterface::class); $jobRepository->setUser($user); $job = $jobRepository->create($type); $this->line(sprintf('Created job "%s"', $job->key)); - Artisan::call('firefly:encrypt-file', ['file' => $file, 'key' => $job->key]); $this->line('Stored import data...'); - $job->configuration = $configurationData; $job->status = 'configured'; $job->save(); $this->line('Stored configuration...'); - - if ($this->option('start') === true) { + if (true === $this->option('start')) { $this->line('The import will start in a moment. This process is not visible...'); Log::debug('Go for import!'); @@ -138,7 +130,6 @@ class CreateImport extends Command $handler->setFormatter($formatter); $monolog->pushHandler($handler); - // start the actual routine: /** @var ImportRoutine $routine */ $routine = app(ImportRoutine::class); @@ -177,7 +168,7 @@ class CreateImport extends Command $cwd = getcwd(); $validTypes = array_keys(config('firefly.import_formats')); $type = strtolower($this->option('type')); - if (is_null($user->id)) { + if (null === $user->id) { $this->error(sprintf('There is no user with ID %d.', $this->option('user'))); return false; diff --git a/app/Console/Commands/DecryptAttachment.php b/app/Console/Commands/DecryptAttachment.php index 5e9180f978..e574a9cd00 100644 --- a/app/Console/Commands/DecryptAttachment.php +++ b/app/Console/Commands/DecryptAttachment.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Console\Commands; @@ -28,9 +27,7 @@ use Illuminate\Console\Command; use Log; /** - * Class DecryptAttachment - * - * @package FireflyIII\Console\Commands + * Class DecryptAttachment. */ class DecryptAttachment extends Command { @@ -50,15 +47,12 @@ class DecryptAttachment extends Command = 'firefly:decrypt-attachment {id:The ID of the attachment.} {name:The file name of the attachment.} {directory:Where the file must be stored.}'; - /** * Create a new command instance. - * */ public function __construct() { parent::__construct(); - } /** @@ -66,7 +60,6 @@ class DecryptAttachment extends Command * * @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five its fine. * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - * */ public function handle() { @@ -76,7 +69,7 @@ class DecryptAttachment extends Command $attachment = $repository->findWithoutUser($attachmentId); $attachmentName = trim($this->argument('name')); $storagePath = realpath(trim($this->argument('directory'))); - if (is_null($attachment->id)) { + if (null === $attachment->id) { $this->error(sprintf('No attachment with id #%d', $attachmentId)); Log::error(sprintf('DecryptAttachment: No attachment with id #%d', $attachmentId)); @@ -108,7 +101,7 @@ class DecryptAttachment extends Command $content = $repository->getContent($attachment); $this->line(sprintf('Going to write content for attachment #%d into file "%s"', $attachment->id, $fullPath)); $result = file_put_contents($fullPath, $content); - if ($result === false) { + if (false === $result) { $this->error('Could not write to file.'); return; diff --git a/app/Console/Commands/EncryptFile.php b/app/Console/Commands/EncryptFile.php index acd355060c..a90d9e819b 100644 --- a/app/Console/Commands/EncryptFile.php +++ b/app/Console/Commands/EncryptFile.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Console\Commands; @@ -27,9 +26,7 @@ use Crypt; use Illuminate\Console\Command; /** - * Class EncryptFile - * - * @package FireflyIII\Console\Commands + * Class EncryptFile. */ class EncryptFile extends Command { @@ -49,7 +46,6 @@ class EncryptFile extends Command /** * Create a new command instance. - * */ public function __construct() { diff --git a/app/Console/Commands/Import.php b/app/Console/Commands/Import.php index 0e1f861a55..d4208dea70 100644 --- a/app/Console/Commands/Import.php +++ b/app/Console/Commands/Import.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Console\Commands; @@ -31,9 +30,7 @@ use Illuminate\Support\MessageBag; use Log; /** - * Class Import - * - * @package FireflyIII\Console\Commands + * Class Import. */ class Import extends Command { @@ -53,7 +50,6 @@ class Import extends Command /** * Create a new command instance. - * */ public function __construct() { @@ -68,7 +64,7 @@ class Import extends Command Log::debug('Start start-import command'); $jobKey = $this->argument('key'); $job = ImportJob::where('key', $jobKey)->first(); - if (is_null($job)) { + if (null === $job) { $this->error(sprintf('No job found with key "%s"', $jobKey)); return; @@ -109,14 +105,14 @@ class Import extends Command */ private function isValid(ImportJob $job): bool { - if (is_null($job)) { + if (null === $job) { Log::error('This job does not seem to exist.'); $this->error('This job does not seem to exist.'); return false; } - if ($job->status !== 'configured') { + if ('configured' !== $job->status) { Log::error(sprintf('This job is not ready to be imported (status is %s).', $job->status)); $this->error('This job is not ready to be imported.'); diff --git a/app/Console/Commands/ScanAttachments.php b/app/Console/Commands/ScanAttachments.php index e6dd31b0e0..53d84e9663 100644 --- a/app/Console/Commands/ScanAttachments.php +++ b/app/Console/Commands/ScanAttachments.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Console\Commands; @@ -31,9 +30,7 @@ use Illuminate\Contracts\Filesystem\FileNotFoundException; use Storage; /** - * Class ScanAttachments - * - * @package FireflyIII\Console\Commands + * Class ScanAttachments. */ class ScanAttachments extends Command { @@ -53,7 +50,6 @@ class ScanAttachments extends Command /** * Create a new command instance. - * */ public function __construct() { diff --git a/app/Console/Commands/UpgradeDatabase.php b/app/Console/Commands/UpgradeDatabase.php index 32db86834d..2123a65a24 100644 --- a/app/Console/Commands/UpgradeDatabase.php +++ b/app/Console/Commands/UpgradeDatabase.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Console\Commands; - use DB; use FireflyIII\Models\Account; use FireflyIII\Models\AccountMeta; @@ -45,17 +43,15 @@ use Preferences; use Schema; /** - * Class UpgradeDatabase + * Class UpgradeDatabase. * * Upgrade user database. * * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) // it just touches a lot of things. - * @package FireflyIII\Console\Commands */ class UpgradeDatabase extends Command { - /** * The console command description. * @@ -85,6 +81,7 @@ class UpgradeDatabase extends Command $this->setTransactionIdentifier(); $this->migrateRepetitions(); $this->updateAccountCurrencies(); + $this->createNewTypes(); $this->line('Updating currency information..'); $this->updateTransferCurrencies(); $this->updateOtherCurrencies(); @@ -93,8 +90,6 @@ class UpgradeDatabase extends Command $this->info('Firefly III database is up to date.'); return; - - } /** @@ -108,7 +103,7 @@ class UpgradeDatabase extends Command foreach ($set as $budgetLimit) { /** @var LimitRepetition $repetition */ $repetition = $budgetLimit->limitrepetitions()->first(); - if (!is_null($repetition)) { + if (null !== $repetition) { $budgetLimit->end_date = $repetition->enddate; $budgetLimit->save(); $this->line(sprintf('Updated budget limit #%d', $budgetLimit->id)); @@ -173,7 +168,7 @@ class UpgradeDatabase extends Command $obCurrency = intval($openingBalance->transaction_currency_id); // both 0? set to default currency: - if ($accountCurrency === 0 && $obCurrency === 0) { + if (0 === $accountCurrency && 0 === $obCurrency) { AccountMeta::create(['account_id' => $account->id, 'name' => 'currency_id', 'data' => $defaultCurrency->id]); $this->line(sprintf('Account #%d ("%s") now has a currency setting (%s).', $account->id, $account->name, $defaultCurrencyCode)); @@ -181,7 +176,7 @@ class UpgradeDatabase extends Command } // account is set to 0, opening balance is not? - if ($accountCurrency === 0 && $obCurrency > 0) { + if (0 === $accountCurrency && $obCurrency > 0) { AccountMeta::create(['account_id' => $account->id, 'name' => 'currency_id', 'data' => $obCurrency]); $this->line(sprintf('Account #%d ("%s") now has a currency setting (%s).', $account->id, $account->name, $defaultCurrencyCode)); @@ -231,7 +226,7 @@ class UpgradeDatabase extends Command ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') ->whereIn('account_types.type', [AccountType::DEFAULT, AccountType::ASSET])->first(['transactions.*']); - if (is_null($transaction)) { + if (null === $transaction) { return; } /** @var Account $account */ @@ -240,7 +235,7 @@ class UpgradeDatabase extends Command $transactions = $journal->transactions()->get(); $transactions->each( function (Transaction $transaction) use ($currency) { - if (is_null($transaction->transaction_currency_id)) { + if (null === $transaction->transaction_currency_id) { $transaction->transaction_currency_id = $currency->id; $transaction->save(); } @@ -295,6 +290,19 @@ class UpgradeDatabase extends Command ); } + private function createNewTypes(): void + { + // create transaction type "Reconciliation". + $type = TransactionType::where('type', TransactionType::RECONCILIATION)->first(); + if (is_null($type)) { + TransactionType::create(['type' => TransactionType::RECONCILIATION]); + } + $account = AccountType::where('type', AccountType::RECONCILIATION)->first(); + if (is_null($account)) { + AccountType::create(['type' => AccountType::RECONCILIATION]); + } + } + /** * Move all the journal_meta notes to their note object counter parts. */ @@ -305,8 +313,8 @@ class UpgradeDatabase extends Command foreach ($set as $meta) { $journal = $meta->transactionJournal; $note = $journal->notes()->first(); - if (is_null($note)) { - $note = new Note; + if (null === $note) { + $note = new Note(); $note->noteable()->associate($journal); } @@ -314,11 +322,9 @@ class UpgradeDatabase extends Command $note->save(); Log::debug(sprintf('Migrated meta note #%d to Note #%d', $meta->id, $note->id)); $meta->delete(); - } } - /** * This method makes sure that the transaction journal uses the currency given in the transaction. * @@ -334,7 +340,10 @@ class UpgradeDatabase extends Command if (!(intval($currency->id) === intval($journal->transaction_currency_id))) { $this->line( sprintf( - 'Transfer #%d ("%s") has been updated to use %s instead of %s.', $journal->id, $journal->description, $currency->code, + 'Transfer #%d ("%s") has been updated to use %s instead of %s.', + $journal->id, + $journal->description, + $currency->code, $journal->transactionCurrency->code ) ); @@ -376,7 +385,7 @@ class UpgradeDatabase extends Command return; } - if (!is_null($opposing)) { + if (null !== $opposing) { // give both a new identifier: $transaction->identifier = $identifier; $opposing->identifier = $identifier; @@ -385,7 +394,7 @@ class UpgradeDatabase extends Command $processed[] = $transaction->id; $processed[] = $opposing->id; } - $identifier++; + ++$identifier; } return; @@ -412,7 +421,7 @@ class UpgradeDatabase extends Command $currency = $repository->find(intval($transaction->account->getMeta('currency_id'))); // has no currency ID? Must have, so fill in using account preference: - if (is_null($transaction->transaction_currency_id)) { + if (null === $transaction->transaction_currency_id) { $transaction->transaction_currency_id = $currency->id; Log::debug(sprintf('Transaction #%d has no currency setting, now set to %s', $transaction->id, $currency->code)); $transaction->save(); @@ -420,11 +429,14 @@ class UpgradeDatabase extends Command // does not match the source account (see above)? Can be fixed // when mismatch in transaction and NO foreign amount is set: - if ($transaction->transaction_currency_id !== $currency->id && is_null($transaction->foreign_amount)) { + if ($transaction->transaction_currency_id !== $currency->id && null === $transaction->foreign_amount) { Log::debug( sprintf( - 'Transaction #%d has a currency setting (#%d) that should be #%d. Amount remains %s, currency is changed.', $transaction->id, - $transaction->transaction_currency_id, $currency->id, $transaction->amount + 'Transaction #%d has a currency setting (#%d) that should be #%d. Amount remains %s, currency is changed.', + $transaction->id, + $transaction->transaction_currency_id, + $currency->id, + $transaction->amount ) ); $transaction->transaction_currency_id = $currency->id; @@ -438,7 +450,7 @@ class UpgradeDatabase extends Command $opposing = $journal->transactions()->where('amount', '>', 0)->where('identifier', $transaction->identifier)->first(); $opposingCurrency = $repository->find(intval($opposing->account->getMeta('currency_id'))); - if (is_null($opposingCurrency->id)) { + if (null === $opposingCurrency->id) { Log::error(sprintf('Account #%d ("%s") must have currency preference but has none.', $opposing->account->id, $opposing->account->name)); return; @@ -468,24 +480,23 @@ class UpgradeDatabase extends Command } // if foreign amount of one is null and the other is not, use this to restore: - if (is_null($transaction->foreign_amount) && !is_null($opposing->foreign_amount)) { + if (null === $transaction->foreign_amount && null !== $opposing->foreign_amount) { $transaction->foreign_amount = bcmul(strval($opposing->foreign_amount), '-1'); $transaction->save(); Log::debug(sprintf('Restored foreign amount of transaction (1) #%d to %s', $transaction->id, $transaction->foreign_amount)); } // if foreign amount of one is null and the other is not, use this to restore (other way around) - if (is_null($opposing->foreign_amount) && !is_null($transaction->foreign_amount)) { + if (null === $opposing->foreign_amount && null !== $transaction->foreign_amount) { $opposing->foreign_amount = bcmul(strval($transaction->foreign_amount), '-1'); $opposing->save(); Log::debug(sprintf('Restored foreign amount of transaction (2) #%d to %s', $opposing->id, $opposing->foreign_amount)); } // when both are zero, try to grab it from journal: - if (is_null($opposing->foreign_amount) && is_null($transaction->foreign_amount)) { - + if (null === $opposing->foreign_amount && null === $transaction->foreign_amount) { $foreignAmount = $journal->getMeta('foreign_amount'); - if (is_null($foreignAmount)) { + if (null === $foreignAmount) { Log::debug(sprintf('Journal #%d has missing foreign currency data, forced to do 1:1 conversion :(.', $transaction->transaction_journal_id)); $transaction->foreign_amount = bcmul(strval($transaction->amount), '-1'); $opposing->foreign_amount = bcmul(strval($opposing->amount), '-1'); @@ -497,7 +508,9 @@ class UpgradeDatabase extends Command $foreignPositive = app('steam')->positive(strval($foreignAmount)); Log::debug( sprintf( - 'Journal #%d has missing foreign currency info, try to restore from meta-data ("%s").', $transaction->transaction_journal_id, $foreignAmount + 'Journal #%d has missing foreign currency info, try to restore from meta-data ("%s").', + $transaction->transaction_journal_id, + $foreignAmount ) ); $transaction->foreign_amount = bcmul($foreignPositive, '-1'); @@ -506,7 +519,6 @@ class UpgradeDatabase extends Command $opposing->save(); } - return; } } diff --git a/app/Console/Commands/UpgradeFireflyInstructions.php b/app/Console/Commands/UpgradeFireflyInstructions.php index 8e331f8adb..1daafe93ec 100644 --- a/app/Console/Commands/UpgradeFireflyInstructions.php +++ b/app/Console/Commands/UpgradeFireflyInstructions.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Console\Commands; @@ -26,9 +25,7 @@ namespace FireflyIII\Console\Commands; use Illuminate\Console\Command; /** - * Class UpgradeFireflyInstructions - * - * @package FireflyIII\Console\Commands + * Class UpgradeFireflyInstructions. */ class UpgradeFireflyInstructions extends Command { @@ -47,7 +44,6 @@ class UpgradeFireflyInstructions extends Command /** * Create a new command instance. - * */ public function __construct() { @@ -59,17 +55,16 @@ class UpgradeFireflyInstructions extends Command */ public function handle() { - - if ($this->argument('task') === 'update') { + if ('update' === $this->argument('task')) { $this->updateInstructions(); } - if ($this->argument('task') === 'install') { + if ('install' === $this->argument('task')) { $this->installInstructions(); } } /** - * Show a nice box + * Show a nice box. * * @param string $text */ @@ -82,7 +77,7 @@ class UpgradeFireflyInstructions extends Command } /** - * Show a nice info box + * Show a nice info box. * * @param string $text */ @@ -109,12 +104,10 @@ class UpgradeFireflyInstructions extends Command if (substr($version, 0, $len) === $compare) { $text = $config[$compare]; } - } $this->showLine(); $this->boxed(''); - if (is_null($text)) { - + if (null === $text) { $this->boxed(sprintf('Thank you for installing Firefly III, v%s!', $version)); $this->boxedInfo('There are no extra installation instructions.'); $this->boxed('Firefly III should be ready for use.'); @@ -131,17 +124,16 @@ class UpgradeFireflyInstructions extends Command } /** - * Show a line + * Show a line. */ private function showLine() { $line = '+'; - for ($i = 0; $i < 78; $i++) { + for ($i = 0; $i < 78; ++$i) { $line .= '-'; } $line .= '+'; $this->line($line); - } /** @@ -159,12 +151,10 @@ class UpgradeFireflyInstructions extends Command if (substr($version, 0, $len) === $compare) { $text = $config[$compare]; } - } $this->showLine(); $this->boxed(''); - if (is_null($text)) { - + if (null === $text) { $this->boxed(sprintf('Thank you for updating to Firefly III, v%s', $version)); $this->boxedInfo('There are no extra upgrade instructions.'); $this->boxed('Firefly III should be ready for use.'); diff --git a/app/Console/Commands/UseEncryption.php b/app/Console/Commands/UseEncryption.php index 7a7b5b3eea..648533fa20 100644 --- a/app/Console/Commands/UseEncryption.php +++ b/app/Console/Commands/UseEncryption.php @@ -19,7 +19,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); /** @@ -36,9 +35,7 @@ use Illuminate\Console\Command; use Illuminate\Support\Str; /** - * Class UseEncryption - * - * @package FireflyIII\Console\Commands + * Class UseEncryption. */ class UseEncryption extends Command { @@ -57,7 +54,6 @@ class UseEncryption extends Command /** * Create a new command instance. - * */ public function __construct() { diff --git a/app/Console/Commands/VerifiesAccessToken.php b/app/Console/Commands/VerifiesAccessToken.php index 165ead1d61..15b2ae5658 100644 --- a/app/Console/Commands/VerifiesAccessToken.php +++ b/app/Console/Commands/VerifiesAccessToken.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Console\Commands; @@ -28,11 +27,9 @@ use Log; use Preferences; /** - * Trait VerifiesAccessToken + * Trait VerifiesAccessToken. * * Verifies user access token for sensitive commands. - * - * @package FireflyIII\Console\Commands */ trait VerifiesAccessToken { @@ -58,13 +55,13 @@ trait VerifiesAccessToken $repository = app(UserRepositoryInterface::class); $user = $repository->find($userId); - if (is_null($user->id)) { + if (null === $user->id) { Log::error(sprintf('verifyAccessToken(): no such user for input "%d"', $userId)); return false; } $accessToken = Preferences::getForUser($user, 'access_token', null); - if (is_null($accessToken)) { + if (null === $accessToken) { Log::error(sprintf('User #%d has no access token, so cannot access command line options.', $userId)); return false; @@ -77,5 +74,4 @@ trait VerifiesAccessToken return true; } - -} \ No newline at end of file +} diff --git a/app/Console/Commands/VerifyDatabase.php b/app/Console/Commands/VerifyDatabase.php index d731bb19c8..79e07b02ea 100644 --- a/app/Console/Commands/VerifyDatabase.php +++ b/app/Console/Commands/VerifyDatabase.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Console\Commands; @@ -42,11 +41,9 @@ use Schema; use stdClass; /** - * Class VerifyDatabase + * Class VerifyDatabase. * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - * - * @package FireflyIII\Console\Commands */ class VerifyDatabase extends Command { @@ -96,7 +93,6 @@ class VerifyDatabase extends Command $this->repairPiggyBanks(); $this->createLinkTypes(); $this->createAccessTokens(); - } /** @@ -108,7 +104,7 @@ class VerifyDatabase extends Command /** @var User $user */ foreach ($users as $user) { $pref = Preferences::getForUser($user, 'access_token', null); - if (is_null($pref)) { + if (null === $pref) { $token = $user->generateAccessToken(); Preferences::setForUser($user, 'access_token', $token); $this->line(sprintf('Generated access token for user %s', $user->email)); @@ -129,7 +125,7 @@ class VerifyDatabase extends Command ]; foreach ($set as $name => $values) { $link = LinkType::where('name', $name)->where('outward', $values[0])->where('inward', $values[1])->first(); - if (is_null($link)) { + if (null === $link) { $link = new LinkType; $link->name = $name; $link->outward = $values[0]; @@ -148,17 +144,17 @@ class VerifyDatabase extends Command $set = PiggyBankEvent::with(['PiggyBank', 'TransactionJournal', 'TransactionJournal.TransactionType'])->get(); $set->each( function (PiggyBankEvent $event) { - if (is_null($event->transaction_journal_id)) { + if (null === $event->transaction_journal_id) { return true; } /** @var TransactionJournal $journal */ $journal = $event->transactionJournal()->first(); - if (is_null($journal)) { + if (null === $journal) { return true; } $type = $journal->transactionType->type; - if ($type !== TransactionType::TRANSFER) { + if (TransactionType::TRANSFER !== $type) { $event->transaction_journal_id = null; $event->save(); $this->line(sprintf('Piggy bank #%d was referenced by an invalid event. This has been fixed.', $event->piggy_bank_id)); @@ -208,7 +204,10 @@ class VerifyDatabase extends Command foreach ($set as $entry) { $line = sprintf( 'User #%d (%s) has budget #%d ("%s") which has no budget limits.', - $entry->user_id, $entry->email, $entry->id, $entry->name + $entry->user_id, + $entry->email, + $entry->id, + $entry->name ); $this->line($line); } @@ -232,11 +231,11 @@ class VerifyDatabase extends Command ->get( ['accounts.id as account_id', 'accounts.deleted_at as account_deleted_at', 'transactions.id as transaction_id', 'transactions.deleted_at as transaction_deleted_at', 'transaction_journals.id as journal_id', - 'transaction_journals.deleted_at as journal_deleted_at'] + 'transaction_journals.deleted_at as journal_deleted_at',] ); /** @var stdClass $entry */ foreach ($set as $entry) { - $date = is_null($entry->transaction_deleted_at) ? $entry->journal_deleted_at : $entry->transaction_deleted_at; + $date = null === $entry->transaction_deleted_at ? $entry->journal_deleted_at : $entry->transaction_deleted_at; $this->error( 'Error: Account #' . $entry->account_id . ' should have been deleted, but has not.' . ' Find it in the table called "accounts" and change the "deleted_at" field to: "' . $date . '"' @@ -268,7 +267,7 @@ class VerifyDatabase extends Command ->whereNull('transaction_journals.deleted_at') ->get( ['transaction_journals.id', 'transaction_journals.user_id', 'users.email', 'account_types.type as a_type', - 'transaction_types.type'] + 'transaction_types.type',] ); foreach ($set as $entry) { $this->error( @@ -287,7 +286,7 @@ class VerifyDatabase extends Command } /** - * Any deleted transaction journals that have transactions that are NOT deleted: + * Any deleted transaction journals that have transactions that are NOT deleted:. */ private function reportJournals() { @@ -301,7 +300,7 @@ class VerifyDatabase extends Command 'transaction_journals.description', 'transaction_journals.deleted_at as journal_deleted', 'transactions.id as transaction_id', - 'transactions.deleted_at as transaction_deleted_at'] + 'transactions.deleted_at as transaction_deleted_at',] ); /** @var stdClass $entry */ foreach ($set as $entry) { @@ -327,7 +326,6 @@ class VerifyDatabase extends Command 'Error: Journal #' . $entry->id . ' has zero transactions. Open table "transaction_journals" and delete the entry with id #' . $entry->id ); } - } /** @@ -339,7 +337,7 @@ class VerifyDatabase extends Command { $plural = str_plural($name); $class = sprintf('FireflyIII\Models\%s', ucfirst($name)); - $field = $name === 'tag' ? 'tag' : 'name'; + $field = 'tag' === $name ? 'tag' : 'name'; $set = $class::leftJoin($name . '_transaction_journal', $plural . '.id', '=', $name . '_transaction_journal.' . $name . '_id') ->leftJoin('users', $plural . '.user_id', '=', 'users.id') ->distinct() @@ -349,7 +347,6 @@ class VerifyDatabase extends Command /** @var stdClass $entry */ foreach ($set as $entry) { - $objName = $entry->name; try { $objName = Crypt::decrypt($objName); @@ -359,7 +356,11 @@ class VerifyDatabase extends Command $line = sprintf( 'User #%d (%s) has %s #%d ("%s") which has no transactions.', - $entry->user_id, $entry->email, $name, $entry->id, $objName + $entry->user_id, + $entry->email, + $name, + $entry->id, + $objName ); $this->line($line); } @@ -376,7 +377,7 @@ class VerifyDatabase extends Command /** @var User $user */ foreach ($userRepository->all() as $user) { $sum = strval($user->transactions()->sum('amount')); - if (bccomp($sum, '0') !== 0) { + if (0 !== bccomp($sum, '0')) { $this->error('Error: Transactions for user #' . $user->id . ' (' . $user->email . ') are off by ' . $sum . '!'); } } @@ -392,7 +393,7 @@ class VerifyDatabase extends Command ->whereNull('transaction_journals.deleted_at') ->get( ['transactions.id as transaction_id', 'transactions.deleted_at as transaction_deleted', 'transaction_journals.id as journal_id', - 'transaction_journals.deleted_at'] + 'transaction_journals.deleted_at',] ); /** @var stdClass $entry */ foreach ($set as $entry) { @@ -419,11 +420,10 @@ class VerifyDatabase extends Command $this->error( sprintf( 'Error: Transaction journal #%d is a %s, but has a budget. Edit it without changing anything, so the budget will be removed.', - $entry->id, $entry->transactionType->type + $entry->id, + $entry->transactionType->type ) ); } - - } } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 4e6511ba43..b444bbef42 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - /** * Kernel.php * Copyright (c) 2017 thegrumpydictator@gmail.com @@ -48,13 +46,10 @@ class Kernel extends ConsoleKernel */ protected $commands = [ - // ]; /** * Register the commands for the application. - * - * @return void */ protected function commands() { @@ -66,9 +61,8 @@ class Kernel extends ConsoleKernel /** * Define the application's command schedule. * - * @param \Illuminate\Console\Scheduling\Schedule $schedule + * @param \Illuminate\Console\Scheduling\Schedule $schedule * - * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ protected function schedule(Schedule $schedule) diff --git a/app/Events/AdminRequestedTestMessage.php b/app/Events/AdminRequestedTestMessage.php index e556a5ce84..5406ca4bc9 100644 --- a/app/Events/AdminRequestedTestMessage.php +++ b/app/Events/AdminRequestedTestMessage.php @@ -18,20 +18,16 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Events; - use FireflyIII\User; use Illuminate\Queue\SerializesModels; use Log; /** - * Class AdminRequestedTestMessage - * - * @package FireflyIII\Events + * Class AdminRequestedTestMessage. */ class AdminRequestedTestMessage extends Event { @@ -43,7 +39,7 @@ class AdminRequestedTestMessage extends Event /** * Create a new event instance. * - * @param User $user + * @param User $user * @param string $ipAddress */ public function __construct(User $user, string $ipAddress) diff --git a/app/Events/Event.php b/app/Events/Event.php index cc0b01595d..4efa51dfce 100644 --- a/app/Events/Event.php +++ b/app/Events/Event.php @@ -18,17 +18,13 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Events; /** - * Class Event - * - * @package FireflyIII\Events + * Class Event. */ abstract class Event { - // } diff --git a/app/Events/RegisteredUser.php b/app/Events/RegisteredUser.php index 271ff0bfa5..3886edd432 100644 --- a/app/Events/RegisteredUser.php +++ b/app/Events/RegisteredUser.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Events; @@ -27,9 +26,7 @@ use FireflyIII\User; use Illuminate\Queue\SerializesModels; /** - * Class RegisteredUser - * - * @package FireflyIII\Events + * Class RegisteredUser. */ class RegisteredUser extends Event { @@ -41,7 +38,7 @@ class RegisteredUser extends Event /** * Create a new event instance. This event is triggered when a new user registers. * - * @param User $user + * @param User $user * @param string $ipAddress */ public function __construct(User $user, string $ipAddress) diff --git a/app/Events/RequestedNewPassword.php b/app/Events/RequestedNewPassword.php index f442332fda..e8031e316e 100644 --- a/app/Events/RequestedNewPassword.php +++ b/app/Events/RequestedNewPassword.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Events; @@ -27,9 +26,7 @@ use FireflyIII\User; use Illuminate\Queue\SerializesModels; /** - * Class RequestedNewPassword - * - * @package FireflyIII\Events + * Class RequestedNewPassword. */ class RequestedNewPassword extends Event { @@ -42,7 +39,7 @@ class RequestedNewPassword extends Event /** * Create a new event instance. This event is triggered when a users tries to reset his or her password. * - * @param User $user + * @param User $user * @param string $token * @param string $ipAddress */ @@ -52,5 +49,4 @@ class RequestedNewPassword extends Event $this->token = $token; $this->ipAddress = $ipAddress; } - } diff --git a/app/Events/StoredTransactionJournal.php b/app/Events/StoredTransactionJournal.php index 51e07fc40b..deab148be0 100644 --- a/app/Events/StoredTransactionJournal.php +++ b/app/Events/StoredTransactionJournal.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Events; @@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal; use Illuminate\Queue\SerializesModels; /** - * Class StoredTransactionJournal - * - * @package FireflyIII\Events + * Class StoredTransactionJournal. */ class StoredTransactionJournal extends Event { - use SerializesModels; /** @var TransactionJournal */ @@ -49,10 +45,7 @@ class StoredTransactionJournal extends Event */ public function __construct(TransactionJournal $journal, int $piggyBankId) { - // $this->journal = $journal; $this->piggyBankId = $piggyBankId; - } - } diff --git a/app/Events/UpdatedTransactionJournal.php b/app/Events/UpdatedTransactionJournal.php index 603fb90ae2..9f365929e8 100644 --- a/app/Events/UpdatedTransactionJournal.php +++ b/app/Events/UpdatedTransactionJournal.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Events; @@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal; use Illuminate\Queue\SerializesModels; /** - * Class UpdatedTransactionJournal - * - * @package FireflyIII\Events + * Class UpdatedTransactionJournal. */ class UpdatedTransactionJournal extends Event { - use SerializesModels; /** @var TransactionJournal */ @@ -46,8 +42,6 @@ class UpdatedTransactionJournal extends Event */ public function __construct(TransactionJournal $journal) { - // $this->journal = $journal; } - } diff --git a/app/Events/UserChangedEmail.php b/app/Events/UserChangedEmail.php index f86876fa57..2c75145d34 100644 --- a/app/Events/UserChangedEmail.php +++ b/app/Events/UserChangedEmail.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Events; @@ -27,19 +26,17 @@ use FireflyIII\User; use Illuminate\Queue\SerializesModels; /** - * Class UserChangedEmail - * - * @package FireflyIII\Events + * Class UserChangedEmail. */ class UserChangedEmail extends Event { use SerializesModels; - /** @var string */ + /** @var string */ public $ipAddress; - /** @var string */ + /** @var string */ public $newEmail; - /** @var string */ + /** @var string */ public $oldEmail; /** @var User */ public $user; @@ -59,4 +56,4 @@ class UserChangedEmail extends Event $this->oldEmail = $oldEmail; $this->newEmail = $newEmail; } -} \ No newline at end of file +} diff --git a/app/Exceptions/FireflyException.php b/app/Exceptions/FireflyException.php index 669dfed765..313ea77b7f 100644 --- a/app/Exceptions/FireflyException.php +++ b/app/Exceptions/FireflyException.php @@ -18,18 +18,13 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Exceptions; - /** - * Class FireflyException - * - * @package FireflyIII\Exceptions + * Class FireflyException. */ class FireflyException extends \Exception { - -} +} diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 47b7d3bfe7..02e1670b03 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - /** * Handler.php * Copyright (c) 2017 thegrumpydictator@gmail.com @@ -39,7 +37,6 @@ use FireflyIII\Jobs\MailError; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Request; - class Handler extends ExceptionHandler { /** @@ -59,21 +56,19 @@ class Handler extends ExceptionHandler */ protected $dontReport = [ - // ]; /** * Render an exception into an HTTP response. * - * @param \Illuminate\Http\Request $request - * @param \Exception $exception + * @param \Illuminate\Http\Request $request + * @param \Exception $exception * * @return \Illuminate\Http\Response */ public function render($request, Exception $exception) { if ($exception instanceof FireflyException || $exception instanceof ErrorException) { - $isDebug = env('APP_DEBUG', false); return response()->view('errors.FireflyException', ['exception' => $exception, 'debug' => $isDebug], 500); @@ -88,9 +83,10 @@ class Handler extends ExceptionHandler * This is a great spot to send exceptions to Sentry, Bugsnag, etc. * * @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five its fine. - * @param \Exception $exception * - * @return void + * @param \Exception $exception + * + * @return mixed|void */ public function report(Exception $exception) { @@ -121,7 +117,6 @@ class Handler extends ExceptionHandler dispatch($job); } - parent::report($exception); } } diff --git a/app/Exceptions/NotImplementedException.php b/app/Exceptions/NotImplementedException.php index 3052ecd9a4..f3fe68d8de 100644 --- a/app/Exceptions/NotImplementedException.php +++ b/app/Exceptions/NotImplementedException.php @@ -18,18 +18,13 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Exceptions; - /** - * Class NotImplementedException - * - * @package FireflyIII\Exceptions + * Class NotImplementedException. */ class NotImplementedException extends \Exception { - -} +} diff --git a/app/Exceptions/ValidationException.php b/app/Exceptions/ValidationException.php index 37b99b8cd0..dba608fa1a 100644 --- a/app/Exceptions/ValidationException.php +++ b/app/Exceptions/ValidationException.php @@ -18,17 +18,13 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Exceptions; /** - * Class ValidationExceptions - * - * @package FireflyIII\Exception + * Class ValidationExceptions. */ class ValidationException extends \Exception { - -} +} diff --git a/app/Export/Collector/AttachmentCollector.php b/app/Export/Collector/AttachmentCollector.php index b584e272e1..c3f76d2274 100644 --- a/app/Export/Collector/AttachmentCollector.php +++ b/app/Export/Collector/AttachmentCollector.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Export\Collector; @@ -33,19 +32,17 @@ use Log; use Storage; /** - * Class AttachmentCollector - * - * @package FireflyIII\Export\Collector + * Class AttachmentCollector. */ class AttachmentCollector extends BasicCollector implements CollectorInterface { - /** @var Carbon */ + /** @var Carbon */ private $end; /** @var \Illuminate\Contracts\Filesystem\Filesystem */ private $exportDisk; - /** @var AttachmentRepositoryInterface */ + /** @var AttachmentRepositoryInterface */ private $repository; - /** @var Carbon */ + /** @var Carbon */ private $start; /** @var \Illuminate\Contracts\Filesystem\Filesystem */ private $uploadDisk; @@ -55,7 +52,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface */ public function __construct() { - /** @var AttachmentRepositoryInterface repository */ + // @var AttachmentRepositoryInterface repository $this->repository = app(AttachmentRepositoryInterface::class); // make storage: $this->uploadDisk = Storage::disk('upload'); @@ -104,11 +101,9 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface $exportFile = $this->exportFileName($attachment); $this->exportDisk->put($exportFile, $decrypted); $this->getEntries()->push($exportFile); - } catch (DecryptException $e) { Log::error('Catchable error: could not decrypt attachment #' . $attachment->id . ' because: ' . $e->getMessage()); } - } return true; @@ -123,7 +118,6 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface */ private function exportFileName($attachment): string { - return sprintf('%s-Attachment nr. %s - %s', $this->job->key, strval($attachment->id), $attachment->filename); } diff --git a/app/Export/Collector/BasicCollector.php b/app/Export/Collector/BasicCollector.php index fee997d1f9..0aa688ae30 100644 --- a/app/Export/Collector/BasicCollector.php +++ b/app/Export/Collector/BasicCollector.php @@ -18,26 +18,22 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Export\Collector; - use FireflyIII\Models\ExportJob; use FireflyIII\User; use Illuminate\Support\Collection; /** - * Class BasicCollector - * - * @package FireflyIII\Export\Collector + * Class BasicCollector. */ class BasicCollector { /** @var ExportJob */ protected $job; - /** @var User */ + /** @var User */ protected $user; /** @var Collection */ private $entries; @@ -82,6 +78,4 @@ class BasicCollector { $this->user = $user; } - - } diff --git a/app/Export/Collector/CollectorInterface.php b/app/Export/Collector/CollectorInterface.php index 7df33bec46..362692f247 100644 --- a/app/Export/Collector/CollectorInterface.php +++ b/app/Export/Collector/CollectorInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Export\Collector; @@ -27,9 +26,7 @@ use FireflyIII\Models\ExportJob; use Illuminate\Support\Collection; /** - * Interface CollectorInterface - * - * @package FireflyIII\Export\Collector + * Interface CollectorInterface. */ interface CollectorInterface { @@ -45,9 +42,6 @@ interface CollectorInterface /** * @param Collection $entries - * - * @return void - * */ public function setEntries(Collection $entries); @@ -57,5 +51,4 @@ interface CollectorInterface * @return mixed */ public function setJob(ExportJob $job); - } diff --git a/app/Export/Collector/UploadCollector.php b/app/Export/Collector/UploadCollector.php index e4f68e780b..9bb5dd20fb 100644 --- a/app/Export/Collector/UploadCollector.php +++ b/app/Export/Collector/UploadCollector.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Export\Collector; @@ -30,9 +29,7 @@ use Log; use Storage; /** - * Class UploadCollector - * - * @package FireflyIII\Export\Collector + * Class UploadCollector. */ class UploadCollector extends BasicCollector implements CollectorInterface { @@ -94,7 +91,7 @@ class UploadCollector extends BasicCollector implements CollectorInterface { // find job associated with import file: $job = $this->job->user->importJobs()->where('key', $key)->first(); - if (is_null($job)) { + if (null === $job) { return false; } @@ -116,5 +113,4 @@ class UploadCollector extends BasicCollector implements CollectorInterface return true; } - } diff --git a/app/Export/Entry/Entry.php b/app/Export/Entry/Entry.php index bbbcf4a4a6..b9b73ac463 100644 --- a/app/Export/Entry/Entry.php +++ b/app/Export/Entry/Entry.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Export\Entry; @@ -27,7 +26,7 @@ use FireflyIII\Models\Transaction; /** * To extend the exported object, in case of new features in Firefly III for example, - * do the following: + * do the following:. * * - Add the field(s) to this class. If you add more than one related field, add a new object. * - Make sure the "fromJournal"-routine fills these fields. @@ -39,10 +38,9 @@ use FireflyIII\Models\Transaction; * * * Class Entry + * * @SuppressWarnings(PHPMD.LongVariable) * @SuppressWarnings(PHPMD.TooManyFields) - * - * @package FireflyIII\Export\Entry */ final class Entry { @@ -84,7 +82,10 @@ final class Entry public $bill_name; public $notes; + public $tags; + + // @formatter:on /** @@ -106,7 +107,7 @@ final class Entry */ public static function fromTransaction(Transaction $transaction): Entry { - $entry = new self; + $entry = new self(); $entry->journal_id = $transaction->journal_id; $entry->transaction_id = $transaction->id; $entry->date = $transaction->date->format('Ymd'); @@ -117,12 +118,13 @@ final class Entry $entry->currency_code = $transaction->transactionCurrency->code; $entry->amount = round($transaction->transaction_amount, $transaction->transactionCurrency->decimal_places); - $entry->foreign_currency_code = is_null($transaction->foreign_currency_id) ? null : $transaction->foreignCurrency->code; - $entry->foreign_amount = is_null($transaction->foreign_currency_id) + $entry->foreign_currency_code = null === $transaction->foreign_currency_id ? null : $transaction->foreignCurrency->code; + $entry->foreign_amount = null === $transaction->foreign_currency_id ? null : strval( round( - $transaction->transaction_foreign_amount, $transaction->foreignCurrency->decimal_places + $transaction->transaction_foreign_amount, + $transaction->foreignCurrency->decimal_places ) ); @@ -141,23 +143,23 @@ final class Entry $entry->opposing_account_bic = $transaction->opposing_account_bic; $entry->opposing_currency_code = $transaction->opposing_currency_code; - /** budget */ + // budget $entry->budget_id = $transaction->transaction_budget_id; $entry->budget_name = app('steam')->tryDecrypt($transaction->transaction_budget_name); - if (is_null($transaction->transaction_budget_id)) { + if (null === $transaction->transaction_budget_id) { $entry->budget_id = $transaction->transaction_journal_budget_id; $entry->budget_name = app('steam')->tryDecrypt($transaction->transaction_journal_budget_name); } - /** category */ + // category $entry->category_id = $transaction->transaction_category_id; $entry->category_name = app('steam')->tryDecrypt($transaction->transaction_category_name); - if (is_null($transaction->transaction_category_id)) { + if (null === $transaction->transaction_category_id) { $entry->category_id = $transaction->transaction_journal_category_id; $entry->category_name = app('steam')->tryDecrypt($transaction->transaction_journal_category_name); } - /** budget */ + // budget $entry->bill_id = $transaction->bill_id; $entry->bill_name = app('steam')->tryDecrypt($transaction->bill_name); @@ -166,6 +168,4 @@ final class Entry return $entry; } - - } diff --git a/app/Export/ExpandedProcessor.php b/app/Export/ExpandedProcessor.php index 9497b5b90f..11504e2267 100644 --- a/app/Export/ExpandedProcessor.php +++ b/app/Export/ExpandedProcessor.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Export; - use Crypt; use DB; use FireflyIII\Exceptions\FireflyException; @@ -43,32 +41,29 @@ use Storage; use ZipArchive; /** - * Class ExpandedProcessor + * Class ExpandedProcessor. * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) // its doing a lot. - * - * @package FireflyIII\Export */ class ExpandedProcessor implements ProcessorInterface { - /** @var Collection */ public $accounts; - /** @var string */ + /** @var string */ public $exportFormat; - /** @var bool */ + /** @var bool */ public $includeAttachments; - /** @var bool */ + /** @var bool */ public $includeOldUploads; - /** @var ExportJob */ + /** @var ExportJob */ public $job; /** @var array */ public $settings; - /** @var Collection */ + /** @var Collection */ private $exportEntries; - /** @var Collection */ + /** @var Collection */ private $files; - /** @var Collection */ + /** @var Collection */ private $journals; /** @@ -136,7 +131,6 @@ class ExpandedProcessor implements ProcessorInterface $transaction->opposing_account_number = $ibans[$opposingId]['accountNumber'] ?? ''; $transaction->opposing_account_bic = $ibans[$opposingId]['BIC'] ?? ''; $transaction->opposing_currency_code = $currencies[$opposingCurrencyId] ?? ''; - } ); @@ -177,6 +171,7 @@ class ExpandedProcessor implements ProcessorInterface /** * @return bool + * * @throws FireflyException */ public function createZipFile(): bool @@ -185,7 +180,7 @@ class ExpandedProcessor implements ProcessorInterface $file = $this->job->key . '.zip'; $fullPath = storage_path('export') . '/' . $file; - if ($zip->open($fullPath, ZipArchive::CREATE) !== true) { + if (true !== $zip->open($fullPath, ZipArchive::CREATE)) { throw new FireflyException('Cannot store zip file.'); } // for each file in the collection, add it to the zip file. @@ -280,7 +275,7 @@ class ExpandedProcessor implements ProcessorInterface } /** - * Get all IBAN / SWIFT / account numbers + * Get all IBAN / SWIFT / account numbers. * * @param array $array * diff --git a/app/Export/Exporter/BasicExporter.php b/app/Export/Exporter/BasicExporter.php index 131f9190c6..ece94d3703 100644 --- a/app/Export/Exporter/BasicExporter.php +++ b/app/Export/Exporter/BasicExporter.php @@ -18,23 +18,19 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Export\Exporter; - use FireflyIII\Models\ExportJob; use Illuminate\Support\Collection; /** - * Class BasicExporter - * - * @package FireflyIII\Export\Exporter + * Class BasicExporter. */ class BasicExporter { - /** @var ExportJob */ + /** @var ExportJob */ protected $job; /** @var Collection */ private $entries; @@ -70,6 +66,4 @@ class BasicExporter { $this->job = $job; } - - } diff --git a/app/Export/Exporter/CsvExporter.php b/app/Export/Exporter/CsvExporter.php index d9e337b0fc..2799f7902f 100644 --- a/app/Export/Exporter/CsvExporter.php +++ b/app/Export/Exporter/CsvExporter.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Export\Exporter; @@ -28,13 +27,11 @@ use League\Csv\Writer; use SplFileObject; /** - * Class CsvExporter - * - * @package FireflyIII\Export\Exporter + * Class CsvExporter. */ class CsvExporter extends BasicExporter implements ExporterInterface { - /** @var string */ + /** @var string */ private $fileName; /** @@ -69,7 +66,7 @@ class CsvExporter extends BasicExporter implements ExporterInterface // get field names for header row: $first = $this->getEntries()->first(); $headers = []; - if (!is_null($first)) { + if (null !== $first) { $headers = array_keys(get_object_vars($first)); } @@ -88,7 +85,6 @@ class CsvExporter extends BasicExporter implements ExporterInterface return true; } - private function tempFile() { $this->fileName = $this->job->key . '-records.csv'; diff --git a/app/Export/Exporter/ExporterInterface.php b/app/Export/Exporter/ExporterInterface.php index 4bd459e056..50790b3c92 100644 --- a/app/Export/Exporter/ExporterInterface.php +++ b/app/Export/Exporter/ExporterInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Export\Exporter; @@ -27,9 +26,7 @@ use FireflyIII\Models\ExportJob; use Illuminate\Support\Collection; /** - * Interface ExporterInterface - * - * @package FireflyIII\Export\Exporter + * Interface ExporterInterface. */ interface ExporterInterface { @@ -50,9 +47,6 @@ interface ExporterInterface /** * @param Collection $entries - * - * @return void - * */ public function setEntries(Collection $entries); @@ -60,5 +54,4 @@ interface ExporterInterface * @param ExportJob $job */ public function setJob(ExportJob $job); - } diff --git a/app/Export/ProcessorInterface.php b/app/Export/ProcessorInterface.php index 90dd471efa..3d24a91f1f 100644 --- a/app/Export/ProcessorInterface.php +++ b/app/Export/ProcessorInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Export; @@ -26,13 +25,10 @@ namespace FireflyIII\Export; use Illuminate\Support\Collection; /** - * Interface ProcessorInterface - * - * @package FireflyIII\Export + * Interface ProcessorInterface. */ interface ProcessorInterface { - /** * Processor constructor. */ diff --git a/app/Generator/Chart/Basic/ChartJsGenerator.php b/app/Generator/Chart/Basic/ChartJsGenerator.php index 75b1b4bd38..e366db9587 100644 --- a/app/Generator/Chart/Basic/ChartJsGenerator.php +++ b/app/Generator/Chart/Basic/ChartJsGenerator.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Chart\Basic; @@ -27,15 +26,12 @@ use FireflyIII\Support\ChartColour; use Steam; /** - * Class ChartJsGenerator - * - * @package FireflyIII\Generator\Chart\Basic + * Class ChartJsGenerator. */ class ChartJsGenerator implements GeneratorInterface { - /** - * Will generate a Chart JS compatible array from the given input. Expects this format + * Will generate a Chart JS compatible array from the given input. Expects this format. * * Will take labels for all from first set. * @@ -102,7 +98,7 @@ class ChartJsGenerator implements GeneratorInterface } /** - * Expects data as: + * Expects data as:. * * key => value * @@ -123,7 +119,7 @@ class ChartJsGenerator implements GeneratorInterface // different sort when values are positive and when they're negative. asort($data); $next = next($data); - if (!is_bool($next) && bccomp($next, '0') === 1) { + if (!is_bool($next) && 1 === bccomp($next, '0')) { // next is positive, sort other way around. arsort($data); } @@ -131,19 +127,18 @@ class ChartJsGenerator implements GeneratorInterface $index = 0; foreach ($data as $key => $value) { - // make larger than 0 $chartData['datasets'][0]['data'][] = floatval(Steam::positive($value)); $chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index); $chartData['labels'][] = $key; - $index++; + ++$index; } return $chartData; } /** - * Will generate a (ChartJS) compatible array from the given input. Expects this format: + * Will generate a (ChartJS) compatible array from the given input. Expects this format:. * * 'label-of-entry' => value * 'label-of-entry' => value diff --git a/app/Generator/Chart/Basic/GeneratorInterface.php b/app/Generator/Chart/Basic/GeneratorInterface.php index 99aa255035..68753e1276 100644 --- a/app/Generator/Chart/Basic/GeneratorInterface.php +++ b/app/Generator/Chart/Basic/GeneratorInterface.php @@ -18,21 +18,17 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Chart\Basic; /** - * Interface GeneratorInterface - * - * @package FireflyIII\Generator\Chart\Basic + * Interface GeneratorInterface. */ interface GeneratorInterface { - /** - * Will generate a Chart JS compatible array from the given input. Expects this format + * Will generate a Chart JS compatible array from the given input. Expects this format. * * Will take labels for all from first set. * @@ -66,7 +62,7 @@ interface GeneratorInterface public function multiSet(array $data): array; /** - * Expects data as: + * Expects data as:. * * key => value * @@ -77,7 +73,7 @@ interface GeneratorInterface public function pieChart(array $data): array; /** - * Will generate a (ChartJS) compatible array from the given input. Expects this format: + * Will generate a (ChartJS) compatible array from the given input. Expects this format:. * * 'label-of-entry' => value * 'label-of-entry' => value @@ -88,5 +84,4 @@ interface GeneratorInterface * @return array */ public function singleSet(string $setLabel, array $data): array; - } diff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.php index d3c20331d0..f944874ea4 100644 --- a/app/Generator/Report/Audit/MonthReportGenerator.php +++ b/app/Generator/Report/Audit/MonthReportGenerator.php @@ -18,33 +18,28 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report\Audit; - use Carbon\Carbon; use FireflyIII\Generator\Report\ReportGeneratorInterface; use FireflyIII\Helpers\Collector\JournalCollectorInterface; use FireflyIII\Models\Account; -use FireflyIII\Models\Transaction; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use Illuminate\Support\Collection; use Steam; /** - * Class MonthReportGenerator - * - * @package FireflyIII\Generator\Report\Audit + * Class MonthReportGenerator. */ class MonthReportGenerator implements ReportGeneratorInterface { - /** @var Collection */ + /** @var Collection */ private $accounts; - /** @var Carbon */ + /** @var Carbon */ private $end; - /** @var Carbon */ + /** @var Carbon */ private $start; /** @@ -52,8 +47,6 @@ class MonthReportGenerator implements ReportGeneratorInterface */ public function generate(): string { - - $auditData = []; $dayBefore = clone $this->start; $dayBefore->subDay(); @@ -77,11 +70,9 @@ class MonthReportGenerator implements ReportGeneratorInterface 'create_date', 'update_date', ]; - return view('reports.audit.report', compact('reportType', 'accountIds', 'auditData', 'hideable', 'defaultShow')) ->with('start', $this->start)->with('end', $this->end)->with('accounts', $this->accounts) ->render(); - } /** @@ -157,7 +148,6 @@ class MonthReportGenerator implements ReportGeneratorInterface * @return array * * @SuppressWarnings(PHPMD.ExcessiveMethodLength) // not that long - * */ private function getAuditReport(Account $account, Carbon $date): array { @@ -173,7 +163,7 @@ class MonthReportGenerator implements ReportGeneratorInterface $startBalance = $dayBeforeBalance; $currency = $currencyRepos->find(intval($account->getMeta('currency_id'))); - /** @var Transaction $journal */ + // @var Transaction $journal foreach ($journals as $transaction) { $transaction->before = $startBalance; $transactionAmount = $transaction->transaction_amount; diff --git a/app/Generator/Report/Audit/MultiYearReportGenerator.php b/app/Generator/Report/Audit/MultiYearReportGenerator.php index 54e61d51b7..93629d0c55 100644 --- a/app/Generator/Report/Audit/MultiYearReportGenerator.php +++ b/app/Generator/Report/Audit/MultiYearReportGenerator.php @@ -18,20 +18,14 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report\Audit; - /** - * Class MultiYearReportGenerator - * - * @package FireflyIII\Generator\Report\Audit + * Class MultiYearReportGenerator. */ class MultiYearReportGenerator extends MonthReportGenerator { - /** - * Doesn't do anything different. - */ + // Doesn't do anything different. } diff --git a/app/Generator/Report/Audit/YearReportGenerator.php b/app/Generator/Report/Audit/YearReportGenerator.php index 865970e427..2cd93c9b01 100644 --- a/app/Generator/Report/Audit/YearReportGenerator.php +++ b/app/Generator/Report/Audit/YearReportGenerator.php @@ -18,21 +18,14 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report\Audit; - /** - * Class YearReportGenerator - * - * @package FireflyIII\Generator\Report\Audit + * Class YearReportGenerator. */ class YearReportGenerator extends MonthReportGenerator { - - /** - * Doesn't do anything different. - */ + // Doesn't do anything different. } diff --git a/app/Generator/Report/Budget/MonthReportGenerator.php b/app/Generator/Report/Budget/MonthReportGenerator.php index bc93bc28e6..1295061e6b 100644 --- a/app/Generator/Report/Budget/MonthReportGenerator.php +++ b/app/Generator/Report/Budget/MonthReportGenerator.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report\Budget; - use Carbon\Carbon; use FireflyIII\Generator\Report\ReportGeneratorInterface; use FireflyIII\Generator\Report\Support; @@ -37,23 +35,21 @@ use Illuminate\Support\Collection; use Log; /** - * Class MonthReportGenerator - * - * @package FireflyIII\Generator\Report\Budget + * Class MonthReportGenerator. */ class MonthReportGenerator extends Support implements ReportGeneratorInterface { - /** @var Collection */ + /** @var Collection */ private $accounts; - /** @var Collection */ + /** @var Collection */ private $budgets; - /** @var Carbon */ + /** @var Carbon */ private $end; /** @var Collection */ private $expenses; /** @var Collection */ private $income; - /** @var Carbon */ + /** @var Carbon */ private $start; /** diff --git a/app/Generator/Report/Budget/MultiYearReportGenerator.php b/app/Generator/Report/Budget/MultiYearReportGenerator.php index 2185ee7ce6..956968075f 100644 --- a/app/Generator/Report/Budget/MultiYearReportGenerator.php +++ b/app/Generator/Report/Budget/MultiYearReportGenerator.php @@ -18,20 +18,14 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report\Budget; - /** - * Class MultiYearReportGenerator - * - * @package FireflyIII\Generator\Report\Budget + * Class MultiYearReportGenerator. */ class MultiYearReportGenerator extends MonthReportGenerator { - /** - * Doesn't do anything different. - */ + // Doesn't do anything different. } diff --git a/app/Generator/Report/Budget/YearReportGenerator.php b/app/Generator/Report/Budget/YearReportGenerator.php index 717c8b8371..649636f91b 100644 --- a/app/Generator/Report/Budget/YearReportGenerator.php +++ b/app/Generator/Report/Budget/YearReportGenerator.php @@ -18,21 +18,14 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report\Budget; - /** - * Class YearReportGenerator - * - * @package FireflyIII\Generator\Report\Budget + * Class YearReportGenerator. */ class YearReportGenerator extends MonthReportGenerator { - - /** - * Doesn't do anything different. - */ + // Doesn't do anything different. } diff --git a/app/Generator/Report/Category/MonthReportGenerator.php b/app/Generator/Report/Category/MonthReportGenerator.php index 68012445f7..24370c6be0 100644 --- a/app/Generator/Report/Category/MonthReportGenerator.php +++ b/app/Generator/Report/Category/MonthReportGenerator.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report\Category; - use Carbon\Carbon; use FireflyIII\Generator\Report\ReportGeneratorInterface; use FireflyIII\Generator\Report\Support; @@ -38,23 +36,21 @@ use Illuminate\Support\Collection; use Log; /** - * Class MonthReportGenerator - * - * @package FireflyIII\Generator\Report\Category + * Class MonthReportGenerator. */ class MonthReportGenerator extends Support implements ReportGeneratorInterface { - /** @var Collection */ + /** @var Collection */ private $accounts; - /** @var Collection */ + /** @var Collection */ private $categories; - /** @var Carbon */ + /** @var Carbon */ private $end; /** @var Collection */ private $expenses; /** @var Collection */ private $income; - /** @var Carbon */ + /** @var Carbon */ private $start; /** @@ -83,12 +79,19 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface $topExpenses = $this->getTopExpenses(); $topIncome = $this->getTopIncome(); - // render! return view( 'reports.category.month', compact( - 'accountIds', 'categoryIds', 'topIncome', 'reportType', 'accountSummary', 'categorySummary', 'averageExpenses', 'averageIncome', 'topExpenses' + 'accountIds', + 'categoryIds', + 'topIncome', + 'reportType', + 'accountSummary', + 'categorySummary', + 'averageExpenses', + 'averageIncome', + 'topExpenses' ) ) ->with('start', $this->start)->with('end', $this->end) diff --git a/app/Generator/Report/Category/MultiYearReportGenerator.php b/app/Generator/Report/Category/MultiYearReportGenerator.php index a986490ba1..d18dc47c0d 100644 --- a/app/Generator/Report/Category/MultiYearReportGenerator.php +++ b/app/Generator/Report/Category/MultiYearReportGenerator.php @@ -18,20 +18,14 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report\Category; - /** - * Class MultiYearReportGenerator - * - * @package FireflyIII\Generator\Report\Category + * Class MultiYearReportGenerator. */ class MultiYearReportGenerator extends MonthReportGenerator { - /** - * Doesn't do anything different. - */ + // Doesn't do anything different. } diff --git a/app/Generator/Report/Category/YearReportGenerator.php b/app/Generator/Report/Category/YearReportGenerator.php index 6b83a5dd76..7a3f15a484 100644 --- a/app/Generator/Report/Category/YearReportGenerator.php +++ b/app/Generator/Report/Category/YearReportGenerator.php @@ -18,21 +18,14 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report\Category; - /** - * Class YearReportGenerator - * - * @package FireflyIII\Generator\Report\Category + * Class YearReportGenerator. */ class YearReportGenerator extends MonthReportGenerator { - - /** - * Doesn't do anything different. - */ + // Doesn't do anything different. } diff --git a/app/Generator/Report/ReportGeneratorFactory.php b/app/Generator/Report/ReportGeneratorFactory.php index 0b96aee968..f6d7956a60 100644 --- a/app/Generator/Report/ReportGeneratorFactory.php +++ b/app/Generator/Report/ReportGeneratorFactory.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report; @@ -27,19 +26,17 @@ use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; /** - * Class ReportGeneratorFactory - * - * @package FireflyIII\Generator\Report + * Class ReportGeneratorFactory. */ class ReportGeneratorFactory { - /** * @param string $type * @param Carbon $start * @param Carbon $end * * @return ReportGeneratorInterface + * * @throws FireflyException */ public static function reportGenerator(string $type, Carbon $start, Carbon $end): ReportGeneratorInterface @@ -55,7 +52,6 @@ class ReportGeneratorFactory $period = 'MultiYear'; } - $class = sprintf('FireflyIII\Generator\Report\%s\%sReportGenerator', $type, $period); if (class_exists($class)) { /** @var ReportGeneratorInterface $obj */ diff --git a/app/Generator/Report/ReportGeneratorInterface.php b/app/Generator/Report/ReportGeneratorInterface.php index 7f6770e896..c3752b2739 100644 --- a/app/Generator/Report/ReportGeneratorInterface.php +++ b/app/Generator/Report/ReportGeneratorInterface.php @@ -18,19 +18,15 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report; - use Carbon\Carbon; use Illuminate\Support\Collection; /** - * Interface ReportGeneratorInterface - * - * @package FireflyIII\Generator\Report + * Interface ReportGeneratorInterface. */ interface ReportGeneratorInterface { @@ -80,5 +76,4 @@ interface ReportGeneratorInterface * @return ReportGeneratorInterface */ public function setTags(Collection $tags): ReportGeneratorInterface; - } diff --git a/app/Generator/Report/Standard/MonthReportGenerator.php b/app/Generator/Report/Standard/MonthReportGenerator.php index a9e5efd61e..74c005b0ab 100644 --- a/app/Generator/Report/Standard/MonthReportGenerator.php +++ b/app/Generator/Report/Standard/MonthReportGenerator.php @@ -18,29 +18,25 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report\Standard; - use Carbon\Carbon; use FireflyIII\Generator\Report\ReportGeneratorInterface; use FireflyIII\Helpers\Report\ReportHelperInterface; use Illuminate\Support\Collection; /** - * Class MonthReportGenerator - * - * @package FireflyIII\Generator\Report\Standard + * Class MonthReportGenerator. */ class MonthReportGenerator implements ReportGeneratorInterface { - /** @var Collection */ + /** @var Collection */ private $accounts; - /** @var Carbon */ + /** @var Carbon */ private $end; - /** @var Carbon */ + /** @var Carbon */ private $start; /** diff --git a/app/Generator/Report/Standard/MultiYearReportGenerator.php b/app/Generator/Report/Standard/MultiYearReportGenerator.php index 42c20c943b..7bc83c6dc7 100644 --- a/app/Generator/Report/Standard/MultiYearReportGenerator.php +++ b/app/Generator/Report/Standard/MultiYearReportGenerator.php @@ -18,28 +18,24 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report\Standard; - use Carbon\Carbon; use FireflyIII\Generator\Report\ReportGeneratorInterface; use Illuminate\Support\Collection; /** - * Class MonthReportGenerator - * - * @package FireflyIII\Generator\Report\Standard + * Class MonthReportGenerator. */ class MultiYearReportGenerator implements ReportGeneratorInterface { - /** @var Collection */ + /** @var Collection */ private $accounts; - /** @var Carbon */ + /** @var Carbon */ private $end; - /** @var Carbon */ + /** @var Carbon */ private $start; /** diff --git a/app/Generator/Report/Standard/YearReportGenerator.php b/app/Generator/Report/Standard/YearReportGenerator.php index c61e97168a..fc591c0e97 100644 --- a/app/Generator/Report/Standard/YearReportGenerator.php +++ b/app/Generator/Report/Standard/YearReportGenerator.php @@ -18,28 +18,24 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report\Standard; - use Carbon\Carbon; use FireflyIII\Generator\Report\ReportGeneratorInterface; use Illuminate\Support\Collection; /** - * Class MonthReportGenerator - * - * @package FireflyIII\Generator\Report\Standard + * Class MonthReportGenerator. */ class YearReportGenerator implements ReportGeneratorInterface { - /** @var Collection */ + /** @var Collection */ private $accounts; - /** @var Carbon */ + /** @var Carbon */ private $end; - /** @var Carbon */ + /** @var Carbon */ private $start; /** diff --git a/app/Generator/Report/Support.php b/app/Generator/Report/Support.php index f2aec9c1c5..71cc298307 100644 --- a/app/Generator/Report/Support.php +++ b/app/Generator/Report/Support.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report; @@ -26,11 +25,8 @@ namespace FireflyIII\Generator\Report; use FireflyIII\Models\Transaction; use Illuminate\Support\Collection; - /** - * Class Support - * - * @package FireflyIII\Generator\Report\Category + * Class Support. */ class Support { @@ -80,7 +76,7 @@ class Support ]; continue; } - $result[$opposingId]['count']++; + ++$result[$opposingId]['count']; $result[$opposingId]['sum'] = bcadd($result[$opposingId]['sum'], $transaction->transaction_amount); $result[$opposingId]['average'] = bcdiv($result[$opposingId]['sum'], strval($result[$opposingId]['count'])); } @@ -98,6 +94,7 @@ class Support /** * @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly five. + * * @param array $spent * @param array $earned * @@ -108,7 +105,7 @@ class Support $return = []; /** - * @var int $accountId + * @var int * @var string $entry */ foreach ($spent as $objectId => $entry) { @@ -121,7 +118,7 @@ class Support unset($entry); /** - * @var int $accountId + * @var int * @var string $entry */ foreach ($earned as $objectId => $entry) { @@ -132,7 +129,6 @@ class Support $return[$objectId]['earned'] = $entry; } - return $return; } @@ -153,5 +149,4 @@ class Support return $result; } - } diff --git a/app/Generator/Report/Tag/MonthReportGenerator.php b/app/Generator/Report/Tag/MonthReportGenerator.php index aa13b1897d..418b05dd16 100644 --- a/app/Generator/Report/Tag/MonthReportGenerator.php +++ b/app/Generator/Report/Tag/MonthReportGenerator.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report\Tag; - use Carbon\Carbon; use FireflyIII\Generator\Report\ReportGeneratorInterface; use FireflyIII\Generator\Report\Support; @@ -39,22 +37,19 @@ use Illuminate\Support\Collection; use Log; /** - * Class MonthReportGenerator - * - * @package FireflyIII\Generator\Report\Tag + * Class MonthReportGenerator. */ class MonthReportGenerator extends Support implements ReportGeneratorInterface { - /** @var Collection */ private $accounts; - /** @var Carbon */ + /** @var Carbon */ private $end; /** @var Collection */ private $expenses; /** @var Collection */ private $income; - /** @var Carbon */ + /** @var Carbon */ private $start; /** @var Collection */ private $tags; @@ -85,13 +80,20 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface $topExpenses = $this->getTopExpenses(); $topIncome = $this->getTopIncome(); - // render! return view( - 'reports.tag.month', compact( - 'accountIds', 'tagTags', 'reportType', 'accountSummary', 'tagSummary', 'averageExpenses', 'averageIncome', 'topIncome', - 'topExpenses' - ) + 'reports.tag.month', + compact( + 'accountIds', + 'tagTags', + 'reportType', + 'accountSummary', + 'tagSummary', + 'averageExpenses', + 'averageIncome', + 'topIncome', + 'topExpenses' + ) )->with('start', $this->start)->with('end', $this->end)->with('tags', $this->tags)->with('accounts', $this->accounts)->render(); } diff --git a/app/Generator/Report/Tag/MultiYearReportGenerator.php b/app/Generator/Report/Tag/MultiYearReportGenerator.php index fc57ea6545..7687cf9d0e 100644 --- a/app/Generator/Report/Tag/MultiYearReportGenerator.php +++ b/app/Generator/Report/Tag/MultiYearReportGenerator.php @@ -18,20 +18,14 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report\Tag; - /** - * Class MultiYearReportGenerator - * - * @package FireflyIII\Generator\Report\Tag + * Class MultiYearReportGenerator. */ class MultiYearReportGenerator extends MonthReportGenerator { - /** - * Doesn't do anything different. - */ + // Doesn't do anything different. } diff --git a/app/Generator/Report/Tag/YearReportGenerator.php b/app/Generator/Report/Tag/YearReportGenerator.php index 46a9835694..2e72c8d252 100644 --- a/app/Generator/Report/Tag/YearReportGenerator.php +++ b/app/Generator/Report/Tag/YearReportGenerator.php @@ -18,21 +18,14 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Generator\Report\Tag; - /** - * Class YearReportGenerator - * - * @package FireflyIII\Generator\Report\Tag + * Class YearReportGenerator. */ class YearReportGenerator extends MonthReportGenerator { - - /** - * Doesn't do anything different. - */ + // Doesn't do anything different. } diff --git a/app/Handlers/Events/AdminEventHandler.php b/app/Handlers/Events/AdminEventHandler.php index 6561a9ce05..79e1cbeb40 100644 --- a/app/Handlers/Events/AdminEventHandler.php +++ b/app/Handlers/Events/AdminEventHandler.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Handlers\Events; @@ -31,20 +30,19 @@ use Session; use Swift_TransportException; /** - * Class AdminEventHandler - * - * @package FireflyIII\Handlers\Events + * Class AdminEventHandler. */ class AdminEventHandler { /** + * Sends a test message to an administrator. + * * @param AdminRequestedTestMessage $event * * @return bool */ public function sendTestMessage(AdminRequestedTestMessage $event): bool { - $email = $event->user->email; $ipAddress = $event->ipAddress; @@ -64,4 +62,4 @@ class AdminEventHandler // @codeCoverageIgnoreEnd return true; } -} \ No newline at end of file +} diff --git a/app/Handlers/Events/StoredJournalEventHandler.php b/app/Handlers/Events/StoredJournalEventHandler.php index c8ec8c84c2..e02146f253 100644 --- a/app/Handlers/Events/StoredJournalEventHandler.php +++ b/app/Handlers/Events/StoredJournalEventHandler.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Handlers\Events; @@ -37,17 +36,15 @@ use Log; * @codeCoverageIgnore * * Class StoredJournalEventHandler - * - * @package FireflyIII\Handlers\Events */ class StoredJournalEventHandler { - /** @var JRI */ + /** @var JRI */ public $journalRepository; - /** @var PRI */ + /** @var PRI */ public $repository; - /** @var RGRI */ + /** @var RGRI */ public $ruleGroupRepository; /** @@ -88,7 +85,7 @@ class StoredJournalEventHandler } // piggy exists? - if (is_null($piggyBank->id)) { + if (null === $piggyBank->id) { Log::error(sprintf('There is no piggy bank with ID #%d', $piggyBankId)); return true; @@ -96,7 +93,7 @@ class StoredJournalEventHandler // repetition exists? $repetition = $this->repository->getRepetition($piggyBank, $journal->date); - if (is_null($repetition->id)) { + if (null === $repetition->id) { Log::error(sprintf('No piggy bank repetition on %s!', $journal->date->format('Y-m-d'))); return true; @@ -104,7 +101,7 @@ class StoredJournalEventHandler // get the amount $amount = $this->repository->getExactAmount($piggyBank, $repetition, $journal); - if (bccomp($amount, '0') === 0) { + if (0 === bccomp($amount, '0')) { Log::debug('Amount is zero, will not create event.'); return true; @@ -137,7 +134,6 @@ class StoredJournalEventHandler $rules = $this->ruleGroupRepository->getActiveStoreRules($group); /** @var Rule $rule */ foreach ($rules as $rule) { - $processor = Processor::make($rule); $processor->handleTransactionJournal($journal); diff --git a/app/Handlers/Events/UpdatedJournalEventHandler.php b/app/Handlers/Events/UpdatedJournalEventHandler.php index 775ad01e7a..13f2af4b01 100644 --- a/app/Handlers/Events/UpdatedJournalEventHandler.php +++ b/app/Handlers/Events/UpdatedJournalEventHandler.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Handlers\Events; - use FireflyIII\Events\UpdatedTransactionJournal; use FireflyIII\Models\Rule; use FireflyIII\Models\RuleGroup; @@ -35,12 +33,10 @@ use FireflyIII\TransactionRules\Processor; * @codeCoverageIgnore * * Class UpdatedJournalEventHandler - * - * @package FireflyIII\Handlers\Events */ class UpdatedJournalEventHandler { - /** @var RuleGroupRepositoryInterface */ + /** @var RuleGroupRepositoryInterface */ public $repository; /** @@ -77,7 +73,6 @@ class UpdatedJournalEventHandler if ($rule->stop_processing) { break; } - } } diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php index f110737aef..d1c2186811 100644 --- a/app/Handlers/Events/UserEventHandler.php +++ b/app/Handlers/Events/UserEventHandler.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Handlers\Events; @@ -37,17 +36,14 @@ use Preferences; use Swift_TransportException; /** - * Class UserEventHandler + * Class UserEventHandler. * * This class responds to any events that have anything to do with the User object. * * The method name reflects what is being done. This is in the present tense. - * - * @package FireflyIII\Handlers\Events */ class UserEventHandler { - /** * This method will bestow upon a user the "owner" role if he is the first user in the system. * @@ -61,7 +57,7 @@ class UserEventHandler $repository = app(UserRepositoryInterface::class); // first user ever? - if ($repository->count() === 1) { + if (1 === $repository->count()) { $repository->attachRole($event->user, 'owner'); } @@ -152,7 +148,6 @@ class UserEventHandler */ public function sendRegistrationMail(RegisteredUser $event) { - $sendMail = env('SEND_REGISTRATION_MAIL', true); if (!$sendMail) { return true; // @codeCoverageIgnore diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php index aab22e613f..e71ea6fde3 100644 --- a/app/Helpers/Attachments/AttachmentHelper.php +++ b/app/Helpers/Attachments/AttachmentHelper.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Attachments; @@ -33,14 +32,11 @@ use Storage; use Symfony\Component\HttpFoundation\File\UploadedFile; /** - * Class AttachmentHelper - * - * @package FireflyIII\Helpers\Attachments + * Class AttachmentHelper. */ class AttachmentHelper implements AttachmentHelperInterface { - - /** @var Collection */ + /** @var Collection */ public $attachments; /** @var MessageBag */ public $errors; @@ -111,10 +107,12 @@ class AttachmentHelper implements AttachmentHelperInterface */ public function saveAttachmentsForModel(Model $model, ?array $files): bool { + Log::debug(sprintf('Now in saveAttachmentsForModel for model %s', get_class($model))); if (is_array($files)) { + Log::debug('$files is an array.'); /** @var UploadedFile $entry */ foreach ($files as $entry) { - if (!is_null($entry)) { + if (null !== $entry) { $this->processFile($entry, $model); } } @@ -152,7 +150,6 @@ class AttachmentHelper implements AttachmentHelperInterface } /** - * * @param UploadedFile $file * @param Model $model * @@ -160,8 +157,9 @@ class AttachmentHelper implements AttachmentHelperInterface */ protected function processFile(UploadedFile $file, Model $model): Attachment { + Log::debug('Now in processFile()'); $validation = $this->validateUpload($file, $model); - if ($validation === false) { + if (false === $validation) { return new Attachment; } @@ -204,8 +202,11 @@ class AttachmentHelper implements AttachmentHelperInterface */ protected function validMime(UploadedFile $file): bool { + Log::debug('Now in validMime()'); $mime = e($file->getMimeType()); $name = e($file->getClientOriginalName()); + Log::debug(sprintf('Name is %, and mime is %s', $name, $mime)); + Log::debug('Valid mimes are', $this->allowedMimes); if (!in_array($mime, $this->allowedMimes)) { $msg = (string)trans('validation.file_invalid_mime', ['name' => $name, 'mime' => $mime]); @@ -248,6 +249,7 @@ class AttachmentHelper implements AttachmentHelperInterface */ protected function validateUpload(UploadedFile $file, Model $model): bool { + Log::debug('Now in validateUpload()'); if (!$this->validMime($file)) { return false; } diff --git a/app/Helpers/Attachments/AttachmentHelperInterface.php b/app/Helpers/Attachments/AttachmentHelperInterface.php index d439845694..e292b29539 100644 --- a/app/Helpers/Attachments/AttachmentHelperInterface.php +++ b/app/Helpers/Attachments/AttachmentHelperInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Attachments; @@ -29,13 +28,10 @@ use Illuminate\Support\Collection; use Illuminate\Support\MessageBag; /** - * Interface AttachmentHelperInterface - * - * @package FireflyIII\Helpers\Attachments + * Interface AttachmentHelperInterface. */ interface AttachmentHelperInterface { - /** * @param Attachment $attachment * @@ -60,11 +56,9 @@ interface AttachmentHelperInterface /** * @param Model $model - * * @param null|array $files * * @return bool */ public function saveAttachmentsForModel(Model $model, ?array $files): bool; - } diff --git a/app/Helpers/Chart/MetaPieChart.php b/app/Helpers/Chart/MetaPieChart.php index d2ed458bd3..65d11c52d4 100644 --- a/app/Helpers/Chart/MetaPieChart.php +++ b/app/Helpers/Chart/MetaPieChart.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Chart; @@ -41,23 +40,19 @@ use Illuminate\Support\Collection; use Steam; /** - * Class MetaPieChart - * - * @package FireflyIII\Helpers\Chart - * - * + * Class MetaPieChart. */ class MetaPieChart implements MetaPieChartInterface { - /** @var Collection */ + /** @var Collection */ protected $accounts; - /** @var Collection */ + /** @var Collection */ protected $budgets; - /** @var Collection */ + /** @var Collection */ protected $categories; /** @var bool */ protected $collectOtherObjects = false; - /** @var Carbon */ + /** @var Carbon */ protected $end; /** @var array */ protected $grouping @@ -75,13 +70,13 @@ class MetaPieChart implements MetaPieChartInterface 'category' => CategoryRepositoryInterface::class, 'tag' => TagRepositoryInterface::class, ]; - /** @var Carbon */ + /** @var Carbon */ protected $start; - /** @var Collection */ + /** @var Collection */ protected $tags; - /** @var string */ + /** @var string */ protected $total = '0'; - /** @var User */ + /** @var User */ protected $user; public function __construct() @@ -108,7 +103,7 @@ class MetaPieChart implements MetaPieChartInterface $key = strval(trans('firefly.everything_else')); // also collect all other transactions - if ($this->collectOtherObjects && $direction === 'expense') { + if ($this->collectOtherObjects && 'expense' === $direction) { /** @var JournalCollectorInterface $collector */ $collector = app(JournalCollectorInterface::class); $collector->setUser($this->user); @@ -121,7 +116,7 @@ class MetaPieChart implements MetaPieChartInterface $chartData[$key] = $sum; } - if ($this->collectOtherObjects && $direction === 'income') { + if ($this->collectOtherObjects && 'income' === $direction) { /** @var JournalCollectorInterface $collector */ $collector = app(JournalCollectorInterface::class); $collector->setUser($this->user); @@ -133,7 +128,6 @@ class MetaPieChart implements MetaPieChartInterface } return $chartData; - } /** @@ -259,7 +253,7 @@ class MetaPieChart implements MetaPieChartInterface $collector = app(JournalCollectorInterface::class); $types = [TransactionType::DEPOSIT, TransactionType::TRANSFER]; $collector->addFilter(NegativeAmountFilter::class); - if ($direction === 'expense') { + if ('expense' === $direction) { $types = [TransactionType::WITHDRAWAL, TransactionType::TRANSFER]; $collector->addFilter(PositiveAmountFilter::class); $collector->removeFilter(NegativeAmountFilter::class); @@ -272,7 +266,7 @@ class MetaPieChart implements MetaPieChartInterface $collector->withOpposingAccount(); $collector->addFilter(OpposingAccountFilter::class); - if ($direction === 'income') { + if ('income' === $direction) { $collector->removeFilter(TransferFilter::class); } @@ -295,11 +289,10 @@ class MetaPieChart implements MetaPieChartInterface * @return array * * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * */ protected function groupByFields(Collection $set, array $fields): array { - if (count($fields) === 0 && $this->tags->count() > 0) { + if (0 === count($fields) && $this->tags->count() > 0) { // do a special group on tags: return $this->groupByTag($set); } @@ -342,7 +335,6 @@ class MetaPieChart implements MetaPieChartInterface } return $chartData; - } /** diff --git a/app/Helpers/Chart/MetaPieChartInterface.php b/app/Helpers/Chart/MetaPieChartInterface.php index 0aede8b59f..ee094a2e83 100644 --- a/app/Helpers/Chart/MetaPieChartInterface.php +++ b/app/Helpers/Chart/MetaPieChartInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Chart; @@ -28,9 +27,7 @@ use FireflyIII\User; use Illuminate\Support\Collection; /** - * Interface MetaPieChartInterface - * - * @package FireflyIII\Helpers\Chart + * Interface MetaPieChartInterface. */ interface MetaPieChartInterface { @@ -97,5 +94,4 @@ interface MetaPieChartInterface * @return MetaPieChartInterface */ public function setUser(User $user): MetaPieChartInterface; - } diff --git a/app/Helpers/Collection/Balance.php b/app/Helpers/Collection/Balance.php index 63a4ffa878..b1ecf5c206 100644 --- a/app/Helpers/Collection/Balance.php +++ b/app/Helpers/Collection/Balance.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Collection; @@ -26,18 +25,14 @@ namespace FireflyIII\Helpers\Collection; use Illuminate\Support\Collection; /** - * - * Class Balance - * - * @package FireflyIII\Helpers\Collection + * Class Balance. */ class Balance { - - /** @var BalanceHeader */ + /** @var BalanceHeader */ protected $balanceHeader; - /** @var Collection */ + /** @var Collection */ protected $balanceLines; /** @@ -87,6 +82,4 @@ class Balance { $this->balanceLines = $balanceLines; } - - } diff --git a/app/Helpers/Collection/BalanceEntry.php b/app/Helpers/Collection/BalanceEntry.php index a601c2571e..5037b3d421 100644 --- a/app/Helpers/Collection/BalanceEntry.php +++ b/app/Helpers/Collection/BalanceEntry.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Collection; @@ -26,16 +25,11 @@ namespace FireflyIII\Helpers\Collection; use FireflyIII\Models\Account as AccountModel; /** - * - * Class BalanceEntry - * - * @package FireflyIII\Helpers\Collection + * Class BalanceEntry. */ class BalanceEntry { - - - /** @var AccountModel */ + /** @var AccountModel */ protected $account; /** @var string */ protected $left = '0'; @@ -89,6 +83,4 @@ class BalanceEntry { $this->spent = $spent; } - - } diff --git a/app/Helpers/Collection/BalanceHeader.php b/app/Helpers/Collection/BalanceHeader.php index 5908343073..84d9844b89 100644 --- a/app/Helpers/Collection/BalanceHeader.php +++ b/app/Helpers/Collection/BalanceHeader.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Collection; @@ -27,15 +26,11 @@ use FireflyIII\Models\Account as AccountModel; use Illuminate\Support\Collection; /** - * - * Class BalanceHeader - * - * @package FireflyIII\Helpers\Collection + * Class BalanceHeader. */ class BalanceHeader { - - /** @var Collection */ + /** @var Collection */ protected $accounts; /** @@ -61,6 +56,4 @@ class BalanceHeader { return $this->accounts; } - - } diff --git a/app/Helpers/Collection/BalanceLine.php b/app/Helpers/Collection/BalanceLine.php index f5c456056a..2f8f8f729f 100644 --- a/app/Helpers/Collection/BalanceLine.php +++ b/app/Helpers/Collection/BalanceLine.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Collection; @@ -29,24 +28,20 @@ use FireflyIII\Models\BudgetLimit; use Illuminate\Support\Collection; /** - * - * Class BalanceLine - * - * @package FireflyIII\Helpers\Collection + * Class BalanceLine. */ class BalanceLine { - const ROLE_DEFAULTROLE = 1; const ROLE_TAGROLE = 2; const ROLE_DIFFROLE = 3; - /** @var Collection */ + /** @var Collection */ protected $balanceEntries; /** @var BudgetModel */ protected $budget; - /** @var BudgetLimit */ + /** @var BudgetLimit */ protected $budgetLimit; /** @var int */ protected $role = self::ROLE_DEFAULTROLE; @@ -57,7 +52,6 @@ class BalanceLine public function __construct() { $this->balanceEntries = new Collection; - } /** @@ -150,20 +144,21 @@ class BalanceLine /** * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * * @return string */ public function getTitle(): string { - if ($this->getBudget() instanceof BudgetModel && !is_null($this->getBudget()->id)) { + if ($this->getBudget() instanceof BudgetModel && null !== $this->getBudget()->id) { return $this->getBudget()->name; } - if ($this->getRole() === self::ROLE_DEFAULTROLE) { + if (self::ROLE_DEFAULTROLE === $this->getRole()) { return strval(trans('firefly.no_budget')); } - if ($this->getRole() === self::ROLE_TAGROLE) { + if (self::ROLE_TAGROLE === $this->getRole()) { return strval(trans('firefly.coveredWithTags')); } - if ($this->getRole() === self::ROLE_DIFFROLE) { + if (self::ROLE_DIFFROLE === $this->getRole()) { return strval(trans('firefly.leftUnbalanced')); } @@ -174,7 +169,7 @@ class BalanceLine * 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: + * total amount, this is returned:. * * @return string */ diff --git a/app/Helpers/Collection/Bill.php b/app/Helpers/Collection/Bill.php index de8eff5c2f..16a4730863 100644 --- a/app/Helpers/Collection/Bill.php +++ b/app/Helpers/Collection/Bill.php @@ -18,32 +18,27 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Collection; - use Carbon\Carbon; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use Illuminate\Support\Collection; use Log; /** - * Class Bill - * - * @package FireflyIII\Helpers\Collection + * Class Bill. */ class Bill { - /** * @var Collection */ private $bills; - /** @var Carbon */ + /** @var Carbon */ private $endDate; - /** @var Carbon */ + /** @var Carbon */ private $startDate; /** @@ -106,14 +101,13 @@ class Bill { $set = $this->bills->sortBy( function (BillLine $bill) { - $active = intval($bill->getBill()->active) === 0 ? 1 : 0; + $active = 0 === intval($bill->getBill()->active) ? 1 : 0; $name = $bill->getBill()->name; return $active . $name; } ); - return $set; } @@ -132,5 +126,4 @@ class Bill { $this->startDate = $startDate; } - } diff --git a/app/Helpers/Collection/BillLine.php b/app/Helpers/Collection/BillLine.php index 9359d2db1c..ed5dde7fe7 100644 --- a/app/Helpers/Collection/BillLine.php +++ b/app/Helpers/Collection/BillLine.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Collection; @@ -27,27 +26,23 @@ use Carbon\Carbon; use FireflyIII\Models\Bill as BillModel; /** - * - * Class BillLine - * - * @package FireflyIII\Helpers\Collection + * Class BillLine. */ class BillLine { - - /** @var string */ + /** @var string */ protected $amount; - /** @var BillModel */ + /** @var BillModel */ protected $bill; - /** @var bool */ + /** @var bool */ protected $hit; - /** @var string */ + /** @var string */ protected $max; - /** @var string */ + /** @var string */ protected $min; - /** @var Carbon */ + /** @var Carbon */ private $lastHitDate; - /** @var int */ + /** @var int */ private $transactionJournalId; /** @@ -159,7 +154,7 @@ class BillLine */ public function isActive(): bool { - return intval($this->bill->active) === 1; + return 1 === intval($this->bill->active); } /** @@ -177,6 +172,4 @@ class BillLine { $this->hit = $hit; } - - } diff --git a/app/Helpers/Collection/Category.php b/app/Helpers/Collection/Category.php index c9e551cf32..60bd436add 100644 --- a/app/Helpers/Collection/Category.php +++ b/app/Helpers/Collection/Category.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Collection; @@ -26,17 +25,12 @@ namespace FireflyIII\Helpers\Collection; use FireflyIII\Models\Category as CategoryModel; use Illuminate\Support\Collection; - /** - * - * Class Category - * - * @package FireflyIII\Helpers\Collection + * Class Category. */ class Category { - - /** @var Collection */ + /** @var Collection */ protected $categories; /** @var string */ protected $total = '0'; @@ -80,7 +74,6 @@ class Category } ); - return $set; } @@ -91,6 +84,4 @@ class Category { return $this->total; } - - } diff --git a/app/Helpers/Collector/JournalCollector.php b/app/Helpers/Collector/JournalCollector.php index a228f15ec0..33621ad862 100644 --- a/app/Helpers/Collector/JournalCollector.php +++ b/app/Helpers/Collector/JournalCollector.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Collector; - use Carbon\Carbon; use DB; use FireflyIII\Exceptions\FireflyException; @@ -52,17 +50,16 @@ use Steam; * * Class JournalCollector * - * @package FireflyIII\Helpers\Collector * * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.TooManyPublicMethods) */ class JournalCollector implements JournalCollectorInterface { - /** @var array */ private $accountIds = []; - /** @var int */ + /** @var int */ private $count = 0; /** @var array */ private $fields @@ -73,12 +70,14 @@ class JournalCollector implements JournalCollectorInterface 'transaction_journals.encrypted', 'transaction_types.type as transaction_type_type', 'transaction_journals.bill_id', + 'transaction_journals.updated_at', 'bills.name as bill_name', 'bills.name_encrypted as bill_name_encrypted', 'transactions.id as id', 'transactions.description as transaction_description', 'transactions.account_id', + 'transactions.reconciled', 'transactions.identifier', 'transactions.transaction_journal_id', 'transactions.amount as transaction_amount', @@ -99,22 +98,21 @@ class JournalCollector implements JournalCollectorInterface 'accounts.encrypted as account_encrypted', 'accounts.iban as account_iban', 'account_types.type as account_type', - ]; /** @var array */ private $filters = [InternalTransferFilter::class]; - /** @var bool */ + /** @var bool */ private $joinedBudget = false; - /** @var bool */ + /** @var bool */ private $joinedCategory = false; /** @var bool */ private $joinedOpposing = false; /** @var bool */ private $joinedTag = false; - /** @var int */ + /** @var int */ private $limit; - /** @var int */ + /** @var int */ private $offset; /** @var int */ private $page = 1; @@ -170,8 +168,8 @@ class JournalCollector implements JournalCollectorInterface $q1->where( function (EloquentBuilder $q2) use ($amount) { // amount < 0 and .amount > -$amount - $amount = bcmul($amount,'-1'); - $q2->where('transactions.amount', '<', 0)->where('transactions.amount', '>', $amount); + $invertedAmount = bcmul($amount, '-1'); + $q2->where('transactions.amount', '<', 0)->where('transactions.amount', '>', $invertedAmount); } ) ->orWhere( @@ -198,8 +196,8 @@ class JournalCollector implements JournalCollectorInterface $q1->where( function (EloquentBuilder $q2) use ($amount) { // amount < 0 and .amount < -$amount - $amount = bcmul($amount,'-1'); - $q2->where('transactions.amount', '<', 0)->where('transactions.amount', '<', $amount); + $invertedAmount = bcmul($amount, '-1'); + $q2->where('transactions.amount', '<', 0)->where('transactions.amount', '<', $invertedAmount); } ) ->orWhere( @@ -210,16 +208,18 @@ class JournalCollector implements JournalCollectorInterface ); } ); + return $this; } /** * @return int + * * @throws FireflyException */ public function count(): int { - if ($this->run === true) { + if (true === $this->run) { throw new FireflyException('Cannot count after run in JournalCollector.'); } @@ -255,14 +255,12 @@ class JournalCollector implements JournalCollectorInterface $transaction->date = new Carbon($transaction->date); $transaction->description = Steam::decrypt(intval($transaction->encrypted), $transaction->description); - if (!is_null($transaction->bill_name)) { + if (null !== $transaction->bill_name) { $transaction->bill_name = Steam::decrypt(intval($transaction->bill_name_encrypted), $transaction->bill_name); } $transaction->opposing_account_name = app('steam')->tryDecrypt($transaction->opposing_account_name); $transaction->account_iban = app('steam')->tryDecrypt($transaction->account_iban); $transaction->opposing_account_iban = app('steam')->tryDecrypt($transaction->opposing_account_iban); - - } ); @@ -271,11 +269,12 @@ class JournalCollector implements JournalCollectorInterface /** * @return LengthAwarePaginator + * * @throws FireflyException */ public function getPaginatedJournals(): LengthAwarePaginator { - if ($this->run === true) { + if (true === $this->run) { throw new FireflyException('Cannot getPaginatedJournals after run in JournalCollector.'); } $this->count(); @@ -293,7 +292,7 @@ class JournalCollector implements JournalCollectorInterface public function removeFilter(string $filter): JournalCollectorInterface { $key = array_search($filter, $this->filters, true); - if (!($key === false)) { + if (!(false === $key)) { Log::debug(sprintf('Removed filter %s', $filter)); unset($this->filters[$key]); } @@ -319,7 +318,6 @@ class JournalCollector implements JournalCollectorInterface $this->addFilter(TransferFilter::class); } - return $this; } @@ -386,7 +384,6 @@ class JournalCollector implements JournalCollectorInterface } return $this; - } /** @@ -416,7 +413,7 @@ class JournalCollector implements JournalCollectorInterface public function setBudgets(Collection $budgets): JournalCollectorInterface { $budgetIds = $budgets->pluck('id')->toArray(); - if (count($budgetIds) === 0) { + if (0 === count($budgetIds)) { return $this; } $this->joinBudgetTables(); @@ -440,7 +437,7 @@ class JournalCollector implements JournalCollectorInterface public function setCategories(Collection $categories): JournalCollectorInterface { $categoryIds = $categories->pluck('id')->toArray(); - if (count($categoryIds) === 0) { + if (0 === count($categoryIds)) { return $this; } $this->joinCategoryTables(); @@ -514,11 +511,11 @@ class JournalCollector implements JournalCollectorInterface $this->page = $page; if ($page > 0) { - $page--; + --$page; } Log::debug(sprintf('Page is %d', $page)); - if (!is_null($this->limit)) { + if (null !== $this->limit) { $offset = ($this->limit * $page); $this->offset = $offset; $this->query->skip($offset); @@ -626,7 +623,6 @@ class JournalCollector implements JournalCollectorInterface ->orderBy('transactions.amount', 'DESC'); $this->query = $query; - } /** @@ -644,7 +640,6 @@ class JournalCollector implements JournalCollectorInterface */ public function withCategoryInformation(): JournalCollectorInterface { - $this->joinCategoryTables(); return $this; @@ -756,7 +751,10 @@ class JournalCollector implements JournalCollectorInterface $this->joinedCategory = true; $this->query->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id'); $this->query->leftJoin( - 'categories as transaction_journal_categories', 'transaction_journal_categories.id', '=', 'category_transaction_journal.category_id' + 'categories as transaction_journal_categories', + 'transaction_journal_categories.id', + '=', + 'category_transaction_journal.category_id' ); $this->query->leftJoin('category_transaction', 'category_transaction.transaction_id', '=', 'transactions.id'); @@ -781,11 +779,12 @@ class JournalCollector implements JournalCollectorInterface Log::debug('joinedOpposing is false'); // join opposing transaction (hard): $this->query->leftJoin( - 'transactions as opposing', function (JoinClause $join) { - $join->on('opposing.transaction_journal_id', '=', 'transactions.transaction_journal_id') - ->where('opposing.identifier', '=', DB::raw('transactions.identifier')) - ->where('opposing.amount', '=', DB::raw('transactions.amount * -1')); - } + 'transactions as opposing', + function (JoinClause $join) { + $join->on('opposing.transaction_journal_id', '=', 'transactions.transaction_journal_id') + ->where('opposing.identifier', '=', DB::raw('transactions.identifier')) + ->where('opposing.amount', '=', DB::raw('transactions.amount * -1')); + } ); $this->query->leftJoin('accounts as opposing_accounts', 'opposing.account_id', '=', 'opposing_accounts.id'); $this->query->leftJoin('account_types as opposing_account_types', 'opposing_accounts.account_type_id', '=', 'opposing_account_types.id'); diff --git a/app/Helpers/Collector/JournalCollectorInterface.php b/app/Helpers/Collector/JournalCollectorInterface.php index f6fafd77f4..5ac5e90bed 100644 --- a/app/Helpers/Collector/JournalCollectorInterface.php +++ b/app/Helpers/Collector/JournalCollectorInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Collector; @@ -32,9 +31,7 @@ use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; /** - * Interface JournalCollectorInterface - * - * @package FireflyIII\Helpers\Collector + * Interface JournalCollectorInterface. */ interface JournalCollectorInterface { @@ -50,7 +47,7 @@ interface JournalCollectorInterface * * @return JournalCollectorInterface */ - public function amountMore(string $amount): JournalCollectorInterface; + public function amountIs(string $amount): JournalCollectorInterface; /** * @param string $amount @@ -64,7 +61,7 @@ interface JournalCollectorInterface * * @return JournalCollectorInterface */ - public function amountIs(string $amount): JournalCollectorInterface; + public function amountMore(string $amount): JournalCollectorInterface; /** * @return int diff --git a/app/Helpers/Filter/AmountFilter.php b/app/Helpers/Filter/AmountFilter.php index 2c5439928c..970bbefa49 100644 --- a/app/Helpers/Filter/AmountFilter.php +++ b/app/Helpers/Filter/AmountFilter.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Filter; @@ -28,12 +27,10 @@ use Illuminate\Support\Collection; use Log; /** - * Class AmountFilter + * Class AmountFilter. * * This filter removes transactions with either a positive amount ($parameters = 1) or a negative amount * ($parameter = -1). This is helpful when a Collection has you with both transactions in a journal. - * - * @package FireflyIII\Helpers\Filter */ class AmountFilter implements FilterInterface { diff --git a/app/Helpers/Filter/EmptyFilter.php b/app/Helpers/Filter/EmptyFilter.php index a9a0aaa5f6..7c8c16313c 100644 --- a/app/Helpers/Filter/EmptyFilter.php +++ b/app/Helpers/Filter/EmptyFilter.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Filter; @@ -26,14 +25,10 @@ namespace FireflyIII\Helpers\Filter; use Illuminate\Support\Collection; /** - * Class EmptyFilter - * - * @package FireflyIII\Helpers\Filter + * Class EmptyFilter. */ class EmptyFilter implements FilterInterface { - - /** * @param Collection $set * diff --git a/app/Helpers/Filter/FilterInterface.php b/app/Helpers/Filter/FilterInterface.php index 8ce5290fa8..229864ad8f 100644 --- a/app/Helpers/Filter/FilterInterface.php +++ b/app/Helpers/Filter/FilterInterface.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Filter; - use Illuminate\Support\Collection; interface FilterInterface @@ -34,5 +32,4 @@ interface FilterInterface * @return Collection */ public function filter(Collection $set): Collection; - } diff --git a/app/Helpers/Filter/InternalTransferFilter.php b/app/Helpers/Filter/InternalTransferFilter.php index 8020ec04c9..1113977ceb 100644 --- a/app/Helpers/Filter/InternalTransferFilter.php +++ b/app/Helpers/Filter/InternalTransferFilter.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Filter; @@ -28,13 +27,11 @@ use Illuminate\Support\Collection; use Log; /** - * Class InternalTransferFilter + * Class InternalTransferFilter. * * This filter removes any filters that are from A to B or from B to A given a set of * account id's (in $parameters) where A and B are mentioned. So transfers between the mentioned * accounts will be removed. - * - * @package FireflyIII\Helpers\Filter */ class InternalTransferFilter implements FilterInterface { @@ -60,7 +57,7 @@ class InternalTransferFilter implements FilterInterface { return $set->filter( function (Transaction $transaction) { - if (is_null($transaction->opposing_account_id)) { + if (null === $transaction->opposing_account_id) { return $transaction; } // both id's in $parameters? @@ -68,18 +65,18 @@ class InternalTransferFilter implements FilterInterface Log::debug( sprintf( 'Transaction #%d has #%d and #%d in set, so removed', - $transaction->id, $transaction->account_id, $transaction->opposing_account_id - ), $this->accounts + $transaction->id, + $transaction->account_id, + $transaction->opposing_account_id + ), + $this->accounts ); return false; } return $transaction; - } ); - - } } diff --git a/app/Helpers/Filter/NegativeAmountFilter.php b/app/Helpers/Filter/NegativeAmountFilter.php index 730f9717b1..65e95f9fe5 100644 --- a/app/Helpers/Filter/NegativeAmountFilter.php +++ b/app/Helpers/Filter/NegativeAmountFilter.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Filter; @@ -28,11 +27,9 @@ use Illuminate\Support\Collection; use Log; /** - * Class NegativeAmountFilter + * Class NegativeAmountFilter. * * This filter removes entries with a negative amount (the original modifier is -1). - * - * @package FireflyIII\Helpers\Filter */ class NegativeAmountFilter implements FilterInterface { diff --git a/app/Helpers/Filter/OpposingAccountFilter.php b/app/Helpers/Filter/OpposingAccountFilter.php index 2829d4ff52..1539b86bde 100644 --- a/app/Helpers/Filter/OpposingAccountFilter.php +++ b/app/Helpers/Filter/OpposingAccountFilter.php @@ -18,23 +18,19 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Filter; - use FireflyIII\Models\Transaction; use Illuminate\Support\Collection; use Log; /** - * Class OpposingAccountFilter + * Class OpposingAccountFilter. * * This filter is similar to the internal transfer filter but only removes transactions when the opposing account is * amongst $parameters (list of account ID's). - * - * @package FireflyIII\Helpers\Filter */ class OpposingAccountFilter implements FilterInterface { diff --git a/app/Helpers/Filter/PositiveAmountFilter.php b/app/Helpers/Filter/PositiveAmountFilter.php index e5464d9253..1a6b5383d3 100644 --- a/app/Helpers/Filter/PositiveAmountFilter.php +++ b/app/Helpers/Filter/PositiveAmountFilter.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Filter; @@ -28,14 +27,12 @@ use Illuminate\Support\Collection; use Log; /** - * Class PositiveAmountFilter + * Class PositiveAmountFilter. * * This filter removes entries with a negative amount (the original modifier is -1). * * This filter removes transactions with either a positive amount ($parameters = 1) or a negative amount * ($parameter = -1). This is helpful when a Collection has you with both transactions in a journal. - * - * @package FireflyIII\Helpers\Filter */ class PositiveAmountFilter implements FilterInterface { @@ -49,7 +46,7 @@ class PositiveAmountFilter implements FilterInterface return $set->filter( function (Transaction $transaction) { // remove by amount - if (bccomp($transaction->transaction_amount, '0') === 1) { + if (1 === bccomp($transaction->transaction_amount, '0')) { Log::debug(sprintf('Filtered #%d because amount is %f.', $transaction->id, $transaction->transaction_amount)); return null; diff --git a/app/Helpers/Filter/TransferFilter.php b/app/Helpers/Filter/TransferFilter.php index 732e9dee6b..4d3e6877ef 100644 --- a/app/Helpers/Filter/TransferFilter.php +++ b/app/Helpers/Filter/TransferFilter.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Filter; @@ -29,11 +28,9 @@ use Illuminate\Support\Collection; use Steam; /** - * Class TransferFilter + * Class TransferFilter. * * This filter removes any transfers that are in the collection twice (from A to B and from B to A). - * - * @package FireflyIII\Helpers\Filter */ class TransferFilter implements FilterInterface { @@ -48,7 +45,7 @@ class TransferFilter implements FilterInterface $new = new Collection; /** @var Transaction $transaction */ foreach ($set as $transaction) { - if ($transaction->transaction_type_type !== TransactionType::TRANSFER) { + if (TransactionType::TRANSFER !== $transaction->transaction_type_type) { $new->push($transaction); continue; } diff --git a/app/Helpers/FiscalHelper.php b/app/Helpers/FiscalHelper.php index 45b2280ca6..4624f5aac2 100644 --- a/app/Helpers/FiscalHelper.php +++ b/app/Helpers/FiscalHelper.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers; @@ -27,20 +26,15 @@ use Carbon\Carbon; use Preferences; /** - * Class FiscalHelper - * - * @package FireflyIII\Helpers + * Class FiscalHelper. */ class FiscalHelper implements FiscalHelperInterface { - /** @var bool */ protected $useCustomFiscalYear; /** * FiscalHelper constructor. - * - * */ public function __construct() { @@ -56,7 +50,7 @@ class FiscalHelper implements FiscalHelperInterface { // get start of fiscal year for passed date $endDate = $this->startOfFiscalYear($date); - if ($this->useCustomFiscalYear === true) { + if (true === $this->useCustomFiscalYear) { // add 1 year and sub 1 day $endDate->addYear(); $endDate->subDay(); @@ -65,7 +59,6 @@ class FiscalHelper implements FiscalHelperInterface } $endDate->endOfYear(); - return $endDate; } @@ -78,7 +71,7 @@ class FiscalHelper implements FiscalHelperInterface { // get start mm-dd. Then create a start date in the year passed. $startDate = clone $date; - if ($this->useCustomFiscalYear === true) { + if (true === $this->useCustomFiscalYear) { $prefStartStr = Preferences::get('fiscalYearStart', '01-01')->data; list($mth, $day) = explode('-', $prefStartStr); $startDate->month(intval($mth))->day(intval($day)); diff --git a/app/Helpers/FiscalHelperInterface.php b/app/Helpers/FiscalHelperInterface.php index 9539b2b54e..c6a4764da0 100644 --- a/app/Helpers/FiscalHelperInterface.php +++ b/app/Helpers/FiscalHelperInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers; @@ -26,13 +25,10 @@ namespace FireflyIII\Helpers; use Carbon\Carbon; /** - * Interface FiscalHelperInterface - * - * @package FireflyIII\Helpers + * Interface FiscalHelperInterface. */ interface FiscalHelperInterface { - /** * This method produces a clone of the Carbon date object passed, checks preferences * and calculates the last day of the fiscal year. @@ -52,5 +48,4 @@ interface FiscalHelperInterface * @return Carbon date object */ public function startOfFiscalYear(Carbon $date): Carbon; - } diff --git a/app/Helpers/Help/Help.php b/app/Helpers/Help/Help.php index 9f8a91f3f3..265a642d5e 100644 --- a/app/Helpers/Help/Help.php +++ b/app/Helpers/Help/Help.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Help; @@ -31,9 +30,7 @@ use Requests_Exception; use Route; /** - * Class Help - * - * @package FireflyIII\Helpers\Help + * Class Help. */ class Help implements HelpInterface { @@ -62,7 +59,6 @@ class Help implements HelpInterface */ public function getFromGithub(string $route, string $language): string { - $uri = sprintf('https://raw.githubusercontent.com/firefly-iii/help/master/%s/%s.md', $language, $route); Log::debug(sprintf('Trying to get %s...', $uri)); $opt = ['useragent' => $this->userAgent]; @@ -77,7 +73,7 @@ class Help implements HelpInterface Log::debug(sprintf('Status code is %d', $result->status_code)); - if ($result->status_code === 200) { + if (200 === $result->status_code) { $content = trim($result->body); } @@ -91,7 +87,6 @@ class Help implements HelpInterface } /** - * * @param string $route * * @return bool @@ -119,15 +114,12 @@ class Help implements HelpInterface } return $result; - } /** - * * @param string $route * @param string $language * @param string $content - * */ public function putInCache(string $route, string $language, string $content) { diff --git a/app/Helpers/Help/HelpInterface.php b/app/Helpers/Help/HelpInterface.php index 5b97799697..4768e3fd40 100644 --- a/app/Helpers/Help/HelpInterface.php +++ b/app/Helpers/Help/HelpInterface.php @@ -18,19 +18,15 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Help; /** - * Interface HelpInterface - * - * @package FireflyIII\Helpers\Help + * Interface HelpInterface. */ interface HelpInterface { - /** * @param string $route * @param string $language diff --git a/app/Helpers/Report/BalanceReportHelper.php b/app/Helpers/Report/BalanceReportHelper.php index 4a9f322968..3222c1f1f5 100644 --- a/app/Helpers/Report/BalanceReportHelper.php +++ b/app/Helpers/Report/BalanceReportHelper.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Report; @@ -34,15 +33,13 @@ use Illuminate\Support\Collection; use Log; /** - * Class BalanceReportHelper + * Class BalanceReportHelper. * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) // I can't really help it. - * @package FireflyIII\Helpers\Report */ class BalanceReportHelper implements BalanceReportHelperInterface { - - /** @var BudgetRepositoryInterface */ + /** @var BudgetRepositoryInterface */ protected $budgetRepository; /** @@ -56,7 +53,6 @@ class BalanceReportHelper implements BalanceReportHelperInterface $this->budgetRepository = $budgetRepository; } - /** * @param Collection $accounts * @param Carbon $start @@ -77,7 +73,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface /** @var BudgetLimit $budgetLimit */ foreach ($budgetLimits as $budgetLimit) { - if (!is_null($budgetLimit->budget)) { + if (null !== $budgetLimit->budget) { $line = $this->createBalanceLine($budgetLimit, $accounts); $balance->addBalanceLine($line); } @@ -96,7 +92,6 @@ class BalanceReportHelper implements BalanceReportHelperInterface return $balance; } - /** * @param BudgetLimit $budgetLimit * @param Collection $accounts @@ -114,7 +109,10 @@ class BalanceReportHelper implements BalanceReportHelperInterface $balanceEntry = new BalanceEntry; $balanceEntry->setAccount($account); $spent = $this->budgetRepository->spentInPeriod( - new Collection([$budgetLimit->budget]), new Collection([$account]), $budgetLimit->start_date, $budgetLimit->end_date + new Collection([$budgetLimit->budget]), + new Collection([$account]), + $budgetLimit->start_date, + $budgetLimit->end_date ); $balanceEntry->setSpent($spent); $line->addBalanceEntry($balanceEntry); @@ -123,7 +121,6 @@ class BalanceReportHelper implements BalanceReportHelperInterface return $line; } - /** * @param Collection $accounts * @param Carbon $start @@ -142,13 +139,11 @@ class BalanceReportHelper implements BalanceReportHelperInterface $budgetEntry->setAccount($account); $budgetEntry->setSpent($spent); $empty->addBalanceEntry($budgetEntry); - } return $empty; } - /** * @param Balance $balance * @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly 5. @@ -160,7 +155,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface $set = $balance->getBalanceLines(); $newSet = new Collection; foreach ($set as $entry) { - if (!is_null($entry->getBudget()->id)) { + if (null !== $entry->getBudget()->id) { $sum = '0'; foreach ($entry->getBalanceEntries() as $balanceEntry) { $sum = bcadd($sum, $balanceEntry->getSpent()); @@ -176,7 +171,5 @@ class BalanceReportHelper implements BalanceReportHelperInterface $balance->setBalanceLines($newSet); return $balance; - } - } diff --git a/app/Helpers/Report/BalanceReportHelperInterface.php b/app/Helpers/Report/BalanceReportHelperInterface.php index 9fd6b5858f..66e7b23e89 100644 --- a/app/Helpers/Report/BalanceReportHelperInterface.php +++ b/app/Helpers/Report/BalanceReportHelperInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Report; @@ -27,11 +26,8 @@ use Carbon\Carbon; use FireflyIII\Helpers\Collection\Balance; use Illuminate\Support\Collection; - /** - * Interface BalanceReportHelperInterface - * - * @package FireflyIII\Helpers\Report + * Interface BalanceReportHelperInterface. */ interface BalanceReportHelperInterface { diff --git a/app/Helpers/Report/BudgetReportHelper.php b/app/Helpers/Report/BudgetReportHelper.php index 7865f0203e..995932ce73 100644 --- a/app/Helpers/Report/BudgetReportHelper.php +++ b/app/Helpers/Report/BudgetReportHelper.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Report; - use Carbon\Carbon; use FireflyIII\Models\Budget; use FireflyIII\Models\BudgetLimit; @@ -31,9 +29,7 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use Illuminate\Support\Collection; /** - * Class BudgetReportHelper - * - * @package FireflyIII\Helpers\Report + * Class BudgetReportHelper. */ class BudgetReportHelper implements BudgetReportHelperInterface { @@ -53,6 +49,7 @@ class BudgetReportHelper implements BudgetReportHelperInterface /** * @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly 5. * @SuppressWarnings(PHPMD.ExcessiveMethodLength) // all the arrays make it long. + * * @param Carbon $start * @param Carbon $end * @param Collection $accounts @@ -67,9 +64,8 @@ class BudgetReportHelper implements BudgetReportHelperInterface /** @var Budget $budget */ foreach ($set as $budget) { $budgetLimits = $this->repository->getBudgetLimits($budget, $start, $end); - if ($budgetLimits->count() === 0) { // no budget limit(s) for this budget - - $spent = $this->repository->spentInPeriod(new Collection([$budget]), $accounts, $start, $end);// spent for budget in time range + if (0 === $budgetLimits->count()) { // no budget limit(s) for this budget + $spent = $this->repository->spentInPeriod(new Collection([$budget]), $accounts, $start, $end); // spent for budget in time range if (bccomp($spent, '0') === -1) { $line = [ 'type' => 'budget', @@ -157,12 +153,11 @@ class BudgetReportHelper implements BudgetReportHelperInterface { $array = []; $expenses = $this->repository->spentInPeriod(new Collection([$budget]), $accounts, $budgetLimit->start_date, $budgetLimit->end_date); - $array['left'] = bccomp(bcadd($budgetLimit->amount, $expenses), '0') === 1 ? bcadd($budgetLimit->amount, $expenses) : '0'; - $array['spent'] = bccomp(bcadd($budgetLimit->amount, $expenses), '0') === 1 ? $expenses : '0'; - $array['overspent'] = bccomp(bcadd($budgetLimit->amount, $expenses), '0') === 1 ? '0' : bcadd($expenses, $budgetLimit->amount); + $array['left'] = 1 === bccomp(bcadd($budgetLimit->amount, $expenses), '0') ? bcadd($budgetLimit->amount, $expenses) : '0'; + $array['spent'] = 1 === bccomp(bcadd($budgetLimit->amount, $expenses), '0') ? $expenses : '0'; + $array['overspent'] = 1 === bccomp(bcadd($budgetLimit->amount, $expenses), '0') ? '0' : bcadd($expenses, $budgetLimit->amount); $array['expenses'] = $expenses; return $array; - } } diff --git a/app/Helpers/Report/BudgetReportHelperInterface.php b/app/Helpers/Report/BudgetReportHelperInterface.php index 3ba574bd5d..7c4a7ccf2f 100644 --- a/app/Helpers/Report/BudgetReportHelperInterface.php +++ b/app/Helpers/Report/BudgetReportHelperInterface.php @@ -18,23 +18,18 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Report; - use Carbon\Carbon; use Illuminate\Support\Collection; /** - * Interface BudgetReportHelperInterface - * - * @package FireflyIII\Helpers\Report + * Interface BudgetReportHelperInterface. */ interface BudgetReportHelperInterface { - /** * @param Carbon $start * @param Carbon $end @@ -52,5 +47,4 @@ interface BudgetReportHelperInterface * @return Collection */ public function getBudgetsWithExpenses(Carbon $start, Carbon $end, Collection $accounts): Collection; - } diff --git a/app/Helpers/Report/PopupReport.php b/app/Helpers/Report/PopupReport.php index 49b4014354..65c9164d0c 100644 --- a/app/Helpers/Report/PopupReport.php +++ b/app/Helpers/Report/PopupReport.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Report; @@ -32,14 +31,10 @@ use FireflyIII\Models\TransactionType; use Illuminate\Support\Collection; /** - * Class PopupReport - * - * @package FireflyIII\Helpers\Report + * Class PopupReport. */ class PopupReport implements PopupReportInterface { - - /** * @param $account * @param $attributes @@ -58,11 +53,10 @@ class PopupReport implements PopupReportInterface ->withoutBudget(); $journals = $collector->getJournals(); - return $journals->filter( function (Transaction $transaction) { $tags = $transaction->transactionJournal->tags()->where('tagMode', 'balancingAct')->count(); - if ($tags === 0) { + if (0 === $tags) { return true; } @@ -120,10 +114,10 @@ class PopupReport implements PopupReportInterface $collector->setAccounts($attributes['accounts'])->setRange($attributes['startDate'], $attributes['endDate']); - if (is_null($budget->id)) { + if (null === $budget->id) { $collector->setTypes([TransactionType::WITHDRAWAL])->withoutBudget(); } - if (!is_null($budget->id)) { + if (null !== $budget->id) { $collector->setBudget($budget); } $journals = $collector->getJournals(); diff --git a/app/Helpers/Report/PopupReportInterface.php b/app/Helpers/Report/PopupReportInterface.php index 288c53a72e..4b19f54661 100644 --- a/app/Helpers/Report/PopupReportInterface.php +++ b/app/Helpers/Report/PopupReportInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Report; @@ -29,13 +28,10 @@ use FireflyIII\Models\Category; use Illuminate\Support\Collection; /** - * Interface PopupReportInterface - * - * @package FireflyIII\Helpers\Report + * Interface PopupReportInterface. */ interface PopupReportInterface { - /** * @param $account * @param $attributes diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.php index 18d1558e6d..3b812533da 100644 --- a/app/Helpers/Report/ReportHelper.php +++ b/app/Helpers/Report/ReportHelper.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Report; @@ -35,14 +34,11 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use Illuminate\Support\Collection; /** - * Class ReportHelper - * - * @package FireflyIII\Helpers\Report + * Class ReportHelper. */ class ReportHelper implements ReportHelperInterface { - - /** @var BudgetRepositoryInterface */ + /** @var BudgetRepositoryInterface */ protected $budgetRepository; /** @@ -95,7 +91,7 @@ class ReportHelper implements ReportHelperInterface } ); $first = $entry->first(); - if (!is_null($first)) { + if (null !== $first) { $billLine->setTransactionJournalId($first->id); $billLine->setAmount($first->transaction_amount); $billLine->setLastHitDate($first->date); @@ -153,5 +149,4 @@ class ReportHelper implements ReportHelperInterface return $months; } - } diff --git a/app/Helpers/Report/ReportHelperInterface.php b/app/Helpers/Report/ReportHelperInterface.php index a12950234a..dafd0105ae 100644 --- a/app/Helpers/Report/ReportHelperInterface.php +++ b/app/Helpers/Report/ReportHelperInterface.php @@ -18,25 +18,19 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Helpers\Report; use Carbon\Carbon; use FireflyIII\Helpers\Collection\Bill as BillCollection; -use FireflyIII\Helpers\Collection\Expense; -use FireflyIII\Helpers\Collection\Income; use Illuminate\Support\Collection; /** - * Interface ReportHelperInterface - * - * @package FireflyIII\Helpers\Report + * Interface ReportHelperInterface. */ interface ReportHelperInterface { - /** * This method generates a full report for the given period on all * the users bills and their payments. @@ -57,5 +51,4 @@ interface ReportHelperInterface * @return array */ public function listOfMonths(Carbon $date): array; - } diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.php new file mode 100644 index 0000000000..b5573c83a4 --- /dev/null +++ b/app/Http/Controllers/Account/ReconcileController.php @@ -0,0 +1,388 @@ +. + */ +declare(strict_types=1); + +namespace FireflyIII\Http\Controllers\Account; + +use Carbon\Carbon; +use FireflyIII\Exceptions\FireflyException; +use FireflyIII\Helpers\Collector\JournalCollectorInterface; +use FireflyIII\Http\Controllers\Controller; +use FireflyIII\Http\Requests\ReconciliationFormRequest; +use FireflyIII\Models\Account; +use FireflyIII\Models\AccountType; +use FireflyIII\Models\Transaction; +use FireflyIII\Models\TransactionJournal; +use FireflyIII\Models\TransactionType; +use FireflyIII\Repositories\Account\AccountRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Journal\JournalRepositoryInterface; +use Illuminate\Http\Request; +use Illuminate\Support\Collection; +use Navigation; +use Preferences; +use Response; +use Session; +use View; + +/** + * Class ReconcileController. + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class ReconcileController extends Controller +{ + /** + * + */ + public function __construct() + { + parent::__construct(); + + // translations: + $this->middleware( + function ($request, $next) { + View::share('mainTitleIcon', 'fa-credit-card'); + View::share('title', trans('firefly.accounts')); + + return $next($request); + } + ); + } + + /** + * @param TransactionJournal $journal + * + * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + */ + public function edit(TransactionJournal $journal) + { + if ($journal->transactionType->type !== TransactionType::RECONCILIATION) { + return redirect(route('transactions.edit', [$journal->id])); + } + // view related code + $subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]); + + // journal related code + $pTransaction = $journal->positiveTransaction(); + $preFilled = [ + 'date' => $journal->dateAsString(), + 'category' => $journal->categoryAsString(), + 'tags' => join(',', $journal->tags->pluck('tag')->toArray()), + 'amount' => $pTransaction->amount, + ]; + + Session::flash('preFilled', $preFilled); + Session::flash('gaEventCategory', 'transactions'); + Session::flash('gaEventAction', 'edit-reconciliation'); + + // put previous url in session if not redirect from store (not "return_to_edit"). + if (true !== session('reconcile.edit.fromUpdate')) { + $this->rememberPreviousUri('reconcile.edit.uri'); + } + Session::forget('reconcile.edit.fromUpdate'); + + return view( + 'accounts.reconcile.edit', + compact('journal', 'subTitle') + )->with('data', $preFilled); + + } + + /** + * @param Request $request + * @param Account $account + * @param Carbon $start + * @param Carbon $end + * + * @return \Illuminate\Http\JsonResponse + * + * @throws FireflyException + */ + public function overview(Request $request, Account $account, Carbon $start, Carbon $end) + { + if (AccountType::ASSET !== $account->accountType->type) { + throw new FireflyException(sprintf('Account %s is not an asset account.', $account->name)); + } + $startBalance = $request->get('startBalance'); + $endBalance = $request->get('endBalance'); + $transactionIds = $request->get('transactions') ?? []; + $clearedIds = $request->get('cleared') ?? []; + $amount = '0'; + $clearedAmount = '0'; + $route = route('accounts.reconcile.submit', [$account->id, $start->format('Ymd'), $end->format('Ymd')]); + // get sum of transaction amounts: + /** @var JournalRepositoryInterface $repository */ + $repository = app(JournalRepositoryInterface::class); + $transactions = $repository->getTransactionsById($transactionIds); + $cleared = $repository->getTransactionsById($clearedIds); + $countCleared = 0; + + /** @var Transaction $transaction */ + foreach ($transactions as $transaction) { + $amount = bcadd($amount, $transaction->amount); + } + + /** @var Transaction $transaction */ + foreach ($cleared as $transaction) { + if ($transaction->transactionJournal->date <= $end) { + $clearedAmount = bcadd($clearedAmount, $transaction->amount); + ++$countCleared; + } + } + $difference = bcadd(bcadd(bcsub($startBalance, $endBalance), $clearedAmount), $amount); + $diffCompare = bccomp($difference, '0'); + $return = [ + 'post_uri' => $route, + 'html' => view('accounts.reconcile.overview', compact('account', 'start', 'diffCompare', 'difference', 'end', 'clearedIds', 'transactionIds', 'clearedAmount', 'startBalance', 'endBalance', 'amount', 'route', 'countCleared'))->render(), + ]; + + return Response::json($return); + } + + /** + * @param Account $account + * @param Carbon|null $start + * @param Carbon|null $end + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View + */ + public function reconcile(Account $account, Carbon $start = null, Carbon $end = null) + { + if (AccountType::INITIAL_BALANCE === $account->accountType->type) { + return $this->redirectToOriginalAccount($account); + } + if (AccountType::ASSET !== $account->accountType->type) { + Session::flash('error', trans('firefly.must_be_asset_account')); + + return redirect(route('accounts.index', [config('firefly.shortNamesByFullName.' . $account->accountType->type)])); + } + /** @var CurrencyRepositoryInterface $currencyRepos */ + $currencyRepos = app(CurrencyRepositoryInterface::class); + $currencyId = intval($account->getMeta('currency_id')); + $currency = $currencyRepos->find($currencyId); + if (0 === $currencyId) { + $currency = app('amount')->getDefaultCurrency(); + } + + // no start or end: + $range = Preferences::get('viewRange', '1M')->data; + + // get start and end + if (null === $start && null === $end) { + $start = clone session('start', Navigation::startOfPeriod(new Carbon, $range)); + $end = clone session('end', Navigation::endOfPeriod(new Carbon, $range)); + } + if (null === $end) { + $end = Navigation::endOfPeriod($start, $range); + } + + $startDate = clone $start; + $startDate->subDays(1); + $startBalance = round(app('steam')->balance($account, $startDate), $currency->decimal_places); + $endBalance = round(app('steam')->balance($account, $end), $currency->decimal_places); + $subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type); + $subTitle = trans('firefly.reconcile_account', ['account' => $account->name]); + + // various links + $transactionsUri = route('accounts.reconcile.transactions', [$account->id, '%start%', '%end%']); + $overviewUri = route('accounts.reconcile.overview', [$account->id, '%start%', '%end%']); + $indexUri = route('accounts.reconcile', [$account->id, '%start%', '%end%']); + + return view('accounts.reconcile.index', compact('account', 'currency', 'subTitleIcon', 'start', 'end', 'subTitle', 'startBalance', 'endBalance', 'transactionsUri', 'overviewUri', 'indexUri')); + } + + /** + * @param JournalRepositoryInterface $repository + * @param TransactionJournal $journal + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View + */ + public function show(JournalRepositoryInterface $repository, TransactionJournal $journal) + { + if ($journal->transactionType->type !== TransactionType::RECONCILIATION) { + return redirect(route('transactions.show', [$journal->id])); + } + $subTitle = trans('firefly.reconciliation') . ' "' . $journal->description . '"'; + + // get main transaction: + $transaction = $repository->getAssetTransaction($journal); + + + return view('accounts.reconcile.show', compact('journal', 'subTitle', 'transaction')); + } + + /** + * @param Request $request + * @param Account $account + * @param Carbon $start + * @param Carbon $end + * + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + */ + public function submit(Request $request, Account $account, Carbon $start, Carbon $end) + { + /** @var JournalRepositoryInterface $repository */ + $repository = app(JournalRepositoryInterface::class); + $transactions = $repository->getTransactionsById($request->get('transactions')); + /** @var Transaction $transaction */ + foreach ($transactions as $transaction) { + $repository->reconcile($transaction); // mark as reconciled. + } + + // create reconciliation transaction (if necessary): + if ('create' === $request->get('reconcile')) { + /** @var AccountRepositoryInterface $accountRepos */ + $accountRepos = app(AccountRepositoryInterface::class); + $reconciliation = $accountRepos->getReconciliation($account); + $difference = $request->get('difference'); + + // store journal between these two. + $data = [ + 'what' => 'Reconciliation', + 'source' => $account, + 'destination' => $reconciliation, + 'category' => '', + 'budget_id' => 0, + 'amount' => $difference, + 'currency_id' => $account->getMeta('currency_id'), + 'description' => trans( + 'firefly.reconcilliation_transaction_title', + ['from' => $start->formatLocalized($this->monthAndDayFormat), 'to' => $end->formatLocalized($this->monthAndDayFormat)] + ), + 'date' => $request->get('end'), + 'notes' => join(',', $transactions->pluck('id')->toArray()), + ]; + $journal = $repository->store($data); + // reconcile this transaction too: + $transaction = $journal->transactions()->first(); + $repository->reconcile($transaction); + } + + Session::flash('success', trans('firefly.reconciliation_stored')); + + return redirect(route('accounts.show', [$account->id])); + } + + /** + * @param Account $account + * @param Carbon $start + * @param Carbon $end + * + * @return mixed + */ + public function transactions(Account $account, Carbon $start, Carbon $end) + { + if (AccountType::INITIAL_BALANCE === $account->accountType->type) { + return $this->redirectToOriginalAccount($account); + } + + $startDate = clone $start; + $startDate->subDays(1); + + /** @var CurrencyRepositoryInterface $currencyRepos */ + $currencyRepos = app(CurrencyRepositoryInterface::class); + $currencyId = intval($account->getMeta('currency_id')); + $currency = $currencyRepos->find($currencyId); + if (0 === $currencyId) { + $currency = app('amount')->getDefaultCurrency(); + } + + $startBalance = round(app('steam')->balance($account, $startDate), $currency->decimal_places); + $endBalance = round(app('steam')->balance($account, $end), $currency->decimal_places); + + // get the transactions + $selectionStart = clone $start; + $selectionStart->subDays(3); + $selectionEnd = clone $end; + $selectionEnd->addDays(3); + + // grab transactions: + /** @var JournalCollectorInterface $collector */ + $collector = app(JournalCollectorInterface::class); + $collector->setAccounts(new Collection([$account])) + ->setRange($selectionStart, $selectionEnd)->withBudgetInformation()->withOpposingAccount()->withCategoryInformation(); + $transactions = $collector->getJournals(); + $html = view('accounts.reconcile.transactions', compact('account', 'transactions', 'start', 'end', 'selectionStart', 'selectionEnd'))->render(); + + return Response::json(['html' => $html, 'startBalance' => $startBalance, 'endBalance' => $endBalance]); + } + + /** + * @param ReconciliationFormRequest $request + * @param AccountRepositoryInterface $repository + * @param TransactionJournal $journal + * + * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + */ + public function update(ReconciliationFormRequest $request, AccountRepositoryInterface $repository, TransactionJournal $journal) + { + if ($journal->transactionType->type !== TransactionType::RECONCILIATION) { + return redirect(route('transactions.show', [$journal->id])); + } + if (bccomp('0', $request->get('amount')) === 0) { + Session::flash('error', trans('firefly.amount_cannot_be_zero')); + + return redirect(route('accounts.reconcile.edit', [$journal->id]))->withInput(); + } + // update journal using account repository. Keep it consistent. + $data = $request->getJournalData(); + $repository->updateReconciliation($journal, $data); + + // @codeCoverageIgnoreStart + if (1 === intval($request->get('return_to_edit'))) { + Session::put('reconcile.edit.fromUpdate', true); + + return redirect(route('accounts.reconcile.edit', [$journal->id]))->withInput(['return_to_edit' => 1]); + } + // @codeCoverageIgnoreEnd + + // redirect to previous URL. + return redirect($this->getPreviousUri('reconcile.edit.uri')); + + } + + + /** + * @param Account $account + * + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * + * @throws FireflyException + */ + private function redirectToOriginalAccount(Account $account) + { + /** @var Transaction $transaction */ + $transaction = $account->transactions()->first(); + if (null === $transaction) { + throw new FireflyException('Expected a transaction. This account has none. BEEP, error.'); + } + + $journal = $transaction->transactionJournal; + /** @var Transaction $opposingTransaction */ + $opposingTransaction = $journal->transactions()->where('transactions.id', '!=', $transaction->id)->first(); + + if (null === $opposingTransaction) { + throw new FireflyException('Expected an opposing transaction. This account has none. BEEP, error.'); // @codeCoverageIgnore + } + + return redirect(route('accounts.show', [$opposingTransaction->account_id])); + } +} diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 2d37d26888..e8dd4be714 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -45,9 +44,8 @@ use Steam; use View; /** - * Class AccountController + * Class AccountController. * - * @package FireflyIII\Http\Controllers * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class AccountController extends Controller @@ -90,12 +88,11 @@ class AccountController extends Controller $roles[$role] = strval(trans('firefly.account_role_' . $role)); } - // pre fill some data - $request->session()->flash('preFilled', ['currency_id' => $defaultCurrency->id,]); + $request->session()->flash('preFilled', ['currency_id' => $defaultCurrency->id]); // put previous url in session if not redirect from store (not "create another"). - if (session('accounts.create.fromStore') !== true) { + if (true !== session('accounts.create.fromStore')) { $this->rememberPreviousUri('accounts.create.uri'); } $request->session()->forget('accounts.create.fromStore'); @@ -103,7 +100,6 @@ class AccountController extends Controller $request->session()->flash('gaEventAction', 'create-' . $what); return view('accounts.create', compact('subTitleIcon', 'what', 'subTitle', 'currencySelectList', 'allCurrencies', 'roles')); - } /** @@ -175,9 +171,8 @@ class AccountController extends Controller $roles[$role] = strval(trans('firefly.account_role_' . $role)); } - // put previous url in session if not redirect from store (not "return_to_edit"). - if (session('accounts.edit.fromUpdate') !== true) { + if (true !== session('accounts.edit.fromUpdate')) { $this->rememberPreviousUri('accounts.edit.uri'); } $request->session()->forget('accounts.edit.fromUpdate'); @@ -186,9 +181,9 @@ class AccountController extends Controller // the opening balance is tricky: $openingBalanceAmount = $account->getOpeningBalanceAmount(); - $openingBalanceAmount = $account->getOpeningBalanceAmount() === '0' ? '' : $openingBalanceAmount; + $openingBalanceAmount = '0' === $account->getOpeningBalanceAmount() ? '' : $openingBalanceAmount; $openingBalanceDate = $account->getOpeningBalanceDate(); - $openingBalanceDate = $openingBalanceDate->year === 1900 ? null : $openingBalanceDate->format('Y-m-d'); + $openingBalanceDate = 1900 === $openingBalanceDate->year ? null : $openingBalanceDate->format('Y-m-d'); $currency = $repository->find(intval($account->getMeta('currency_id'))); $preFilled = [ @@ -201,16 +196,24 @@ class AccountController extends Controller 'openingBalance' => $openingBalanceAmount, 'virtualBalance' => $account->virtual_balance, 'currency_id' => $currency->id, - ]; $request->session()->flash('preFilled', $preFilled); $request->session()->flash('gaEventCategory', 'accounts'); $request->session()->flash('gaEventAction', 'edit-' . $what); return view( - 'accounts.edit', compact( - 'allCurrencies', 'currencySelectList', 'account', 'currency', 'subTitle', 'subTitleIcon', 'what', 'roles', 'preFilled' - ) + 'accounts.edit', + compact( + 'allCurrencies', + 'currencySelectList', + 'account', + 'currency', + 'subTitle', + 'subTitleIcon', + 'what', + 'roles', + 'preFilled' + ) ); } @@ -250,7 +253,6 @@ class AccountController extends Controller return view('accounts.index', compact('what', 'subTitleIcon', 'subTitle', 'accounts')); } - /** * Show an account. * @@ -266,7 +268,7 @@ class AccountController extends Controller */ public function show(Request $request, JournalRepositoryInterface $repository, Account $account, string $moment = '') { - if ($account->accountType->type === AccountType::INITIAL_BALANCE) { + if (AccountType::INITIAL_BALANCE === $account->accountType->type) { return $this->redirectToOriginalAccount($account); } /** @var CurrencyRepositoryInterface $currencyRepos */ @@ -281,13 +283,12 @@ class AccountController extends Controller $periods = new Collection; $currencyId = intval($account->getMeta('currency_id')); $currency = $currencyRepos->find($currencyId); - if ($currencyId === 0) { - $currency = app('amount')->getDefaultCurrency(); + if (0 === $currencyId) { + $currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore } - // prep for "all" view. - if ($moment === 'all') { + if ('all' === $moment) { $subTitle = trans('firefly.all_journals_for_account', ['name' => $account->name]); $chartUri = route('chart.account.all', [$account->id]); $first = $repository->first(); @@ -296,7 +297,7 @@ class AccountController extends Controller } // prep for "specific date" view. - if (strlen($moment) > 0 && $moment !== 'all') { + if (strlen($moment) > 0 && 'all' !== $moment) { $start = new Carbon($moment); $end = Navigation::endOfPeriod($start, $range); $fStart = $start->formatLocalized($this->monthAndDayFormat); @@ -307,7 +308,7 @@ class AccountController extends Controller } // prep for current period view - if (strlen($moment) === 0) { + if (0 === strlen($moment)) { $start = clone session('start', Navigation::startOfPeriod(new Carbon, $range)); $end = clone session('end', Navigation::endOfPeriod(new Carbon, $range)); $fStart = $start->formatLocalized($this->monthAndDayFormat); @@ -319,15 +320,15 @@ class AccountController extends Controller // grab journals: $collector = app(JournalCollectorInterface::class); $collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page); - if (!is_null($start)) { + if (null !== $start) { $collector->setRange($start, $end); } - $journals = $collector->getPaginatedJournals(); - $journals->setPath(route('accounts.show', [$account->id, $moment])); + $transactions = $collector->getPaginatedJournals(); + $transactions->setPath(route('accounts.show', [$account->id, $moment])); return view( 'accounts.show', - compact('account', 'currency', 'moment', 'periods', 'subTitleIcon', 'journals', 'subTitle', 'start', 'end', 'chartUri') + compact('account', 'currency', 'moment', 'periods', 'subTitleIcon', 'transactions', 'subTitle', 'start', 'end', 'chartUri') ); } @@ -336,7 +337,6 @@ class AccountController extends Controller * @param AccountRepositoryInterface $repository * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * */ public function store(AccountFormRequest $request, AccountRepositoryInterface $repository) { @@ -347,12 +347,14 @@ class AccountController extends Controller // update preferences if necessary: $frontPage = Preferences::get('frontPageAccounts', [])->data; - if (count($frontPage) > 0 && $account->accountType->type === AccountType::ASSET) { + if (count($frontPage) > 0 && AccountType::ASSET === $account->accountType->type) { + // @codeCoverageIgnoreStart $frontPage[] = $account->id; Preferences::set('frontPageAccounts', $frontPage); + // @codeCoverageIgnoreEnd } - if (intval($request->get('create_another')) === 1) { + if (1 === intval($request->get('create_another'))) { // set value so create routine will not overwrite URL: $request->session()->put('accounts.create.fromStore', true); @@ -378,7 +380,7 @@ class AccountController extends Controller $request->session()->flash('success', strval(trans('firefly.updated_account', ['name' => $account->name]))); Preferences::mark(); - if (intval($request->get('return_to_edit')) === 1) { + if (1 === intval($request->get('return_to_edit'))) { // set value so edit routine will not overwrite URL: $request->session()->put('accounts.edit.fromUpdate', true); @@ -387,10 +389,8 @@ class AccountController extends Controller // redirect to previous URL. return redirect($this->getPreviousUri('accounts.edit.uri')); - } - /** * @param array $array * @param int $entryId @@ -411,7 +411,7 @@ class AccountController extends Controller * and for each period, the amount of money spent and earned. This is a complex operation which is cached for * performance reasons. * - * @param Account $account The account involved. + * @param Account $account the account involved * * @return Collection * @@ -462,10 +462,10 @@ class AccountController extends Controller 'name' => $dateName, 'spent' => $spent, 'earned' => $earned, - 'date' => clone $end] + 'date' => clone $end,] ); $end = Navigation::subtractPeriod($end, $range, 1); - $count++; + ++$count; } $cache->store($entries); @@ -476,13 +476,14 @@ class AccountController extends Controller * @param Account $account * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * * @throws FireflyException */ private function redirectToOriginalAccount(Account $account) { /** @var Transaction $transaction */ $transaction = $account->transactions()->first(); - if (is_null($transaction)) { + if (null === $transaction) { throw new FireflyException('Expected a transaction. This account has none. BEEP, error.'); } @@ -490,7 +491,7 @@ class AccountController extends Controller /** @var Transaction $opposingTransaction */ $opposingTransaction = $journal->transactions()->where('transactions.id', '!=', $transaction->id)->first(); - if (is_null($opposingTransaction)) { + if (null === $opposingTransaction) { throw new FireflyException('Expected an opposing transaction. This account has none. BEEP, error.'); // @codeCoverageIgnore } diff --git a/app/Http/Controllers/Admin/ConfigurationController.php b/app/Http/Controllers/Admin/ConfigurationController.php index 3948ecbe01..fa4b3ab1d5 100644 --- a/app/Http/Controllers/Admin/ConfigurationController.php +++ b/app/Http/Controllers/Admin/ConfigurationController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Admin; - use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Requests\ConfigurationRequest; use FireflyIII\Support\Facades\FireflyConfig; @@ -33,9 +31,7 @@ use Session; use View; /** - * Class ConfigurationController - * - * @package FireflyIII\Http\Controllers\Admin + * Class ConfigurationController. */ class ConfigurationController extends Controller { @@ -46,7 +42,6 @@ class ConfigurationController extends Controller { parent::__construct(); - $this->middleware( function ($request, $next) { View::share('title', strval(trans('firefly.administration'))); @@ -55,7 +50,6 @@ class ConfigurationController extends Controller return $next($request); } ); - } /** @@ -76,7 +70,6 @@ class ConfigurationController extends Controller 'admin.configuration.index', compact('subTitle', 'subTitleIcon', 'singleUserMode', 'isDemoSite', 'siteOwner') ); - } /** @@ -99,5 +92,4 @@ class ConfigurationController extends Controller return Redirect::route('admin.configuration.index'); } - } diff --git a/app/Http/Controllers/Admin/HomeController.php b/app/Http/Controllers/Admin/HomeController.php index a801448374..4fa7948909 100644 --- a/app/Http/Controllers/Admin/HomeController.php +++ b/app/Http/Controllers/Admin/HomeController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Admin; - use FireflyIII\Events\AdminRequestedTestMessage; use FireflyIII\Http\Controllers\Controller; use Illuminate\Http\Request; @@ -31,9 +29,7 @@ use Log; use Session; /** - * Class HomeController - * - * @package FireflyIII\Http\Controllers\Admin + * Class HomeController. */ class HomeController extends Controller { @@ -62,5 +58,4 @@ class HomeController extends Controller return redirect(route('admin.index')); } - } diff --git a/app/Http/Controllers/Admin/LinkController.php b/app/Http/Controllers/Admin/LinkController.php index 4b11b5a7be..38bf575b7d 100644 --- a/app/Http/Controllers/Admin/LinkController.php +++ b/app/Http/Controllers/Admin/LinkController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Admin; - use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Requests\LinkTypeFormRequest; use FireflyIII\Models\LinkType; @@ -33,9 +31,7 @@ use Preferences; use View; /** - * Class LinkController - * - * @package FireflyIII\Http\Controllers\Admin + * Class LinkController. */ class LinkController extends Controller { @@ -65,7 +61,7 @@ class LinkController extends Controller $subTitleIcon = 'fa-link'; // put previous url in session if not redirect from store (not "create another"). - if (session('link_types.create.fromStore') !== true) { + if (true !== session('link_types.create.fromStore')) { $this->rememberPreviousUri('link_types.create.uri'); } @@ -140,8 +136,8 @@ class LinkController extends Controller $subTitleIcon = 'fa-link'; // put previous url in session if not redirect from store (not "return_to_edit"). - if (session('link_types.edit.fromUpdate') !== true) { - $this->rememberPreviousUri('link_types.edit.uri'); + if (true !== session('link_types.edit.fromUpdate')) { + $this->rememberPreviousUri('link_types.edit.uri'); // @codeCoverageIgnore } $request->session()->forget('link_types.edit.fromUpdate'); @@ -197,11 +193,11 @@ class LinkController extends Controller $linkType = $repository->store($data); $request->session()->flash('success', strval(trans('firefly.stored_new_link_type', ['name' => $linkType->name]))); - if (intval($request->get('create_another')) === 1) { + if (1 === intval($request->get('create_another'))) { // set value so create routine will not overwrite URL: $request->session()->put('link_types.create.fromStore', true); - return redirect(route('link_types.create', [$request->input('what')]))->withInput(); + return redirect(route('admin.links.create'))->withInput(); } // redirect to previous URL. @@ -226,7 +222,7 @@ class LinkController extends Controller $request->session()->flash('success', strval(trans('firefly.updated_link_type', ['name' => $linkType->name]))); Preferences::mark(); - if (intval($request->get('return_to_edit')) === 1) { + if (1 === intval($request->get('return_to_edit'))) { // set value so edit routine will not overwrite URL: $request->session()->put('link_types.edit.fromUpdate', true); @@ -236,5 +232,4 @@ class LinkController extends Controller // redirect to previous URL. return redirect($this->getPreviousUri('link_types.edit.uri')); } - } diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index f152582b52..8670e95e90 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Admin; - use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Requests\UserFormRequest; use FireflyIII\Repositories\User\UserRepositoryInterface; @@ -34,9 +32,7 @@ use Session; use View; /** - * Class UserController - * - * @package FireflyIII\Http\Controllers\Admin + * Class UserController. */ class UserController extends Controller { @@ -47,7 +43,6 @@ class UserController extends Controller { parent::__construct(); - $this->middleware( function ($request, $next) { View::share('title', strval(trans('firefly.administration'))); @@ -92,7 +87,7 @@ class UserController extends Controller public function edit(User $user) { // put previous url in session if not redirect from store (not "return_to_edit"). - if (session('users.edit.fromUpdate') !== true) { + if (true !== session('users.edit.fromUpdate')) { $this->rememberPreviousUri('users.edit.uri'); } Session::forget('users.edit.fromUpdate'); @@ -107,7 +102,6 @@ class UserController extends Controller ]; return view('admin.users.edit', compact('user', 'subTitle', 'subTitleIcon', 'codes')); - } /** @@ -127,16 +121,14 @@ class UserController extends Controller $list = ['twoFactorAuthEnabled', 'twoFactorAuthSecret']; $preferences = Preferences::getArrayForUser($user, $list); $user->isAdmin = $user->hasRole('owner'); - $is2faEnabled = $preferences['twoFactorAuthEnabled'] === true; - $has2faSecret = !is_null($preferences['twoFactorAuthSecret']); + $is2faEnabled = true === $preferences['twoFactorAuthEnabled']; + $has2faSecret = null !== $preferences['twoFactorAuthSecret']; $user->has2FA = ($is2faEnabled && $has2faSecret) ? true : false; $user->prefs = $preferences; } ); - return view('admin.users.index', compact('subTitle', 'subTitleIcon', 'users')); - } /** @@ -156,7 +148,12 @@ class UserController extends Controller return view( 'admin.users.show', compact( - 'title', 'mainTitleIcon', 'subTitle', 'subTitleIcon', 'information', 'user' + 'title', + 'mainTitleIcon', + 'subTitle', + 'subTitleIcon', + 'information', + 'user' ) ); } @@ -164,7 +161,6 @@ class UserController extends Controller /** * @param UserFormRequest $request * @param User $user - * * @param UserRepositoryInterface $repository * * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector @@ -185,7 +181,7 @@ class UserController extends Controller Session::flash('success', strval(trans('firefly.updated_user', ['email' => $user->email]))); Preferences::mark(); - if (intval($request->get('return_to_edit')) === 1) { + if (1 === intval($request->get('return_to_edit'))) { // @codeCoverageIgnoreStart Session::put('users.edit.fromUpdate', true); @@ -195,8 +191,5 @@ class UserController extends Controller // redirect to previous URL. return redirect($this->getPreviousUri('users.edit.uri')); - } - - } diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php index 57cdd8be55..b2ef0b7875 100644 --- a/app/Http/Controllers/AttachmentController.php +++ b/app/Http/Controllers/AttachmentController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -35,15 +34,12 @@ use Response; use View; /** - * Class AttachmentController + * Class AttachmentController. * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) // it's 13. - * - * @package FireflyIII\Http\Controllers */ class AttachmentController extends Controller { - /** * */ @@ -104,16 +100,15 @@ class AttachmentController extends Controller * @param Attachment $attachment * * @return mixed + * * @throws FireflyException */ public function download(AttachmentRepositoryInterface $repository, Attachment $attachment) { - if ($repository->exists($attachment)) { $content = $repository->getContent($attachment); $quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\')); - /** @var LaravelResponse $response */ $response = response($content, 200); $response @@ -144,7 +139,7 @@ class AttachmentController extends Controller $subTitle = trans('firefly.edit_attachment', ['name' => $attachment->filename]); // put previous url in session if not redirect from store (not "return_to_edit"). - if (session('attachments.edit.fromUpdate') !== true) { + if (true !== session('attachments.edit.fromUpdate')) { $this->rememberPreviousUri('attachments.edit.uri'); } $request->session()->forget('attachments.edit.fromUpdate'); @@ -161,8 +156,7 @@ class AttachmentController extends Controller { $image = 'images/page_green.png'; - - if ($attachment->mime === 'application/pdf') { + if ('application/pdf' === $attachment->mime) { $image = 'images/page_white_acrobat.png'; } $file = public_path($image); @@ -172,7 +166,6 @@ class AttachmentController extends Controller return $response; } - /** * @param AttachmentFormRequest $request * @param AttachmentRepositoryInterface $repository @@ -188,7 +181,7 @@ class AttachmentController extends Controller $request->session()->flash('success', strval(trans('firefly.attachment_updated', ['name' => $attachment->filename]))); Preferences::mark(); - if (intval($request->get('return_to_edit')) === 1) { + if (1 === intval($request->get('return_to_edit'))) { // @codeCoverageIgnoreStart $request->session()->put('attachments.edit.fromUpdate', true); @@ -198,7 +191,5 @@ class AttachmentController extends Controller // redirect to previous URL. return redirect($this->getPreviousUri('attachments.edit.uri')); - } - } diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index be79510661..e969737770 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - /** * ForgotPasswordController.php * Copyright (c) 2017 thegrumpydictator@gmail.com @@ -53,12 +51,10 @@ class ForgotPasswordController extends Controller /** * Create a new controller instance. - * */ public function __construct() { parent::__construct(); $this->middleware('guest'); - } } diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 8d4a8f75a1..829915e5ef 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - /** * LoginController.php * Copyright (c) 2017 thegrumpydictator@gmail.com @@ -35,11 +33,12 @@ namespace FireflyIII\Http\Controllers\Auth; use FireflyConfig; use FireflyIII\Http\Controllers\Controller; +use FireflyIII\Models\TransactionCurrency; use FireflyIII\User; use Illuminate\Cookie\CookieJar; use Illuminate\Foundation\Auth\AuthenticatesUsers; use Illuminate\Http\Request; - +use Schema; class LoginController extends Controller { @@ -65,7 +64,6 @@ class LoginController extends Controller /** * Create a new controller instance. - * */ public function __construct() { @@ -73,27 +71,101 @@ class LoginController extends Controller $this->middleware('guest')->except('logout'); } + /** + * Handle a login request to the application. + * + * @param Request $request + * + * @return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\Response|void + */ + public function login(Request $request) + { + $this->validateLogin($request); + + // If the class is using the ThrottlesLogins trait, we can automatically throttle + // the login attempts for this application. We'll key this by the username and + // the IP address of the client making these requests into this application. + if ($this->hasTooManyLoginAttempts($request)) { + $this->fireLockoutEvent($request); + + return $this->sendLockoutResponse($request); + } + + if ($this->attemptLogin($request)) { + // user is logged in. Save in session if the user requested session to be remembered: + $request->session()->put('remember_login', $request->filled('remember')); + + return $this->sendLoginResponse($request); + } + + // If the login attempt was unsuccessful we will increment the number of attempts + // to login and redirect the user back to the login form. Of course, when this + // user surpasses their maximum number of attempts they will get locked out. + $this->incrementLoginAttempts($request); + + return $this->sendFailedLoginResponse($request); + } + + /** + * Log the user out of the application. + * + * @param Request $request + * @param CookieJar $cookieJar + * + * @return $this + */ + public function logout(Request $request, CookieJar $cookieJar) + { + $this->guard()->logout(); + + $request->session()->invalidate(); + $cookie = $cookieJar->forget('twoFactorAuthenticated'); + + return redirect('/')->withCookie($cookie); + } + /** * Show the application's login form. * - * @return \Illuminate\Http\Response + * @param Request $request + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ - public function showLoginForm(Request $request, CookieJar $cookieJar) + public function showLoginForm(Request $request) { - // forget 2fa cookie: - $cookie = $cookieJar->forever('twoFactorAuthenticated', 'false'); + // check for presence of tables: + $hasTable = Schema::hasTable('users'); + + if (!$hasTable) { + $message + = 'Firefly III could not find the "users" table. This is a strong indication your database credentials are wrong or the database has not been initialized. Did you follow the installation instructions correctly?'; + + return view('error', compact('message')); + } + + // check for presence of currency: + $currency = TransactionCurrency::where('code', 'EUR')->first(); + if (null === $currency) { + $message + = 'Firefly III could not find the EURO currency. This is a strong indication the database has not been initialized correctly. Did you follow the installation instructions?'; + + return view('error', compact('message')); + } + + // forget 2fa session thing. + $request->session()->forget('twoFactorAuthenticated'); // is allowed to? $singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $userCount = User::count(); $allowRegistration = true; - if ($singleUserMode === true && $userCount > 0) { + if (true === $singleUserMode && $userCount > 0) { $allowRegistration = false; } $email = $request->old('email'); $remember = $request->old('remember'); - return view('auth.login', compact('allowRegistration', 'email', 'remember'))->withCookie($cookie); + return view('auth.login', compact('allowRegistration', 'email', 'remember')); } } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 0a4df46b9d..7125a0de68 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - /** * RegisterController.php * Copyright (c) 2017 thegrumpydictator@gmail.com @@ -66,7 +64,6 @@ class RegisterController extends Controller /** * Create a new controller instance. - * */ public function __construct() { @@ -77,7 +74,7 @@ class RegisterController extends Controller /** * Handle a registration request for the application. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request * * @return \Illuminate\Http\Response */ @@ -86,7 +83,7 @@ class RegisterController extends Controller // is allowed to? $singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $userCount = User::count(); - if ($singleUserMode === true && $userCount > 0) { + if (true === $singleUserMode && $userCount > 0) { $message = 'Registration is currently not available.'; return view('error', compact('message')); @@ -119,7 +116,7 @@ class RegisterController extends Controller // is allowed to? $singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $userCount = User::count(); - if ($singleUserMode === true && $userCount > 0) { + if (true === $singleUserMode && $userCount > 0) { $message = 'Registration is currently not available.'; return view('error', compact('message')); @@ -127,14 +124,13 @@ class RegisterController extends Controller $email = $request->old('email'); - return view('auth.register', compact('isDemoSite', 'email')); } /** * Create a new user instance after a valid registration. * - * @param array $data + * @param array $data * * @return \FireflyIII\User */ @@ -151,17 +147,18 @@ class RegisterController extends Controller /** * Get a validator for an incoming registration request. * - * @param array $data + * @param array $data * * @return \Illuminate\Contracts\Validation\Validator */ protected function validator(array $data) { return Validator::make( - $data, [ - 'email' => 'required|string|email|max:255|unique:users', - 'password' => 'required|string|secure_password|confirmed', - ] + $data, + [ + 'email' => 'required|string|email|max:255|unique:users', + 'password' => 'required|string|secure_password|confirmed', + ] ); } } diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index 60913a0822..9009af2485 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - /** * ResetPasswordController.php * Copyright (c) 2017 thegrumpydictator@gmail.com @@ -60,7 +58,6 @@ class ResetPasswordController extends Controller /** * Create a new controller instance. - * */ public function __construct() { diff --git a/app/Http/Controllers/Auth/TwoFactorController.php b/app/Http/Controllers/Auth/TwoFactorController.php index 573104a91c..a4cd2711de 100644 --- a/app/Http/Controllers/Auth/TwoFactorController.php +++ b/app/Http/Controllers/Auth/TwoFactorController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Auth; @@ -32,38 +31,35 @@ use Log; use Preferences; /** - * Class TwoFactorController - * - * @package FireflyIII\Http\Controllers\Auth + * Class TwoFactorController. */ class TwoFactorController extends Controller { - /** * @param Request $request * * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View + * * @throws FireflyException * * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function index(Request $request) { - $user = auth()->user(); // to make sure the validator in the next step gets the secret, we push it in session $secretPreference = Preferences::get('twoFactorAuthSecret', null); - $secret = is_null($secretPreference) ? null : $secretPreference->data; + $secret = null === $secretPreference ? null : $secretPreference->data; $title = strval(trans('firefly.two_factor_title')); // make sure the user has two factor configured: $has2FA = Preferences::get('twoFactorAuthEnabled', false)->data; - if (is_null($has2FA) || $has2FA === false) { + if (null === $has2FA || false === $has2FA) { return redirect(route('index')); } - if (strlen(strval($secret)) === 0) { + if (0 === strlen(strval($secret))) { throw new FireflyException('Your two factor authentication secret is empty, which it cannot be at this point. Please check the log files.'); } $request->session()->flash('two-factor-secret', $secret); @@ -73,6 +69,7 @@ class TwoFactorController extends Controller /** * @return mixed + * * @throws FireflyException */ public function lostTwoFactor() @@ -96,14 +93,24 @@ class TwoFactorController extends Controller * * @return mixed * @SuppressWarnings(PHPMD.UnusedFormalParameter) // it's unused but the class does some validation. - * */ public function postIndex(TokenFormRequest $request, CookieJar $cookieJar) { - // set cookie! - $cookie = $cookieJar->forever('twoFactorAuthenticated', 'true'); + // wants to remember session? + $remember = $request->session()->get('remember_login') ?? false; + + $minutes = config('session.lifetime'); + if (true === $remember) { + // set cookie with a long lifetime (30 days) + $minutes = 43200; + } + $cookie = $cookieJar->make( + 'twoFactorAuthenticated', 'true', $minutes, config('session.path'), config('session.domain'), config('session.secure'), config('session.http_only') + ); + + // whatever the case, forget about it: + $request->session()->forget('remember_login'); return redirect(route('home'))->withCookie($cookie); } - } diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php index ae365001eb..9a61d149f7 100644 --- a/app/Http/Controllers/BillController.php +++ b/app/Http/Controllers/BillController.php @@ -18,15 +18,16 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; use Carbon\Carbon; +use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Helpers\Collector\JournalCollectorInterface; use FireflyIII\Http\Requests\BillFormRequest; use FireflyIII\Models\Bill; +use FireflyIII\Models\Note; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use Illuminate\Http\Request; @@ -36,12 +37,12 @@ use URL; use View; /** - * Class BillController - * - * @package FireflyIII\Http\Controllers + * Class BillController. */ class BillController extends Controller { + /** @var AttachmentHelperInterface Helper for attachments. */ + private $attachments; /** * @@ -50,11 +51,16 @@ class BillController extends Controller { parent::__construct(); + $maxFileSize = app('steam')->phpBytes(ini_get('upload_max_filesize')); + $maxPostSize = app('steam')->phpBytes(ini_get('post_max_size')); + $uploadSize = min($maxFileSize, $maxPostSize); + View::share('uploadSize', $uploadSize); $this->middleware( function ($request, $next) { View::share('title', trans('firefly.bills')); View::share('mainTitleIcon', 'fa-calendar-o'); + $this->attachments = app(AttachmentHelperInterface::class); return $next($request); } @@ -74,9 +80,8 @@ class BillController extends Controller } $subTitle = trans('firefly.create_new_bill'); - // put previous url in session if not redirect from store (not "create another"). - if (session('bills.create.fromStore') !== true) { + if (true !== session('bills.create.fromStore')) { $this->rememberPreviousUri('bills.create.uri'); } $request->session()->forget('bills.create.fromStore'); @@ -136,7 +141,7 @@ class BillController extends Controller $subTitle = trans('firefly.edit_bill', ['name' => $bill->name]); // put previous url in session if not redirect from store (not "return_to_edit"). - if (session('bills.edit.fromUpdate') !== true) { + if (true !== session('bills.edit.fromUpdate')) { $this->rememberPreviousUri('bills.edit.uri'); } @@ -144,6 +149,18 @@ class BillController extends Controller $bill->amount_min = round($bill->amount_min, $currency->decimal_places); $bill->amount_max = round($bill->amount_max, $currency->decimal_places); + $preFilled = [ + 'notes' => '', + ]; + + /** @var Note $note */ + $note = $bill->notes()->first(); + if (null !== $note) { + $preFilled['notes'] = $note->text; + } + + $request->session()->flash('preFilled', $preFilled); + $request->session()->forget('bills.edit.fromUpdate'); $request->session()->flash('gaEventCategory', 'bills'); $request->session()->flash('gaEventAction', 'edit'); @@ -166,7 +183,6 @@ class BillController extends Controller $bills = $repository->getBills(); $bills->each( function (Bill $bill) use ($repository, $start, $end) { - // paid in this period? $bill->paidDates = $repository->getPaidDatesInRange($bill, $start, $end); $bill->payDates = $repository->getPayDatesInRange($bill, $start, $end); @@ -190,7 +206,7 @@ class BillController extends Controller */ public function rescan(Request $request, BillRepositoryInterface $repository, Bill $bill) { - if (intval($bill->active) === 0) { + if (0 === intval($bill->active)) { $request->session()->flash('warning', strval(trans('firefly.cannot_scan_inactive_bill'))); return redirect(URL::previous()); @@ -202,7 +218,6 @@ class BillController extends Controller $repository->scan($bill, $journal); } - $request->session()->flash('success', strval(trans('firefly.rescanned_bill'))); Preferences::mark(); @@ -231,14 +246,14 @@ class BillController extends Controller $collector = app(JournalCollectorInterface::class); $collector->setAllAssetAccounts()->setBills(new Collection([$bill]))->setLimit($pageSize)->setPage($page)->withBudgetInformation() ->withCategoryInformation(); - $journals = $collector->getPaginatedJournals(); - $journals->setPath(route('bills.show', [$bill->id])); + $transactions = $collector->getPaginatedJournals(); + $transactions->setPath(route('bills.show', [$bill->id])); $bill->nextExpectedMatch = $repository->nextExpectedMatch($bill, new Carbon); $hideBill = true; $subTitle = e($bill->name); - return view('bills.show', compact('journals', 'yearAverage', 'overallAverage', 'year', 'hideBill', 'bill', 'subTitle')); + return view('bills.show', compact('transactions', 'yearAverage', 'overallAverage', 'year', 'hideBill', 'bill', 'subTitle')); } /** @@ -254,7 +269,17 @@ class BillController extends Controller $request->session()->flash('success', strval(trans('firefly.stored_new_bill', ['name' => $bill->name]))); Preferences::mark(); - if (intval($request->get('create_another')) === 1) { + + /** @var array $files */ + $files = $request->hasFile('attachments') ? $request->file('attachments') : null; + $this->attachments->saveAttachmentsForModel($bill, $files); + + // flash messages + if (count($this->attachments->getMessages()->get('attachments')) > 0) { + $request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); + } + + if (1 === intval($request->get('create_another'))) { // @codeCoverageIgnoreStart $request->session()->put('bills.create.fromStore', true); @@ -264,7 +289,6 @@ class BillController extends Controller // redirect to previous URL. return redirect($this->getPreviousUri('bills.create.uri')); - } /** @@ -282,7 +306,16 @@ class BillController extends Controller $request->session()->flash('success', strval(trans('firefly.updated_bill', ['name' => $bill->name]))); Preferences::mark(); - if (intval($request->get('return_to_edit')) === 1) { + /** @var array $files */ + $files = $request->hasFile('attachments') ? $request->file('attachments') : null; + $this->attachments->saveAttachmentsForModel($bill, $files); + + // flash messages + if (count($this->attachments->getMessages()->get('attachments')) > 0) { + $request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); + } + + if (1 === intval($request->get('return_to_edit'))) { // @codeCoverageIgnoreStart $request->session()->put('bills.edit.fromUpdate', true); @@ -291,7 +324,5 @@ class BillController extends Controller } return redirect($this->getPreviousUri('bills.edit.uri')); - } - } diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php index 34e6ff5ef3..019d95a7f3 100644 --- a/app/Http/Controllers/BudgetController.php +++ b/app/Http/Controllers/BudgetController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -44,16 +43,14 @@ use Response; use View; /** - * Class BudgetController + * Class BudgetController. * - * @package FireflyIII\Http\Controllers * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.TooManyPublicMethods) */ class BudgetController extends Controller { - - /** @var BudgetRepositoryInterface */ + /** @var BudgetRepositoryInterface */ private $repository; /** @@ -82,19 +79,24 @@ class BudgetController extends Controller * * @return \Illuminate\Http\JsonResponse */ - public function amount(Request $request, Budget $budget) + public function amount(Request $request, BudgetRepositoryInterface $repository, Budget $budget) { - $amount = intval($request->get('amount')); + $amount = strval($request->get('amount')); $start = Carbon::createFromFormat('Y-m-d', $request->get('start')); $end = Carbon::createFromFormat('Y-m-d', $request->get('end')); $budgetLimit = $this->repository->updateLimitAmount($budget, $start, $end, $amount); - if ($amount === 0) { + if (bccomp($amount,'0') === 0) { $budgetLimit = null; } + + // calculate left in budget: + $spent = $repository->spentInPeriod(new Collection([$budget]), new Collection, $start, $end); + $currency = app('amount')->getDefaultCurrency(); + $left = app('amount')->formatAnything($currency, bcadd($amount, $spent), true); + Preferences::mark(); - return Response::json(['name' => $budget->name, 'limit' => $budgetLimit ? $budgetLimit->id : 0, 'amount' => $amount]); - + return Response::json(['left' => $left, 'name' => $budget->name, 'limit' => $budgetLimit ? $budgetLimit->id : 0, 'amount' => $amount]); } /** @@ -105,7 +107,7 @@ class BudgetController extends Controller public function create(Request $request) { // put previous url in session if not redirect from store (not "create another"). - if (session('budgets.create.fromStore') !== true) { + if (true !== session('budgets.create.fromStore')) { $this->rememberPreviousUri('budgets.create.uri'); } $request->session()->forget('budgets.create.fromStore'); @@ -142,7 +144,6 @@ class BudgetController extends Controller */ public function destroy(Request $request, Budget $budget) { - $name = $budget->name; $this->repository->destroy($budget); $request->session()->flash('success', strval(trans('firefly.deleted_budget', ['name' => $name]))); @@ -162,7 +163,7 @@ class BudgetController extends Controller $subTitle = trans('firefly.edit_budget', ['name' => $budget->name]); // put previous url in session if not redirect from store (not "return_to_edit"). - if (session('budgets.edit.fromUpdate') !== true) { + if (true !== session('budgets.edit.fromUpdate')) { $this->rememberPreviousUri('budgets.edit.uri'); } $request->session()->forget('budgets.edit.fromUpdate'); @@ -170,7 +171,6 @@ class BudgetController extends Controller $request->session()->flash('gaEventAction', 'edit'); return view('budgets.edit', compact('budget', 'subTitle')); - } /** @@ -188,7 +188,7 @@ class BudgetController extends Controller $end = session('end', new Carbon); // make date if present: - if (!is_null($moment) || strlen(strval($moment)) !== 0) { + if (null !== $moment || 0 !== strlen(strval($moment))) { try { $start = new Carbon($moment); $end = Navigation::endOfPeriod($start, $range); @@ -221,7 +221,7 @@ class BudgetController extends Controller $previousDate = Navigation::startOfPeriod($previousDate, $range); $format = $previousDate->format('Y-m-d'); $previousLoop[$format] = Navigation::periodShow($previousDate, $range); - $count++; + ++$count; } // select thing for next 12 periods: @@ -234,7 +234,7 @@ class BudgetController extends Controller $format = $nextDate->format('Y-m-d'); $nextLoop[$format] = Navigation::periodShow($nextDate, $range); $nextDate = Navigation::endOfPeriod($nextDate, $range); - $count++; + ++$count; $nextDate->addDay(); } @@ -246,9 +246,23 @@ class BudgetController extends Controller return view( 'budgets.index', compact( - 'available', 'currentMonth', 'next', 'nextText', 'prev', 'prevText', - 'periodStart', 'periodEnd', 'budgetInformation', 'inactive', 'budgets', - 'spent', 'budgeted', 'previousLoop', 'nextLoop', 'start', 'end' + 'available', + 'currentMonth', + 'next', + 'nextText', + 'prev', + 'prevText', + 'periodStart', + 'periodEnd', + 'budgetInformation', + 'inactive', + 'budgets', + 'spent', + 'budgeted', + 'previousLoop', + 'nextLoop', + 'start', + 'end' ) ); } @@ -290,7 +304,7 @@ class BudgetController extends Controller $currentEnd = Navigation::endOfPeriod($currentStart, $range); $total = bcadd($total, $this->repository->getAvailableBudget($currency, $currentStart, $currentEnd)); $currentStart = Navigation::addPeriod($currentStart, $range, 0); - $count++; + ++$count; } $result['available'] = bcdiv($total, strval($count)); @@ -309,12 +323,11 @@ class BudgetController extends Controller $result['spent'] = bcdiv(strval($collector->getJournals()->sum('transaction_amount')), strval($count)); // suggestion starts with the amount spent $result['suggested'] = bcmul($result['spent'], '-1'); - $result['suggested'] = bccomp($result['suggested'], $result['earned']) === 1 ? $result['earned'] : $result['suggested']; + $result['suggested'] = 1 === bccomp($result['suggested'], $result['earned']) ? $result['earned'] : $result['suggested']; // unless it's more than you earned. So min() of suggested/earned $cache->store($result); - return view('budgets.info', compact('result', 'begin', 'currentEnd')); } @@ -337,7 +350,7 @@ class BudgetController extends Controller $periods = new Collection; // prep for "all" view. - if ($moment === 'all') { + if ('all' === $moment) { $subTitle = trans('firefly.all_journals_without_budget'); $first = $repository->first(); $start = $first->date ?? new Carbon; @@ -345,7 +358,7 @@ class BudgetController extends Controller } // prep for "specific date" view. - if (strlen($moment) > 0 && $moment !== 'all') { + if (strlen($moment) > 0 && 'all' !== $moment) { $start = new Carbon($moment); $end = Navigation::endOfPeriod($start, $range); $subTitle = trans( @@ -356,7 +369,7 @@ class BudgetController extends Controller } // prep for current period - if (strlen($moment) === 0) { + if (0 === strlen($moment)) { $start = clone session('start', Navigation::startOfPeriod(new Carbon, $range)); $end = clone session('end', Navigation::endOfPeriod(new Carbon, $range)); $periods = $this->getPeriodOverview(); @@ -373,10 +386,10 @@ class BudgetController extends Controller $collector = app(JournalCollectorInterface::class); $collector->setAllAssetAccounts()->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setLimit($pageSize)->setPage($page) ->withoutBudget()->withOpposingAccount(); - $journals = $collector->getPaginatedJournals(); - $journals->setPath(route('budgets.no-budget')); + $transactions = $collector->getPaginatedJournals(); + $transactions->setPath(route('budgets.no-budget')); - return view('budgets.no-budget', compact('journals', 'subTitle', 'moment', 'periods', 'start', 'end')); + return view('budgets.no-budget', compact('transactions', 'subTitle', 'moment', 'periods', 'start', 'end')); } /** @@ -416,13 +429,12 @@ class BudgetController extends Controller /** @var JournalCollectorInterface $collector */ $collector = app(JournalCollectorInterface::class); $collector->setAllAssetAccounts()->setRange($start, $end)->setBudget($budget)->setLimit($pageSize)->setPage($page)->withBudgetInformation(); - $journals = $collector->getPaginatedJournals(); - $journals->setPath(route('budgets.show', [$budget->id])); - + $transactions = $collector->getPaginatedJournals(); + $transactions->setPath(route('budgets.show', [$budget->id])); $subTitle = trans('firefly.all_journals_for_budget', ['name' => $budget->name]); - return view('budgets.show', compact('limits', 'budget', 'repetition', 'journals', 'subTitle')); + return view('budgets.show', compact('limits', 'budget', 'repetition', 'transactions', 'subTitle')); } /** @@ -431,6 +443,7 @@ class BudgetController extends Controller * @param BudgetLimit $budgetLimit * * @return View + * * @throws FireflyException */ public function showByBudgetLimit(Request $request, Budget $budget, BudgetLimit $budgetLimit) @@ -442,11 +455,12 @@ class BudgetController extends Controller $page = intval($request->get('page')); $pageSize = intval(Preferences::get('transactionPageSize', 50)->data); $subTitle = trans( - 'firefly.budget_in_period', [ - 'name' => $budget->name, - 'start' => $budgetLimit->start_date->formatLocalized($this->monthAndDayFormat), - 'end' => $budgetLimit->end_date->formatLocalized($this->monthAndDayFormat), - ] + 'firefly.budget_in_period', + [ + 'name' => $budget->name, + 'start' => $budgetLimit->start_date->formatLocalized($this->monthAndDayFormat), + 'end' => $budgetLimit->end_date->formatLocalized($this->monthAndDayFormat), + ] ); // collector: @@ -454,14 +468,13 @@ class BudgetController extends Controller $collector = app(JournalCollectorInterface::class); $collector->setAllAssetAccounts()->setRange($budgetLimit->start_date, $budgetLimit->end_date) ->setBudget($budget)->setLimit($pageSize)->setPage($page)->withBudgetInformation(); - $journals = $collector->getPaginatedJournals(); - $journals->setPath(route('budgets.show', [$budget->id, $budgetLimit->id])); + $transactions = $collector->getPaginatedJournals(); + $transactions->setPath(route('budgets.show', [$budget->id, $budgetLimit->id])); $start = session('first', Carbon::create()->startOfYear()); $end = new Carbon; $limits = $this->getLimits($budget, $start, $end); - return view('budgets.show', compact('limits', 'budget', 'budgetLimit', 'journals', 'subTitle')); - + return view('budgets.show', compact('limits', 'budget', 'budgetLimit', 'transactions', 'subTitle')); } /** @@ -477,7 +490,7 @@ class BudgetController extends Controller $request->session()->flash('success', strval(trans('firefly.stored_new_budget', ['name' => $budget->name]))); Preferences::mark(); - if (intval($request->get('create_another')) === 1) { + if (1 === intval($request->get('create_another'))) { // @codeCoverageIgnoreStart $request->session()->put('budgets.create.fromStore', true); @@ -502,7 +515,7 @@ class BudgetController extends Controller $request->session()->flash('success', strval(trans('firefly.updated_budget', ['name' => $budget->name]))); Preferences::mark(); - if (intval($request->get('return_to_edit')) === 1) { + if (1 === intval($request->get('return_to_edit'))) { // @codeCoverageIgnoreStart $request->session()->put('budgets.edit.fromUpdate', true); @@ -594,12 +607,11 @@ class BudgetController extends Controller $journals = $set->count(); $dateStr = $end->format('Y-m-d'); $dateName = Navigation::periodShow($end, $range); - $entries->push(['string' => $dateStr, 'name' => $dateName, 'count' => $journals, 'sum' => $sum, 'date' => clone $end,]); + $entries->push(['string' => $dateStr, 'name' => $dateName, 'count' => $journals, 'sum' => $sum, 'date' => clone $end]); $end = Navigation::subtractPeriod($end, $range, 1); } $cache->store($entries); return $entries; } - } diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 3fad48e139..1ea9509027 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -43,13 +42,10 @@ use Steam; use View; /** - * Class CategoryController - * - * @package FireflyIII\Http\Controllers + * Class CategoryController. */ class CategoryController extends Controller { - /** * */ @@ -57,7 +53,6 @@ class CategoryController extends Controller { parent::__construct(); - $this->middleware( function ($request, $next) { View::share('title', trans('firefly.categories')); @@ -75,7 +70,7 @@ class CategoryController extends Controller */ public function create(Request $request) { - if (session('categories.create.fromStore') !== true) { + if (true !== session('categories.create.fromStore')) { $this->rememberPreviousUri('categories.create.uri'); } $request->session()->forget('categories.create.fromStore'); @@ -104,7 +99,6 @@ class CategoryController extends Controller return view('categories.delete', compact('category', 'subTitle')); } - /** * @param Request $request * @param CategoryRepositoryInterface $repository @@ -114,7 +108,6 @@ class CategoryController extends Controller */ public function destroy(Request $request, CategoryRepositoryInterface $repository, Category $category) { - $name = $category->name; $repository->destroy($category); @@ -135,7 +128,7 @@ class CategoryController extends Controller $subTitle = trans('firefly.edit_category', ['name' => $category->name]); // put previous url in session if not redirect from store (not "return_to_edit"). - if (session('categories.edit.fromUpdate') !== true) { + if (true !== session('categories.edit.fromUpdate')) { $this->rememberPreviousUri('categories.edit.uri'); } $request->session()->forget('categories.edit.fromUpdate'); @@ -143,7 +136,6 @@ class CategoryController extends Controller $request->session()->flash('gaEventAction', 'edit'); return view('categories.edit', compact('category', 'subTitle')); - } /** @@ -182,7 +174,7 @@ class CategoryController extends Controller $pageSize = intval(Preferences::get('transactionPageSize', 50)->data); // prep for "all" view. - if ($moment === 'all') { + if ('all' === $moment) { $subTitle = trans('firefly.all_journals_without_category'); $first = $repository->first(); $start = $first->date ?? new Carbon; @@ -190,7 +182,7 @@ class CategoryController extends Controller } // prep for "specific date" view. - if (strlen($moment) > 0 && $moment !== 'all') { + if (strlen($moment) > 0 && 'all' !== $moment) { $start = new Carbon($moment); $end = Navigation::endOfPeriod($start, $range); $subTitle = trans( @@ -201,7 +193,7 @@ class CategoryController extends Controller } // prep for current period - if (strlen($moment) === 0) { + if (0 === strlen($moment)) { $start = clone session('start', Navigation::startOfPeriod(new Carbon, $range)); $end = clone session('end', Navigation::endOfPeriod(new Carbon, $range)); $periods = $this->getNoCategoryPeriodOverview(); @@ -211,16 +203,15 @@ class CategoryController extends Controller ); } - /** @var JournalCollectorInterface $collector */ $collector = app(JournalCollectorInterface::class); $collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withoutCategory()->withOpposingAccount() ->setTypes([TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER]); $collector->removeFilter(InternalTransferFilter::class); - $journals = $collector->getPaginatedJournals(); - $journals->setPath(route('categories.no-category')); + $transactions = $collector->getPaginatedJournals(); + $transactions->setPath(route('categories.no-category')); - return view('categories.no-category', compact('journals', 'subTitle', 'moment', 'periods', 'start', 'end')); + return view('categories.no-category', compact('transactions', 'subTitle', 'moment', 'periods', 'start', 'end')); } /** @@ -244,28 +235,28 @@ class CategoryController extends Controller $periods = new Collection; // prep for "all" view. - if ($moment === 'all') { + if ('all' === $moment) { $subTitle = trans('firefly.all_journals_for_category', ['name' => $category->name]); $first = $repository->firstUseDate($category); /** @var Carbon $start */ - $start = is_null($first) ? new Carbon : $first; + $start = null === $first ? new Carbon : $first; $end = new Carbon; } // prep for "specific date" view. - if (strlen($moment) > 0 && $moment !== 'all') { + if (strlen($moment) > 0 && 'all' !== $moment) { $start = new Carbon($moment); $end = Navigation::endOfPeriod($start, $range); $subTitle = trans( 'firefly.journals_in_period_for_category', ['name' => $category->name, - 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)] + 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat),] ); $periods = $this->getPeriodOverview($category); } // prep for current period - if (strlen($moment) === 0) { + if (0 === strlen($moment)) { /** @var Carbon $start */ $start = clone session('start', Navigation::startOfPeriod(new Carbon, $range)); /** @var Carbon $end */ @@ -274,7 +265,7 @@ class CategoryController extends Controller $subTitle = trans( 'firefly.journals_in_period_for_category', ['name' => $category->name, 'start' => $start->formatLocalized($this->monthAndDayFormat), - 'end' => $end->formatLocalized($this->monthAndDayFormat)] + 'end' => $end->formatLocalized($this->monthAndDayFormat),] ); } @@ -283,14 +274,12 @@ class CategoryController extends Controller $collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withOpposingAccount() ->setCategory($category)->withBudgetInformation()->withCategoryInformation(); $collector->removeFilter(InternalTransferFilter::class); - $journals = $collector->getPaginatedJournals(); - $journals->setPath(route('categories.show', [$category->id])); + $transactions = $collector->getPaginatedJournals(); + $transactions->setPath(route('categories.show', [$category->id])); - - return view('categories.show', compact('category', 'moment', 'journals', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end')); + return view('categories.show', compact('category', 'moment', 'transactions', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end')); } - /** * @param CategoryFormRequest $request * @param CategoryRepositoryInterface $repository @@ -305,7 +294,7 @@ class CategoryController extends Controller $request->session()->flash('success', strval(trans('firefly.stored_category', ['name' => $category->name]))); Preferences::mark(); - if (intval($request->get('create_another')) === 1) { + if (1 === intval($request->get('create_another'))) { // @codeCoverageIgnoreStart $request->session()->put('categories.create.fromStore', true); @@ -316,7 +305,6 @@ class CategoryController extends Controller return redirect(route('categories.index')); } - /** * @param CategoryFormRequest $request * @param CategoryRepositoryInterface $repository @@ -332,7 +320,7 @@ class CategoryController extends Controller $request->session()->flash('success', strval(trans('firefly.updated_category', ['name' => $category->name]))); Preferences::mark(); - if (intval($request->get('return_to_edit')) === 1) { + if (1 === intval($request->get('return_to_edit'))) { // @codeCoverageIgnoreStart $request->session()->put('categories.edit.fromUpdate', true); @@ -434,7 +422,7 @@ class CategoryController extends Controller $accountRepository = app(AccountRepositoryInterface::class); $accounts = $accountRepository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]); $first = $repository->firstUseDate($category); - if (is_null($first)) { + if (null === $first) { $first = new Carbon; } $range = Preferences::get('viewRange', '1M')->data; @@ -481,11 +469,10 @@ class CategoryController extends Controller ] ); $end = Navigation::subtractPeriod($end, $range, 1); - $count++; + ++$count; } $cache->store($entries); return $entries; } - } diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php index 182d472fa3..a814be6e1b 100644 --- a/app/Http/Controllers/Chart/AccountController.php +++ b/app/Http/Controllers/Chart/AccountController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Chart; @@ -45,14 +44,11 @@ use Response; use Steam; /** checked - * Class AccountController - * - * @package FireflyIII\Http\Controllers\Chart + * Class AccountController. */ class AccountController extends Controller { - - /** @var GeneratorInterface */ + /** @var GeneratorInterface */ protected $generator; /** @@ -133,7 +129,7 @@ class AccountController extends Controller $startBalance = $startBalances[$id] ?? '0'; $endBalance = $endBalances[$id] ?? '0'; $diff = bcsub($endBalance, $startBalance); - if (bccomp($diff, '0') !== 0) { + if (0 !== bccomp($diff, '0')) { $chartData[$account->name] = $diff; } } @@ -243,7 +239,6 @@ class AccountController extends Controller $cache->store($data); return Response::json($data); - } /** @@ -275,7 +270,7 @@ class AccountController extends Controller Log::debug('Default set is ', $defaultSet); $frontPage = Preferences::get('frontPageAccounts', $defaultSet); Log::debug('Frontpage preference set is ', $frontPage->data); - if (count($frontPage->data) === 0) { + if (0 === count($frontPage->data)) { $frontPage->data = $defaultSet; Log::debug('frontpage set is empty!'); $frontPage->save(); @@ -326,7 +321,6 @@ class AccountController extends Controller $cache->store($data); return Response::json($data); - } /** @@ -348,6 +342,7 @@ class AccountController extends Controller * @param Carbon $start * * @return \Illuminate\Http\JsonResponse + * * @throws FireflyException */ public function period(Account $account, Carbon $start) @@ -429,7 +424,7 @@ class AccountController extends Controller $endBalance = $endBalances[$id] ?? '0'; $diff = bcsub($endBalance, $startBalance); $diff = bcmul($diff, '-1'); - if (bccomp($diff, '0') !== 0) { + if (0 !== bccomp($diff, '0')) { $chartData[$account->name] = $diff; } } @@ -541,7 +536,6 @@ class AccountController extends Controller */ private function getBudgetNames(array $budgetIds): array { - /** @var BudgetRepositoryInterface $repository */ $repository = app(BudgetRepositoryInterface::class); $budgets = $repository->getBudgets(); @@ -580,5 +574,4 @@ class AccountController extends Controller return $return; } - } diff --git a/app/Http/Controllers/Chart/BillController.php b/app/Http/Controllers/Chart/BillController.php index f81f761686..34e0ca9641 100644 --- a/app/Http/Controllers/Chart/BillController.php +++ b/app/Http/Controllers/Chart/BillController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Chart; @@ -35,18 +34,15 @@ use Illuminate\Support\Collection; use Response; /** - * Class BillController - * - * @package FireflyIII\Http\Controllers\Chart + * Class BillController. */ class BillController extends Controller { - /** @var GeneratorInterface */ protected $generator; /** - * checked + * checked. */ public function __construct() { @@ -108,9 +104,9 @@ class BillController extends Controller } ); $chartData = [ - ['type' => 'bar', 'label' => trans('firefly.min-amount'), 'entries' => [],], - ['type' => 'bar', 'label' => trans('firefly.max-amount'), 'entries' => [],], - ['type' => 'line', 'label' => trans('firefly.journal-amount'), 'entries' => [],], + ['type' => 'bar', 'label' => trans('firefly.min-amount'), 'entries' => []], + ['type' => 'bar', 'label' => trans('firefly.max-amount'), 'entries' => []], + ['type' => 'line', 'label' => trans('firefly.journal-amount'), 'entries' => []], ]; /** @var Transaction $entry */ diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php index a29d0aabda..0fbc20571a 100644 --- a/app/Http/Controllers/Chart/BudgetController.php +++ b/app/Http/Controllers/Chart/BudgetController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Chart; @@ -44,19 +43,16 @@ use Response; use Steam; /** - * Class BudgetController + * Class BudgetController. * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) // can't realy be helped. - * - * @package FireflyIII\Http\Controllers\Chart */ class BudgetController extends Controller { - /** @var GeneratorInterface */ protected $generator; - /** @var BudgetRepositoryInterface */ + /** @var BudgetRepositoryInterface */ protected $repository; /** @@ -77,7 +73,6 @@ class BudgetController extends Controller } /** - * * @param Budget $budget * * @return \Symfony\Component\HttpFoundation\Response @@ -94,7 +89,7 @@ class BudgetController extends Controller $cache->addProperty('chart.budget.budget'); if ($cache->has()) { - return Response::json($cache->get()); // @codeCoverageIgnore + return Response::json($cache->get()); // @codeCoverageIgnore } $final = clone $last; @@ -125,10 +120,12 @@ class BudgetController extends Controller * Shows the amount left in a specific budget limit. * * @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly five. + * * @param Budget $budget * @param BudgetLimit $budgetLimit * * @return \Symfony\Component\HttpFoundation\Response + * * @throws FireflyException */ public function budgetLimit(Budget $budget, BudgetLimit $budgetLimit) @@ -185,7 +182,7 @@ class BudgetController extends Controller /** @var JournalCollectorInterface $collector */ $collector = app(JournalCollectorInterface::class); $collector->setAllAssetAccounts()->setBudget($budget); - if (!is_null($budgetLimit->id)) { + if (null !== $budgetLimit->id) { $collector->setRange($budgetLimit->start_date, $budgetLimit->end_date); } @@ -208,7 +205,6 @@ class BudgetController extends Controller $cache->store($data); return Response::json($data); - } /** @@ -230,7 +226,7 @@ class BudgetController extends Controller /** @var JournalCollectorInterface $collector */ $collector = app(JournalCollectorInterface::class); $collector->setAllAssetAccounts()->setBudget($budget)->withCategoryInformation(); - if (!is_null($budgetLimit->id)) { + if (null !== $budgetLimit->id) { $collector->setRange($budgetLimit->start_date, $budgetLimit->end_date); } @@ -255,7 +251,6 @@ class BudgetController extends Controller $cache->store($data); return Response::json($data); - } /** @@ -277,7 +272,7 @@ class BudgetController extends Controller /** @var JournalCollectorInterface $collector */ $collector = app(JournalCollectorInterface::class); $collector->setAllAssetAccounts()->setTypes([TransactionType::WITHDRAWAL])->setBudget($budget)->withOpposingAccount(); - if (!is_null($budgetLimit->id)) { + if (null !== $budgetLimit->id) { $collector->setRange($budgetLimit->start_date, $budgetLimit->end_date); } @@ -301,11 +296,11 @@ class BudgetController extends Controller $cache->store($data); return Response::json($data); - } /** * Shows a budget list with spent/left/overspent. + * * @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly five. * @SuppressWarnings(PHPMD.ExcessiveMethodLength) // 46 lines, I'm fine with this. * @@ -325,9 +320,9 @@ class BudgetController extends Controller } $budgets = $this->repository->getActiveBudgets(); $chartData = [ - ['label' => strval(trans('firefly.spent_in_budget')), 'entries' => [], 'type' => 'bar',], - ['label' => strval(trans('firefly.left_to_spend')), 'entries' => [], 'type' => 'bar',], - ['label' => strval(trans('firefly.overspent')), 'entries' => [], 'type' => 'bar',], + ['label' => strval(trans('firefly.spent_in_budget')), 'entries' => [], 'type' => 'bar'], + ['label' => strval(trans('firefly.left_to_spend')), 'entries' => [], 'type' => 'bar'], + ['label' => strval(trans('firefly.overspent')), 'entries' => [], 'type' => 'bar'], ]; /** @var Budget $budget */ @@ -345,7 +340,7 @@ class BudgetController extends Controller // for no budget: $spent = $this->spentInPeriodWithout($start, $end); $name = strval(trans('firefly.no_budget')); - if (bccomp($spent, '0') !== 0) { + if (0 !== bccomp($spent, '0')) { $chartData[0]['entries'][$name] = bcmul($spent, '-1'); $chartData[1]['entries'][$name] = '0'; $chartData[2]['entries'][$name] = '0'; @@ -357,7 +352,6 @@ class BudgetController extends Controller return Response::json($data); } - /** * @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly five. * @@ -386,8 +380,8 @@ class BudgetController extends Controller // join them into one set of data: $chartData = [ - ['label' => strval(trans('firefly.spent')), 'type' => 'bar', 'entries' => [],], - ['label' => strval(trans('firefly.budgeted')), 'type' => 'bar', 'entries' => [],], + ['label' => strval(trans('firefly.spent')), 'type' => 'bar', 'entries' => []], + ['label' => strval(trans('firefly.budgeted')), 'type' => 'bar', 'entries' => []], ]; foreach (array_keys($periods) as $period) { @@ -512,7 +506,6 @@ class BudgetController extends Controller } /** - * * @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's 6 but ok. * * @param Collection $limits @@ -525,9 +518,9 @@ class BudgetController extends Controller private function getExpensesForBudget(Collection $limits, Budget $budget, Carbon $start, Carbon $end): array { $return = []; - if ($limits->count() === 0) { + if (0 === $limits->count()) { $spent = $this->repository->spentInPeriod(new Collection([$budget]), new Collection, $start, $end); - if (bccomp($spent, '0') !== 0) { + if (0 !== bccomp($spent, '0')) { $return[$budget->name]['spent'] = bcmul($spent, '-1'); $return[$budget->name]['left'] = 0; $return[$budget->name]['overspent'] = 0; @@ -538,7 +531,7 @@ class BudgetController extends Controller $rows = $this->spentInPeriodMulti($budget, $limits); foreach ($rows as $name => $row) { - if (bccomp($row['spent'], '0') !== 0 || bccomp($row['left'], '0') !== 0) { + if (0 !== bccomp($row['spent'], '0') || 0 !== bccomp($row['left'], '0')) { $return[$name] = $row; } } @@ -610,7 +603,7 @@ class BudgetController extends Controller * 'name' => "no budget" in local language * 'repetition_left' => left in budget repetition (always zero) * 'repetition_overspent' => spent more than budget repetition? (always zero) - * 'spent' => actually spent in period for budget + * 'spent' => actually spent in period for budget. * * @param Carbon $start * @param Carbon $end diff --git a/app/Http/Controllers/Chart/BudgetReportController.php b/app/Http/Controllers/Chart/BudgetReportController.php index 517ec450ef..60ee052df1 100644 --- a/app/Http/Controllers/Chart/BudgetReportController.php +++ b/app/Http/Controllers/Chart/BudgetReportController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Chart; - use Carbon\Carbon; use FireflyIII\Generator\Chart\Basic\GeneratorInterface; use FireflyIII\Helpers\Chart\MetaPieChartInterface; @@ -46,15 +44,12 @@ use Response; * Separate controller because many helper functions are shared. * * Class BudgetReportController - * - * @package FireflyIII\Http\Controllers\Chart */ class BudgetReportController extends Controller { - /** @var BudgetRepositoryInterface */ private $budgetRepository; - /** @var GeneratorInterface */ + /** @var GeneratorInterface */ private $generator; /** @@ -90,12 +85,11 @@ class BudgetReportController extends Controller $helper->setBudgets($budgets); $helper->setStart($start); $helper->setEnd($end); - $helper->setCollectOtherObjects(intval($others) === 1); + $helper->setCollectOtherObjects(1 === intval($others)); $chartData = $helper->generate('expense', 'account'); $data = $this->generator->pieChart($chartData); return Response::json($data); - } /** @@ -115,7 +109,7 @@ class BudgetReportController extends Controller $helper->setBudgets($budgets); $helper->setStart($start); $helper->setEnd($end); - $helper->setCollectOtherObjects(intval($others) === 1); + $helper->setCollectOtherObjects(1 === intval($others)); $chartData = $helper->generate('expense', 'budget'); $data = $this->generator->pieChart($chartData); @@ -277,5 +271,4 @@ class BudgetReportController extends Controller return $grouped; } - } diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php index 44a6a439f2..f354244d2d 100644 --- a/app/Http/Controllers/Chart/CategoryController.php +++ b/app/Http/Controllers/Chart/CategoryController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Chart; - use Carbon\Carbon; use FireflyIII\Generator\Chart\Basic\GeneratorInterface; use FireflyIII\Http\Controllers\Controller; @@ -38,13 +36,11 @@ use Preferences; use Response; /** - * Class CategoryController - * - * @package FireflyIII\Http\Controllers\Chart + * Class CategoryController. */ class CategoryController extends Controller { - /** @var GeneratorInterface */ + /** @var GeneratorInterface */ protected $generator; /** @@ -77,7 +73,7 @@ class CategoryController extends Controller $start = $repository->firstUseDate($category); - if (is_null($start)) { + if (null === $start) { $start = new Carbon; } @@ -120,7 +116,6 @@ class CategoryController extends Controller $cache->store($data); return Response::json($data); - } /** @@ -269,7 +264,6 @@ class CategoryController extends Controller $chartData[0]['entries'][$label] = bcmul($spent, '-1'); $chartData[1]['entries'][$label] = $earned; $chartData[2]['entries'][$label] = $sum; - } $data = $this->generator->multiSet($chartData); $cache->store($data); @@ -280,7 +274,6 @@ class CategoryController extends Controller /** * @param CategoryRepositoryInterface $repository * @param Category $category - * * @param $date * * @return \Symfony\Component\HttpFoundation\Response @@ -295,7 +288,6 @@ class CategoryController extends Controller return Response::json($data); } - /** * @param CategoryRepositoryInterface $repository * @param Category $category @@ -350,7 +342,6 @@ class CategoryController extends Controller $chartData[1]['entries'][$label] = round($earned, 12); $chartData[2]['entries'][$label] = round($sum, 12); - $start->addDay(); } @@ -358,7 +349,5 @@ class CategoryController extends Controller $cache->store($data); return $data; - } - } diff --git a/app/Http/Controllers/Chart/CategoryReportController.php b/app/Http/Controllers/Chart/CategoryReportController.php index 92e5e5e756..5c59817706 100644 --- a/app/Http/Controllers/Chart/CategoryReportController.php +++ b/app/Http/Controllers/Chart/CategoryReportController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Chart; - use Carbon\Carbon; use FireflyIII\Generator\Chart\Basic\GeneratorInterface; use FireflyIII\Helpers\Chart\MetaPieChartInterface; @@ -41,18 +39,14 @@ use Illuminate\Support\Collection; use Navigation; use Response; - /** * Separate controller because many helper functions are shared. * * Class CategoryReportController - * - * @package FireflyIII\Http\Controllers\Chart */ class CategoryReportController extends Controller { - - /** @var GeneratorInterface */ + /** @var GeneratorInterface */ private $generator; /** @@ -83,7 +77,7 @@ class CategoryReportController extends Controller { /** @var MetaPieChartInterface $helper */ $helper = app(MetaPieChartInterface::class); - $helper->setAccounts($accounts)->setCategories($categories)->setStart($start)->setEnd($end)->setCollectOtherObjects(intval($others) === 1); + $helper->setAccounts($accounts)->setCategories($categories)->setStart($start)->setEnd($end)->setCollectOtherObjects(1 === intval($others)); $chartData = $helper->generate('expense', 'account'); $data = $this->generator->pieChart($chartData); @@ -108,7 +102,7 @@ class CategoryReportController extends Controller $helper->setCategories($categories); $helper->setStart($start); $helper->setEnd($end); - $helper->setCollectOtherObjects(intval($others) === 1); + $helper->setCollectOtherObjects(1 === intval($others)); $chartData = $helper->generate('income', 'account'); $data = $this->generator->pieChart($chartData); @@ -132,7 +126,7 @@ class CategoryReportController extends Controller $helper->setCategories($categories); $helper->setStart($start); $helper->setEnd($end); - $helper->setCollectOtherObjects(intval($others) === 1); + $helper->setCollectOtherObjects(1 === intval($others)); $chartData = $helper->generate('expense', 'category'); $data = $this->generator->pieChart($chartData); @@ -150,14 +144,13 @@ class CategoryReportController extends Controller */ public function categoryIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end, string $others) { - /** @var MetaPieChartInterface $helper */ $helper = app(MetaPieChartInterface::class); $helper->setAccounts($accounts); $helper->setCategories($categories); $helper->setStart($start); $helper->setEnd($end); - $helper->setCollectOtherObjects(intval($others) === 1); + $helper->setCollectOtherObjects(1 === intval($others)); $chartData = $helper->generate('income', 'category'); $data = $this->generator->pieChart($chartData); @@ -238,7 +231,6 @@ class CategoryReportController extends Controller $currentIncome = $income[$category->id] ?? '0'; $currentExpense = $expenses[$category->id] ?? '0'; - // add to sum: $sumOfIncome[$category->id] = $sumOfIncome[$category->id] ?? '0'; $sumOfExpense[$category->id] = $sumOfExpense[$category->id] ?? '0'; @@ -257,11 +249,11 @@ class CategoryReportController extends Controller // remove all empty entries to prevent cluttering: $newSet = []; foreach ($chartData as $key => $entry) { - if (!array_sum($entry['entries']) === 0) { + if (0 === !array_sum($entry['entries'])) { $newSet[$key] = $chartData[$key]; } } - if (count($newSet) === 0) { + if (0 === count($newSet)) { $newSet = $chartData; } $data = $this->generator->multiSet($newSet); @@ -270,7 +262,6 @@ class CategoryReportController extends Controller return Response::json($data); } - /** * @param Collection $accounts * @param Collection $categories diff --git a/app/Http/Controllers/Chart/PiggyBankController.php b/app/Http/Controllers/Chart/PiggyBankController.php index b5f8ffdbd0..303f239008 100644 --- a/app/Http/Controllers/Chart/PiggyBankController.php +++ b/app/Http/Controllers/Chart/PiggyBankController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Chart; @@ -31,15 +30,11 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Support\CacheProperties; use Response; - /** - * Class PiggyBankController - * - * @package FireflyIII\Http\Controllers\Chart + * Class PiggyBankController. */ class PiggyBankController extends Controller { - /** @var GeneratorInterface */ protected $generator; @@ -86,6 +81,5 @@ class PiggyBankController extends Controller $cache->store($data); return Response::json($data); - } } diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.php index 29d84f6a91..d54697bfa5 100644 --- a/app/Http/Controllers/Chart/ReportController.php +++ b/app/Http/Controllers/Chart/ReportController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Chart; - use Carbon\Carbon; use FireflyIII\Generator\Chart\Basic\GeneratorInterface; use FireflyIII\Http\Controllers\Controller; @@ -36,13 +34,10 @@ use Response; use Steam; /** - * Class ReportController - * - * @package FireflyIII\Http\Controllers\Chart + * Class ReportController. */ class ReportController extends Controller { - /** @var GeneratorInterface */ protected $generator; @@ -93,15 +88,13 @@ class ReportController extends Controller return Response::json($data); } - /** - * Shows income and expense, debet/credit: operations + * Shows income and expense, debet/credit: operations. * * @param Collection $accounts * @param Carbon $start * @param Carbon $end * - * * @return \Illuminate\Http\JsonResponse */ public function operations(Collection $accounts, Carbon $start, Carbon $end) @@ -144,16 +137,14 @@ class ReportController extends Controller $chartData[1]['entries'][$label] = bcadd($spent, $amount); } - $data = $this->generator->multiSet($chartData); $cache->store($data); return Response::json($data); - } /** - * Shows sum income and expense, debet/credit: operations + * Shows sum income and expense, debet/credit: operations. * * @param Carbon $start * @param Carbon $end @@ -163,8 +154,6 @@ class ReportController extends Controller */ public function sum(Collection $accounts, Carbon $start, Carbon $end) { - - // chart properties for cache: $cache = new CacheProperties; $cache->addProperty('chart.report.sum'); @@ -175,7 +164,6 @@ class ReportController extends Controller return Response::json($cache->get()); // @codeCoverageIgnore } - $source = $this->getChartData($accounts, $start, $end); $numbers = [ 'sum_earned' => '0', @@ -187,14 +175,14 @@ class ReportController extends Controller ]; foreach ($source['earned'] as $amount) { $numbers['sum_earned'] = bcadd($amount, $numbers['sum_earned']); - $numbers['count_earned']++; + ++$numbers['count_earned']; } if ($numbers['count_earned'] > 0) { $numbers['avg_earned'] = $numbers['sum_earned'] / $numbers['count_earned']; } foreach ($source['spent'] as $amount) { $numbers['sum_spent'] = bcadd($amount, $numbers['sum_spent']); - $numbers['count_spent']++; + ++$numbers['count_spent']; } if ($numbers['count_spent'] > 0) { $numbers['avg_spent'] = $numbers['sum_spent'] / $numbers['count_spent']; @@ -219,12 +207,10 @@ class ReportController extends Controller ], ]; - $data = $this->generator->multiSet($chartData); $cache->store($data); return Response::json($data); - } /** @@ -243,7 +229,7 @@ class ReportController extends Controller } /** - * Collects the incomes and expenses for the given periods, grouped per month. Will cache its results + * Collects the incomes and expenses for the given periods, grouped per month. Will cache its results. * * @param Collection $accounts * @param Carbon $start @@ -270,14 +256,14 @@ class ReportController extends Controller $tasker = app(AccountTaskerInterface::class); while ($currentStart <= $end) { - $currentEnd = Navigation::endOfPeriod($currentStart, '1M'); $earned = strval( array_sum( array_map( function ($item) { return $item['sum']; - }, $tasker->getIncomeReport($currentStart, $currentEnd, $accounts) + }, + $tasker->getIncomeReport($currentStart, $currentEnd, $accounts) ) ) ); @@ -287,12 +273,12 @@ class ReportController extends Controller array_map( function ($item) { return $item['sum']; - }, $tasker->getExpenseReport($currentStart, $currentEnd, $accounts) + }, + $tasker->getExpenseReport($currentStart, $currentEnd, $accounts) ) ) ); - $label = $currentStart->format('Y-m') . '-01'; $spentArray[$label] = bcmul($spent, '-1'); $earnedArray[$label] = $earned; diff --git a/app/Http/Controllers/Chart/TagReportController.php b/app/Http/Controllers/Chart/TagReportController.php index 3299d1aa22..de4daf03dc 100644 --- a/app/Http/Controllers/Chart/TagReportController.php +++ b/app/Http/Controllers/Chart/TagReportController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Chart; - use Carbon\Carbon; use FireflyIII\Generator\Chart\Basic\GeneratorInterface; use FireflyIII\Helpers\Chart\MetaPieChartInterface; @@ -73,7 +71,7 @@ class TagReportController extends Controller $helper->setTags($tags); $helper->setStart($start); $helper->setEnd($end); - $helper->setCollectOtherObjects(intval($others) === 1); + $helper->setCollectOtherObjects(1 === intval($others)); $chartData = $helper->generate('expense', 'account'); $data = $this->generator->pieChart($chartData); @@ -97,7 +95,7 @@ class TagReportController extends Controller $helper->setTags($tags); $helper->setStart($start); $helper->setEnd($end); - $helper->setCollectOtherObjects(intval($others) === 1); + $helper->setCollectOtherObjects(1 === intval($others)); $chartData = $helper->generate('income', 'account'); $data = $this->generator->pieChart($chartData); @@ -224,7 +222,6 @@ class TagReportController extends Controller $currentIncome = $income[$tag->id] ?? '0'; $currentExpense = $expenses[$tag->id] ?? '0'; - // add to sum: $sumOfIncome[$tag->id] = $sumOfIncome[$tag->id] ?? '0'; $sumOfExpense[$tag->id] = $sumOfExpense[$tag->id] ?? '0'; @@ -243,11 +240,11 @@ class TagReportController extends Controller // remove all empty entries to prevent cluttering: $newSet = []; foreach ($chartData as $key => $entry) { - if (!array_sum($entry['entries']) === 0) { + if (0 === !array_sum($entry['entries'])) { $newSet[$key] = $chartData[$key]; } } - if (count($newSet) === 0) { + if (0 === count($newSet)) { $newSet = $chartData; // @codeCoverageIgnore } $data = $this->generator->multiSet($newSet); @@ -273,7 +270,7 @@ class TagReportController extends Controller $helper->setTags($tags); $helper->setStart($start); $helper->setEnd($end); - $helper->setCollectOtherObjects(intval($others) === 1); + $helper->setCollectOtherObjects(1 === intval($others)); $chartData = $helper->generate('expense', 'tag'); $data = $this->generator->pieChart($chartData); @@ -291,14 +288,13 @@ class TagReportController extends Controller */ public function tagIncome(Collection $accounts, Collection $tags, Carbon $start, Carbon $end, string $others) { - /** @var MetaPieChartInterface $helper */ $helper = app(MetaPieChartInterface::class); $helper->setAccounts($accounts); $helper->setTags($tags); $helper->setStart($start); $helper->setEnd($end); - $helper->setCollectOtherObjects(intval($others) === 1); + $helper->setCollectOtherObjects(1 === intval($others)); $chartData = $helper->generate('income', 'tag'); $data = $this->generator->pieChart($chartData); @@ -375,5 +371,4 @@ class TagReportController extends Controller return $grouped; } - } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 89a9293a35..3d08e5d0b0 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -40,15 +39,13 @@ use URL; use View; /** - * Class Controller - * - * @package FireflyIII\Http\Controllers + * Class Controller. */ class Controller extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; - /** @var string */ + /** @var string */ protected $dateTimeFormat; /** @var string */ protected $monthAndDayFormat; @@ -75,7 +72,6 @@ class Controller extends BaseController View::share('DEMO_PASSWORD', env('DEMO_PASSWORD', '')); View::share('FF_VERSION', config('firefly.version')); - $this->middleware( function ($request, $next) { // translations for specific strings: @@ -86,7 +82,7 @@ class Controller extends BaseController // get shown-intro-preference: if (auth()->check()) { // some routes have a "what" parameter, which indicates a special page: - $specificPage = is_null(Route::current()->parameter('what')) ? '' : '_' . Route::current()->parameter('what'); + $specificPage = null === Route::current()->parameter('what') ? '' : '_' . Route::current()->parameter('what'); $page = str_replace('.', '_', Route::currentRouteName()); // indicator if user has seen the help for this page ( + special page): @@ -110,11 +106,10 @@ class Controller extends BaseController return $next($request); } ); - } /** - * Functionality: + * Functionality:. * * - If the $identifier contains the word "delete" then a remembered uri with the text "/show/" in it will not be returned but instead the index (/) * will be returned. @@ -127,10 +122,10 @@ class Controller extends BaseController protected function getPreviousUri(string $identifier): string { $uri = strval(session($identifier)); - if (!(strpos($identifier, 'delete') === false) && !(strpos($uri, '/show/') === false)) { + if (!(false === strpos($identifier, 'delete')) && !(false === strpos($uri, '/show/'))) { $uri = $this->redirectUri; } - if (!(strpos($uri, 'jscript') === false)) { + if (!(false === strpos($uri, 'jscript'))) { $uri = $this->redirectUri; } @@ -144,7 +139,7 @@ class Controller extends BaseController */ protected function isOpeningBalance(TransactionJournal $journal): bool { - return $journal->transactionTypeStr() === TransactionType::OPENING_BALANCE; + return TransactionType::OPENING_BALANCE === $journal->transactionTypeStr(); } /** @@ -162,7 +157,6 @@ class Controller extends BaseController if (in_array($account->accountType->type, $valid)) { return redirect(route('accounts.show', [$account->id])); } - } // @codeCoverageIgnoreStart Session::flash('error', strval(trans('firefly.cannot_redirect_to_account'))); @@ -178,5 +172,4 @@ class Controller extends BaseController { Session::put($identifier, URL::previous()); } - } diff --git a/app/Http/Controllers/CurrencyController.php b/app/Http/Controllers/CurrencyController.php index 933bedb124..40026c295a 100644 --- a/app/Http/Controllers/CurrencyController.php +++ b/app/Http/Controllers/CurrencyController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -34,17 +33,14 @@ use Preferences; use View; /** - * Class CurrencyController - * - * @package FireflyIII\Http\Controllers + * Class CurrencyController. */ class CurrencyController extends Controller { - /** @var CurrencyRepositoryInterface */ protected $repository; - /** @var UserRepositoryInterface */ + /** @var UserRepositoryInterface */ protected $userRepository; /** @@ -54,7 +50,6 @@ class CurrencyController extends Controller { parent::__construct(); - $this->middleware( function ($request, $next) { View::share('title', trans('firefly.currencies')); @@ -84,7 +79,7 @@ class CurrencyController extends Controller $subTitle = trans('firefly.create_currency'); // put previous url in session if not redirect from store (not "create another"). - if (session('currencies.create.fromStore') !== true) { + if (true !== session('currencies.create.fromStore')) { $this->rememberPreviousUri('currencies.create.uri'); } $request->session()->forget('currencies.create.fromStore'); @@ -102,7 +97,6 @@ class CurrencyController extends Controller */ public function defaultCurrency(Request $request, TransactionCurrency $currency) { - Preferences::set('currencyPreference', $currency->code); Preferences::mark(); @@ -111,10 +105,8 @@ class CurrencyController extends Controller Cache::forget('FFCURRENCYCODE'); return redirect(route('currencies.index')); - } - /** * @param Request $request * @param TransactionCurrency $currency @@ -137,14 +129,12 @@ class CurrencyController extends Controller return redirect(route('currencies.index')); } - // put previous url in session $this->rememberPreviousUri('currencies.delete.uri'); $request->session()->flash('gaEventCategory', 'currency'); $request->session()->flash('gaEventAction', 'delete'); $subTitle = trans('form.delete_currency', ['name' => $currency->name]); - return view('currencies.delete', compact('currency', 'subTitle')); } @@ -197,7 +187,7 @@ class CurrencyController extends Controller $currency->symbol = htmlentities($currency->symbol); // put previous url in session if not redirect from store (not "return_to_edit"). - if (session('currencies.edit.fromUpdate') !== true) { + if (true !== session('currencies.edit.fromUpdate')) { $this->rememberPreviousUri('currencies.edit.uri'); } $request->session()->forget('currencies.edit.fromUpdate'); @@ -205,7 +195,6 @@ class CurrencyController extends Controller $request->session()->flash('gaEventAction', 'edit'); return view('currencies.edit', compact('currency', 'subTitle', 'subTitleIcon')); - } /** @@ -217,13 +206,13 @@ class CurrencyController extends Controller { $currencies = $this->repository->get(); $defaultCurrency = $this->repository->getCurrencyByPreference(Preferences::get('currencyPreference', config('firefly.default_currency', 'EUR'))); - $isOwner = true; + $isOwner = true; if (!$this->userRepository->hasRole(auth()->user(), 'owner')) { $request->session()->flash('info', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); $isOwner = false; } - return view('currencies.index', compact('currencies', 'defaultCurrency','isOwner')); + return view('currencies.index', compact('currencies', 'defaultCurrency', 'isOwner')); } /** @@ -245,7 +234,7 @@ class CurrencyController extends Controller $currency = $this->repository->store($data); $request->session()->flash('success', trans('firefly.created_currency', ['name' => $currency->name])); - if (intval($request->get('create_another')) === 1) { + if (1 === intval($request->get('create_another'))) { // @codeCoverageIgnoreStart $request->session()->put('currencies.create.fromStore', true); @@ -277,8 +266,7 @@ class CurrencyController extends Controller $request->session()->flash('success', trans('firefly.updated_currency', ['name' => $currency->name])); Preferences::mark(); - - if (intval($request->get('return_to_edit')) === 1) { + if (1 === intval($request->get('return_to_edit'))) { // @codeCoverageIgnoreStart $request->session()->put('currencies.edit.fromUpdate', true); diff --git a/app/Http/Controllers/ExportController.php b/app/Http/Controllers/ExportController.php index 9e1ec777b7..fa746b8145 100644 --- a/app/Http/Controllers/ExportController.php +++ b/app/Http/Controllers/ExportController.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII\Http\Controllers; use Carbon\Carbon; @@ -39,9 +37,7 @@ use Response; use View; /** - * Class ExportController - * - * @package FireflyIII\Http\Controllers + * Class ExportController. */ class ExportController extends Controller { @@ -52,7 +48,6 @@ class ExportController extends Controller { parent::__construct(); - $this->middleware( function ($request, $next) { View::share('mainTitleIcon', 'fa-file-archive-o'); @@ -68,6 +63,7 @@ class ExportController extends Controller * @param ExportJob $job * * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response + * * @throws FireflyException */ public function download(ExportJobRepositoryInterface $repository, ExportJob $job) @@ -82,7 +78,6 @@ class ExportController extends Controller } $content = $repository->getContent($job); - $job->change('export_downloaded'); /** @var LaravelResponse $response */ $response = response($content, 200); @@ -98,7 +93,6 @@ class ExportController extends Controller ->header('Content-Length', strlen($content)); return $response; - } /** @@ -134,7 +128,6 @@ class ExportController extends Controller $today = Carbon::create()->format('Y-m-d'); return view('export.index', compact('job', 'checked', 'accountList', 'formats', 'defaultFormat', 'first', 'today')); - } /** @@ -164,48 +157,35 @@ class ExportController extends Controller $processor = app(ProcessorInterface::class); $processor->setSettings($settings); - /* - * Collect journals: - */ + // Collect journals: $jobs->changeStatus($job, 'export_status_collecting_journals'); $processor->collectJournals(); $jobs->changeStatus($job, 'export_status_collected_journals'); - /* - * Transform to exportable entries: - */ + // Transform to exportable entries: $jobs->changeStatus($job, 'export_status_converting_to_export_format'); $processor->convertJournals(); $jobs->changeStatus($job, 'export_status_converted_to_export_format'); - /* - * Transform to (temporary) file: - */ + // Transform to (temporary) file: $jobs->changeStatus($job, 'export_status_creating_journal_file'); $processor->exportJournals(); $jobs->changeStatus($job, 'export_status_created_journal_file'); - /* - * Collect attachments, if applicable. - */ + // Collect attachments, if applicable. if ($settings['includeAttachments']) { $jobs->changeStatus($job, 'export_status_collecting_attachments'); $processor->collectAttachments(); $jobs->changeStatus($job, 'export_status_collected_attachments'); } - - /* - * Collect old uploads - */ + // Collect old uploads if ($settings['includeOldUploads']) { $jobs->changeStatus($job, 'export_status_collecting_old_uploads'); $processor->collectOldUploads(); $jobs->changeStatus($job, 'export_status_collected_old_uploads'); } - /* - * Create ZIP file: - */ + // Create ZIP file: $jobs->changeStatus($job, 'export_status_creating_zip_file'); $processor->createZipFile(); $jobs->changeStatus($job, 'export_status_created_zip_file'); diff --git a/app/Http/Controllers/HelpController.php b/app/Http/Controllers/HelpController.php index 000b8cb17d..9dbc65a8e8 100644 --- a/app/Http/Controllers/HelpController.php +++ b/app/Http/Controllers/HelpController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -29,13 +28,10 @@ use Preferences; use Response; /** - * Class HelpController - * - * @package FireflyIII\Http\Controllers + * Class HelpController. */ class HelpController extends Controller { - /** @var HelpInterface */ private $help; @@ -56,7 +52,7 @@ class HelpController extends Controller } /** - * @param $route + * @param $route * * @return \Illuminate\Http\JsonResponse */ @@ -66,7 +62,6 @@ class HelpController extends Controller $html = $this->getHelpText($route, $language); return Response::json(['html' => $html]); - } /** @@ -100,7 +95,7 @@ class HelpController extends Controller $content = $this->help->getFromGithub($route, $language); // content will have 0 length when Github failed. Try en_US when it does: - if (strlen($content) === 0) { + if (0 === strlen($content)) { $language = 'en_US'; // also check cache first: @@ -112,19 +107,15 @@ class HelpController extends Controller } $content = $this->help->getFromGithub($route, $language); - } // help still empty? - if (strlen($content) !== 0) { + if (0 !== strlen($content)) { $this->help->putInCache($route, $language, $content); return $content; - } return '

' . strval(trans('firefly.route_has_no_help')) . '

'; } - - } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 0d6b882d65..0632f35c37 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -35,15 +34,14 @@ use Illuminate\Http\Request; use Illuminate\Routing\Route; use Illuminate\Support\Collection; use Log; +use Monolog\Handler\RotatingFileHandler; use Preferences; use Route as RouteFacade; use Session; use View; /** - * Class HomeController - * - * @package FireflyIII\Http\Controllers + * Class HomeController. */ class HomeController extends Controller { @@ -62,7 +60,6 @@ class HomeController extends Controller */ public function dateRange(Request $request) { - $start = new Carbon($request->get('start')); $end = new Carbon($request->get('end')); $label = $request->get('label'); @@ -88,16 +85,58 @@ class HomeController extends Controller Session::put('end', $end); } - public function displayDebug() + /** + * @param Request $request + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function displayDebug(Request $request) { - $phpVersion = PHP_VERSION; - $now = Carbon::create()->format('Y-m-d H:i:s e'); - $extensions = join(', ', get_loaded_extensions()); - $drivers = join(', ', DB::availableDrivers()); - $currentDriver = DB::getDriverName(); + $phpVersion = PHP_VERSION; + $phpOs = php_uname(); + $interface = PHP_SAPI; + $now = Carbon::create()->format('Y-m-d H:i:s e'); + $extensions = join(', ', get_loaded_extensions()); + $drivers = join(', ', DB::availableDrivers()); + $currentDriver = DB::getDriverName(); + $userAgent = $request->header('user-agent'); + $isSandstorm = var_export(env('IS_SANDSTORM', 'unknown'), true); + $isDocker = var_export(env('IS_DOCKER', 'unknown'), true); + $trustedProxies = env('TRUSTED_PROXIES', '(none)'); - return view('debug', compact('phpVersion', 'extensions', 'carbon', 'now', 'drivers','currentDriver')); + // get latest log file: + $logger = Log::getMonolog(); + $handlers = $logger->getHandlers(); + $logContent = ''; + foreach ($handlers as $handler) { + if ($handler instanceof RotatingFileHandler) { + $logFile = $handler->getUrl(); + if (null !== $logFile) { + $logContent = file_get_contents($logFile); + } + } + } + // last few lines + $logContent = 'Truncated from this point <----|' . substr($logContent, -4096); + return view( + 'debug', + compact( + 'phpVersion', + 'extensions', + 'carbon', + 'now', + 'drivers', + 'currentDriver', + 'userAgent', + 'phpOs', + 'interface', + 'logContent', + 'isDocker', + 'isSandstorm', + 'trustedProxies' + ) + ); } /** @@ -140,14 +179,15 @@ class HomeController extends Controller $types = config('firefly.accountTypesByIdentifier.asset'); $count = $repository->count($types); - if ($count === 0) { + if (0 === $count) { return redirect(route('new-user.index')); } $subTitle = trans('firefly.welcomeBack'); $transactions = []; $frontPage = Preferences::get( - 'frontPageAccounts', $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray() + 'frontPageAccounts', + $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray() ); /** @var Carbon $start */ $start = session('start', Carbon::now()->startOfMonth()); @@ -155,13 +195,13 @@ class HomeController extends Controller $end = session('end', Carbon::now()->endOfMonth()); $accounts = $repository->getAccountsById($frontPage->data); $showDeps = Preferences::get('showDepositsFrontpage', false)->data; + $today = new Carbon; // zero bills? Hide some elements from view. /** @var BillRepositoryInterface $billRepository */ $billRepository = app(BillRepositoryInterface::class); $billCount = $billRepository->getBills()->count(); - foreach ($accounts as $account) { $collector = app(JournalCollectorInterface::class); $collector->setAccounts(new Collection([$account]))->setRange($start, $end)->setLimit(10)->setPage(1); @@ -170,7 +210,8 @@ class HomeController extends Controller } return view( - 'index', compact('count', 'subTitle', 'transactions', 'showDeps', 'billCount') + 'index', + compact('count', 'subTitle', 'transactions', 'showDeps', 'billCount', 'start', 'end', 'today') ); } @@ -183,23 +224,21 @@ class HomeController extends Controller 'register', 'report.options', 'routes', 'rule-groups.down', 'rule-groups.up', 'rules.up', 'rules.down', 'rules.select', 'search.search', 'test-flash', 'transactions.link.delete', 'transactions.link.switch', 'two-factor.lost', 'report.options', - ]; /** @var Route $route */ foreach ($set as $route) { $name = $route->getName(); - if (!is_null($name) && in_array('GET', $route->methods()) && strlen($name) > 0) { + if (null !== $name && in_array('GET', $route->methods()) && strlen($name) > 0) { $found = false; foreach ($ignore as $string) { - if (strpos($name, $string) !== false) { + if (false !== strpos($name, $string)) { $found = true; } } if (!$found) { echo 'touch ' . $route->getName() . '.md;'; } - } } @@ -218,5 +257,4 @@ class HomeController extends Controller return redirect(route('home')); } - } diff --git a/app/Http/Controllers/Import/BankController.php b/app/Http/Controllers/Import/BankController.php index d42cc8e6a6..9358481970 100644 --- a/app/Http/Controllers/Import/BankController.php +++ b/app/Http/Controllers/Import/BankController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Import; - use FireflyIII\Http\Controllers\Controller; use FireflyIII\Support\Import\Information\InformationInterface; use FireflyIII\Support\Import\Prerequisites\PrerequisitesInterface; @@ -33,7 +31,6 @@ use Session; class BankController extends Controller { - /** * This method must ask the user all parameters necessary to start importing data. This may not be enough * to finish the import itself (ie. mapping) but it should be enough to begin: accounts to import from, @@ -60,7 +57,6 @@ class BankController extends Controller $remoteAccounts = $object->getAccounts(); return view('import.bank.form', compact('remoteAccounts', 'bank')); - } /** @@ -75,7 +71,6 @@ class BankController extends Controller */ public function postForm(Request $request, string $bank) { - $class = config(sprintf('firefly.import_pre.%s', $bank)); /** @var PrerequisitesInterface $object */ $object = app($class); @@ -85,7 +80,7 @@ class BankController extends Controller return redirect(route('import.bank.prerequisites', [$bank])); } $remoteAccounts = $request->get('do_import'); - if (!is_array($remoteAccounts) || count($remoteAccounts) === 0) { + if (!is_array($remoteAccounts) || 0 === count($remoteAccounts)) { Session::flash('error', 'Must select accounts'); return redirect(route('import.bank.form', [$bank])); @@ -93,10 +88,9 @@ class BankController extends Controller $remoteAccounts = array_keys($remoteAccounts); $class = config(sprintf('firefly.import_pre.%s', $bank)); // get import file + unset($remoteAccounts, $class); // get import config - - } /** @@ -161,5 +155,4 @@ class BankController extends Controller return redirect(route('import.bank.form', [$bank])); } - } diff --git a/app/Http/Controllers/Import/FileController.php b/app/Http/Controllers/Import/FileController.php index c32a34345a..ff6c86b48c 100644 --- a/app/Http/Controllers/Import/FileController.php +++ b/app/Http/Controllers/Import/FileController.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII\Http\Controllers\Import; use FireflyIII\Exceptions\FireflyException; @@ -39,15 +37,12 @@ use Response; use Session; use View; - /** * Class FileController. - * - * @package FireflyIII\Http\Controllers\Import */ class FileController extends Controller { - /** @var ImportJobRepositoryInterface */ + /** @var ImportJobRepositoryInterface */ public $repository; /** @@ -74,6 +69,7 @@ class FileController extends Controller * @param ImportJob $job * * @return View + * * @throws FireflyException */ public function configure(ImportJob $job) @@ -111,7 +107,7 @@ class FileController extends Controller $config['column-roles-complete'] = false; $config['column-mapping-complete'] = false; $config['initial-config-complete'] = false; - $config['delimiter'] = $config['delimiter'] === "\t" ? 'tab' : $config['delimiter']; + $config['delimiter'] = "\t" === $config['delimiter'] ? 'tab' : $config['delimiter']; $result = json_encode($config, JSON_PRETTY_PRINT); $name = sprintf('"%s"', addcslashes('import-configuration-' . date('Y-m-d') . '.json', '"\\')); @@ -128,8 +124,6 @@ class FileController extends Controller ->header('Content-Length', strlen($result)); return $response; - - } /** @@ -180,9 +174,7 @@ class FileController extends Controller return redirect(route('import.file.configure', [$job->key])); } - /** - * * Show status of import job in JSON. * * @param ImportJob $job @@ -205,12 +197,12 @@ class FileController extends Controller 'finishedText' => '', ]; - if ($job->extended_status['steps'] !== 0) { + if (0 !== $job->extended_status['steps']) { $result['percentage'] = round(($job->extended_status['done'] / $job->extended_status['steps']) * 100, 0); $result['show_percentage'] = true; } - if ($job->status === 'finished') { + if ('finished' === $job->status) { $tagId = $job->extended_status['tag']; /** @var TagRepositoryInterface $repository */ $repository = app(TagRepositoryInterface::class); @@ -219,7 +211,7 @@ class FileController extends Controller $result['finishedText'] = trans('firefly.import_status_finished_job', ['link' => route('tags.show', [$tag->id, 'all']), 'tag' => $tag->tag]); } - if ($job->status === 'running') { + if ('running' === $job->status) { $result['started'] = true; $result['running'] = true; } @@ -262,6 +254,7 @@ class FileController extends Controller * @param ImportJob $job * * @return \Illuminate\Http\JsonResponse + * * @throws FireflyException */ public function start(ImportJob $job) @@ -298,6 +291,7 @@ class FileController extends Controller * @param ImportJob $job * * @return ConfiguratorInterface + * * @throws FireflyException */ private function makeConfigurator(ImportJob $job): ConfiguratorInterface @@ -305,14 +299,13 @@ class FileController extends Controller $type = $job->file_type; $key = sprintf('firefly.import_configurators.%s', $type); $className = config($key); - if (is_null($className)) { + if (null === $className) { throw new FireflyException('Cannot find configurator class for this job.'); // @codeCoverageIgnore } /** @var ConfiguratorInterface $configurator */ $configurator = app($className); $configurator->setJob($job); - return $configurator; } } diff --git a/app/Http/Controllers/ImportController.php b/app/Http/Controllers/ImportController.php index 4188dfbfcb..8d513b1e91 100644 --- a/app/Http/Controllers/ImportController.php +++ b/app/Http/Controllers/ImportController.php @@ -27,12 +27,10 @@ use View; /** * Class ImportController. - * - * @package FireflyIII\Http\Controllers */ class ImportController extends Controller { - /** @var ImportJobRepositoryInterface */ + /** @var ImportJobRepositoryInterface */ public $repository; /** @@ -53,9 +51,8 @@ class ImportController extends Controller ); } - /** - * General import index + * General import index. * * @return View */ @@ -72,5 +69,4 @@ class ImportController extends Controller return view('import.index', compact('subTitle', 'subTitleIcon', 'importFileTypes', 'defaultImportType')); } - } diff --git a/app/Http/Controllers/JavascriptController.php b/app/Http/Controllers/JavascriptController.php index fe97ee0501..6ec063da76 100644 --- a/app/Http/Controllers/JavascriptController.php +++ b/app/Http/Controllers/JavascriptController.php @@ -18,13 +18,11 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; use Carbon\Carbon; -use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; use FireflyIII\Models\AccountType; use FireflyIII\Models\TransactionCurrency; @@ -36,9 +34,7 @@ use Navigation; use Preferences; /** - * Class JavascriptController - * - * @package FireflyIII\Http\Controllers + * Class JavascriptController. */ class JavascriptController extends Controller { @@ -54,19 +50,17 @@ class JavascriptController extends Controller $preference = Preferences::get('currencyPreference', config('firefly.default_currency', 'EUR')); $default = $currencyRepository->findByCode($preference->data); - $data = ['accounts' => [],]; - + $data = ['accounts' => []]; /** @var Account $account */ foreach ($accounts as $account) { $accountId = $account->id; $currency = intval($account->getMeta('currency_id')); - $currency = $currency === 0 ? $default->id : $currency; + $currency = 0 === $currency ? $default->id : $currency; $entry = ['preferredCurrency' => $currency, 'name' => $account->name]; $data['accounts'][$accountId] = $entry; } - return response() ->view('javascript.accounts', $data, 200) ->header('Content-Type', 'text/javascript'); @@ -80,7 +74,7 @@ class JavascriptController extends Controller public function currencies(CurrencyRepositoryInterface $repository) { $currencies = $repository->get(); - $data = ['currencies' => [],]; + $data = ['currencies' => []]; /** @var TransactionCurrency $currency */ foreach ($currencies as $currency) { $currencyId = $currency->id; @@ -98,20 +92,30 @@ class JavascriptController extends Controller * * @return \Illuminate\Http\Response */ - public function variables(Request $request) + public function variables(Request $request, AccountRepositoryInterface $repository, CurrencyRepositoryInterface $currencyRepository) { + $account = $repository->find(intval($request->get('account'))); + $currencyId = 0; + if (null !== $account) { + $currencyId = intval($account->getMeta('currency_id')); + } + /** @var TransactionCurrency $currency */ + $currency = $currencyRepository->find($currencyId); + if (0 === $currencyId) { + $currency = app('amount')->getDefaultCurrency(); + } + $localeconv = localeconv(); $accounting = app('amount')->getJsConfig($localeconv); $localeconv = localeconv(); - $defaultCurrency = app('amount')->getDefaultCurrency(); - $localeconv['frac_digits'] = $defaultCurrency->decimal_places; + $localeconv['frac_digits'] = $currency->decimal_places; $pref = Preferences::get('language', config('firefly.default_language', 'en_US')); $lang = $pref->data; $dateRange = $this->getDateRangeConfig(); $data = [ - 'currencyCode' => app('amount')->getCurrencyCode(), - 'currencySymbol' => app('amount')->getCurrencySymbol(), + 'currencyCode' => $currency->code, + 'currencySymbol' => $currency->symbol, 'accounting' => $accounting, 'localeconv' => $localeconv, 'language' => $lang, @@ -181,8 +185,6 @@ class JavascriptController extends Controller ], ]; - return $return; - } } diff --git a/app/Http/Controllers/Json/AutoCompleteController.php b/app/Http/Controllers/Json/AutoCompleteController.php index 35c82ca35d..1cbd9c26e2 100644 --- a/app/Http/Controllers/Json/AutoCompleteController.php +++ b/app/Http/Controllers/Json/AutoCompleteController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Json; @@ -33,20 +32,16 @@ use FireflyIII\Support\CacheProperties; use Response; /** - * Class AutoCompleteController - * - * @package FireflyIII\Http\Controllers\Json + * Class AutoCompleteController. */ class AutoCompleteController extends Controller { - /** * Returns a JSON list of all accounts. * * @param AccountRepositoryInterface $repository * * @return \Illuminate\Http\JsonResponse - * */ public function allAccounts(AccountRepositoryInterface $repository) { @@ -58,7 +53,6 @@ class AutoCompleteController extends Controller sort($return); return Response::json($return); - } /** @@ -81,7 +75,6 @@ class AutoCompleteController extends Controller * @param AccountRepositoryInterface $repository * * @return \Illuminate\Http\JsonResponse - * */ public function expenseAccounts(AccountRepositoryInterface $repository) { @@ -104,14 +97,12 @@ class AutoCompleteController extends Controller /** * @param JournalCollectorInterface $collector - * * @param TransactionJournal $except * * @return \Illuminate\Http\JsonResponse|mixed */ public function journalsWithId(JournalCollectorInterface $collector, TransactionJournal $except) { - $cache = new CacheProperties; $cache->addProperty('recent-journals-id'); @@ -141,7 +132,6 @@ class AutoCompleteController extends Controller * @param AccountRepositoryInterface $repository * * @return \Illuminate\Http\JsonResponse - * */ public function revenueAccounts(AccountRepositoryInterface $repository) { @@ -178,5 +168,4 @@ class AutoCompleteController extends Controller return Response::json($return); } - } diff --git a/app/Http/Controllers/Json/BoxController.php b/app/Http/Controllers/Json/BoxController.php index 7b9bcb60a6..29ecc6bdf7 100644 --- a/app/Http/Controllers/Json/BoxController.php +++ b/app/Http/Controllers/Json/BoxController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Json; - use Carbon\Carbon; use FireflyIII\Helpers\Collector\JournalCollectorInterface; use FireflyIII\Http\Controllers\Controller; @@ -36,9 +34,7 @@ use FireflyIII\Support\CacheProperties; use Response; /** - * Class BoxController - * - * @package FireflyIII\Http\Controllers\Json + * Class BoxController. */ class BoxController extends Controller { @@ -64,7 +60,6 @@ class BoxController extends Controller $currency = app('amount')->getDefaultCurrency(); $available = $repository->getAvailableBudget($currency, $start, $end); - // get spent amount: $budgets = $repository->getActiveBudgets(); $budgetInformation = $repository->collectBudgetInformation($budgets, $start, $end); @@ -76,7 +71,7 @@ class BoxController extends Controller } $days = $today->diffInDays($end) + 1; $perDay = '0'; - if ($days !== 0) { + if (0 !== $days) { $perDay = bcdiv($left, strval($days)); } @@ -214,5 +209,4 @@ class BoxController extends Controller return Response::json($return); } - -} \ No newline at end of file +} diff --git a/app/Http/Controllers/Json/ExchangeController.php b/app/Http/Controllers/Json/ExchangeController.php index 7d633266b5..096398caa8 100644 --- a/app/Http/Controllers/Json/ExchangeController.php +++ b/app/Http/Controllers/Json/ExchangeController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Json; - use Carbon\Carbon; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\TransactionCurrency; @@ -34,9 +32,7 @@ use Log; use Response; /** - * Class ExchangeController - * - * @package FireflyIII\Http\Controllers\Json + * Class ExchangeController. */ class ExchangeController extends Controller { @@ -53,7 +49,7 @@ class ExchangeController extends Controller /** @var CurrencyRepositoryInterface $repository */ $repository = app(CurrencyRepositoryInterface::class); $rate = $repository->getExchangeRate($fromCurrency, $toCurrency, $date); - if (is_null($rate->id)) { + if (null === $rate->id) { Log::debug(sprintf('No cached exchange rate in database for %s to %s on %s', $fromCurrency->code, $toCurrency->code, $date->format('Y-m-d'))); $preferred = env('EXCHANGE_RATE_SERVICE', config('firefly.preferred_exchange_service')); $class = config('firefly.currency_exchange_services.' . $preferred); @@ -64,7 +60,7 @@ class ExchangeController extends Controller } $return = $rate->toArray(); $return['amount'] = null; - if (!is_null($request->get('amount'))) { + if (null !== $request->get('amount')) { // assume amount is in "from" currency: $return['amount'] = bcmul($request->get('amount'), strval($rate->rate), 12); // round to toCurrency decimal places: @@ -73,5 +69,4 @@ class ExchangeController extends Controller return Response::json($return); } - } diff --git a/app/Http/Controllers/Json/FrontpageController.php b/app/Http/Controllers/Json/FrontpageController.php index f82d6aacb7..c0390c6ffd 100644 --- a/app/Http/Controllers/Json/FrontpageController.php +++ b/app/Http/Controllers/Json/FrontpageController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Json; @@ -29,13 +28,13 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use Response; /** - * Class FrontpageController - * - * @package FireflyIII\Http\Controllers\Json + * Class FrontpageController. */ class FrontpageController extends Controller { /** + * @param PiggyBankRepositoryInterface $repository + * * @return \Illuminate\Http\JsonResponse */ public function piggyBanks(PiggyBankRepositoryInterface $repository) @@ -46,8 +45,7 @@ class FrontpageController extends Controller foreach ($set as $piggyBank) { $rep = $piggyBank->currentRelevantRep(); $amount = strval($rep->currentamount); - if (!is_null($rep->id) && bccomp($amount, '0') === 1) { - + if (null !== $rep->id && 1 === bccomp($amount, '0')) { // percentage! $pct = round(($amount / $piggyBank->targetamount) * 100); @@ -61,7 +59,6 @@ class FrontpageController extends Controller $info[] = $entry; } - } $html = ''; if (count($info) > 0) { @@ -70,5 +67,4 @@ class FrontpageController extends Controller return Response::json(['html' => $html]); } - -} \ No newline at end of file +} diff --git a/app/Http/Controllers/Json/IntroController.php b/app/Http/Controllers/Json/IntroController.php index 3a693b500c..78f10480a0 100644 --- a/app/Http/Controllers/Json/IntroController.php +++ b/app/Http/Controllers/Json/IntroController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Json; @@ -28,13 +27,10 @@ use Log; use Response; /** - * Class IntroController - * - * @package FireflyIII\Http\Controllers\Json + * Class IntroController. */ class IntroController { - /** * @param string $route * @param string $specificPage @@ -45,7 +41,7 @@ class IntroController { $steps = $this->getBasicSteps($route); $specificSteps = $this->getSpecificSteps($route, $specificPage); - if (count($specificSteps) === 0) { + if (0 === count($specificSteps)) { return Response::json($steps); } if ($this->hasOutroStep($route)) { @@ -56,7 +52,6 @@ class IntroController // merge arrays and add last step again $steps = array_merge($steps, $specificSteps); $steps[] = $lastStep; - } if (!$this->hasOutroStep($route)) { $steps = array_merge($steps, $specificSteps); @@ -92,7 +87,7 @@ class IntroController { $route = str_replace('.', '_', $route); $key = 'shown_demo_' . $route; - if ($specialPage !== '') { + if ('' !== $specialPage) { $key .= '_' . $specialPage; } Log::debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key)); @@ -110,7 +105,7 @@ class IntroController public function postFinished(string $route, string $specialPage = '') { $key = 'shown_demo_' . $route; - if ($specialPage !== '') { + if ('' !== $specialPage) { $key .= '_' . $specialPage; } Log::debug(sprintf('Going to mark the following route as done: %s with special "%s" (%s)', $route, $specialPage, $key)); @@ -136,7 +131,6 @@ class IntroController // get the text: $currentStep['intro'] = trans('intro.' . $route . '_' . $key); - // save in array: $steps[] = $currentStep; } @@ -174,5 +168,4 @@ class IntroController return $steps; } - } diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.php index e3646e111c..a9239d71c1 100644 --- a/app/Http/Controllers/JsonController.php +++ b/app/Http/Controllers/JsonController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -31,9 +30,7 @@ use Illuminate\Http\Request; use Response; /** - * Class JsonController - * - * @package FireflyIII\Http\Controllers + * Class JsonController. */ class JsonController extends Controller { @@ -60,7 +57,6 @@ class JsonController extends Controller } $view = view('rules.partials.action', compact('actions', 'count'))->render(); - return Response::json(['html' => $view]); } @@ -105,7 +101,6 @@ class JsonController extends Controller sort($return); return Response::json($return); - } /** @@ -132,7 +127,7 @@ class JsonController extends Controller $keys = array_keys(config('firefly.rule-triggers')); $triggers = []; foreach ($keys as $key) { - if ($key !== 'user_action') { + if ('user_action' !== $key) { $triggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice'); } } @@ -140,8 +135,6 @@ class JsonController extends Controller $view = view('rules.partials.trigger', compact('triggers', 'count'))->render(); - return Response::json(['html' => $view]); } - } diff --git a/app/Http/Controllers/NewUserController.php b/app/Http/Controllers/NewUserController.php index 3d46778d37..efa5ae5ab7 100644 --- a/app/Http/Controllers/NewUserController.php +++ b/app/Http/Controllers/NewUserController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -32,9 +31,7 @@ use Session; use View; /** - * Class NewUserController - * - * @package FireflyIII\Http\Controllers + * Class NewUserController. */ class NewUserController extends Controller { @@ -47,13 +44,11 @@ class NewUserController extends Controller $this->middleware( function ($request, $next) { - return $next($request); } ); } - /** * @param AccountRepositoryInterface $repository * @@ -61,7 +56,6 @@ class NewUserController extends Controller */ public function index(AccountRepositoryInterface $repository) { - View::share('title', trans('firefly.welcome')); View::share('mainTitleIcon', 'fa-fire'); @@ -70,15 +64,15 @@ class NewUserController extends Controller if ($count > 0) { return redirect(route('index')); - } return view('new-user.index'); } /** - * @param NewUserFormRequest $request - * @param AccountRepositoryInterface $repository + * @param NewUserFormRequest $request + * @param AccountRepositoryInterface $repository + * @param CurrencyRepositoryInterface $currencyRepository * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ @@ -93,13 +87,12 @@ class NewUserController extends Controller // also store currency preference from input: $currency = $currencyRepository->find(intval($request->input('amount_currency_id_bank_balance'))); - if(!is_null($currency->id)) { + if (null !== $currency->id) { // store currency preference: Preferences::set('currencyPreference', $currency->code); Preferences::mark(); } - Session::flash('success', strval(trans('firefly.stored_new_accounts_new_user'))); Preferences::mark(); @@ -154,5 +147,4 @@ class NewUserController extends Controller return true; } - } diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.php index f017f9c0c9..875adce839 100644 --- a/app/Http/Controllers/PiggyBankController.php +++ b/app/Http/Controllers/PiggyBankController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -40,15 +39,10 @@ use Steam; use View; /** - * - * - * Class PiggyBankController - * - * @package FireflyIII\Http\Controllers + * Class PiggyBankController. */ class PiggyBankController extends Controller { - /** * */ @@ -56,7 +50,6 @@ class PiggyBankController extends Controller { parent::__construct(); - $this->middleware( function ($request, $next) { View::share('title', trans('firefly.piggyBanks')); @@ -68,7 +61,7 @@ class PiggyBankController extends Controller } /** - * Add money to piggy bank + * Add money to piggy bank. * * @param PiggyBank $piggyBank * @@ -87,7 +80,7 @@ class PiggyBankController extends Controller } /** - * Add money to piggy bank (for mobile devices) + * Add money to piggy bank (for mobile devices). * * @param PiggyBank $piggyBank * @@ -109,7 +102,6 @@ class PiggyBankController extends Controller * @param AccountRepositoryInterface $repository * * @return View - * */ public function create(AccountRepositoryInterface $repository) { @@ -117,14 +109,14 @@ class PiggyBankController extends Controller $subTitle = trans('firefly.new_piggy_bank'); $subTitleIcon = 'fa-plus'; - if (count($accounts) === 0) { + if (0 === count($accounts)) { Session::flash('error', strval(trans('firefly.need_at_least_one_account'))); return redirect(route('new-user.index')); } // put previous url in session if not redirect from store (not "create another"). - if (session('piggy-banks.create.fromStore') !== true) { + if (true !== session('piggy-banks.create.fromStore')) { $this->rememberPreviousUri('piggy-banks.create.uri'); } Session::forget('piggy-banks.create.fromStore'); @@ -174,31 +166,33 @@ class PiggyBankController extends Controller */ public function edit(AccountRepositoryInterface $repository, PiggyBank $piggyBank) { - $accounts = ExpandedForm::makeSelectList($repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])); $subTitle = trans('firefly.update_piggy_title', ['name' => $piggyBank->name]); $subTitleIcon = 'fa-pencil'; $targetDate = null; + $startDate = null; $note = $piggyBank->notes()->first(); - /* - * Flash some data to fill the form. - */ - if (!is_null($piggyBank->targetdate)) { + // Flash some data to fill the form. + if (null !== $piggyBank->targetdate) { $targetDate = $piggyBank->targetdate->format('Y-m-d'); } + if (null !== $piggyBank->startdate) { + $startDate = $piggyBank->startdate->format('Y-m-d'); + } $preFilled = ['name' => $piggyBank->name, 'account_id' => $piggyBank->account_id, 'targetamount' => $piggyBank->targetamount, 'targetdate' => $targetDate, - 'note' => is_null($note) ? '' : $note->text, + 'startdate' => $startDate, + 'note' => null === $note ? '' : $note->text, ]; Session::flash('preFilled', $preFilled); Session::flash('gaEventCategory', 'piggy-banks'); Session::flash('gaEventAction', 'edit'); // put previous url in session if not redirect from store (not "return_to_edit"). - if (session('piggy-banks.edit.fromUpdate') !== true) { + if (true !== session('piggy-banks.edit.fromUpdate')) { $this->rememberPreviousUri('piggy-banks.edit.uri'); } Session::forget('piggy-banks.edit.fromUpdate'); @@ -223,13 +217,11 @@ class PiggyBankController extends Controller /** @var PiggyBank $piggyBank */ foreach ($piggyBanks as $piggyBank) { $piggyBank->savedSoFar = $piggyBank->currentRelevantRep()->currentamount ?? '0'; - $piggyBank->percentage = bccomp('0', $piggyBank->savedSoFar) !== 0 ? intval($piggyBank->savedSoFar / $piggyBank->targetamount * 100) : 0; + $piggyBank->percentage = 0 !== bccomp('0', $piggyBank->savedSoFar) ? intval($piggyBank->savedSoFar / $piggyBank->targetamount * 100) : 0; $piggyBank->leftToSave = bcsub($piggyBank->targetamount, strval($piggyBank->savedSoFar)); $piggyBank->percentage = $piggyBank->percentage > 100 ? 100 : $piggyBank->percentage; - /* - * Fill account information: - */ + // Fill account information: $account = $piggyBank->account; $new = false; if (!isset($accounts[$account->id])) { @@ -243,7 +235,7 @@ class PiggyBankController extends Controller 'leftToSave' => $piggyBank->leftToSave, ]; } - if (isset($accounts[$account->id]) && $new === false) { + if (isset($accounts[$account->id]) && false === $new) { $accounts[$account->id]['sumOfSaved'] = bcadd($accounts[$account->id]['sumOfSaved'], strval($piggyBank->savedSoFar)); $accounts[$account->id]['sumOfTargets'] = bcadd($accounts[$account->id]['sumOfTargets'], $piggyBank->targetamount); $accounts[$account->id]['leftToSave'] = bcadd($accounts[$account->id]['leftToSave'], $piggyBank->leftToSave); @@ -266,7 +258,6 @@ class PiggyBankController extends Controller // set all users piggy banks to zero: $repository->reset(); - if (is_array($data)) { foreach ($data as $order => $id) { $repository->setOrder(intval($id), ($order + 1)); @@ -290,12 +281,13 @@ class PiggyBankController extends Controller if ($repository->canAddAmount($piggyBank, $amount)) { $repository->addAmount($piggyBank, $amount); Session::flash( - 'success', strval( - trans( - 'firefly.added_amount_to_piggy', - ['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name] - ) - ) + 'success', + strval( + trans( + 'firefly.added_amount_to_piggy', + ['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name] + ) + ) ); Preferences::mark(); @@ -304,12 +296,13 @@ class PiggyBankController extends Controller Log::error('Cannot add ' . $amount . ' because canAddAmount returned false.'); Session::flash( - 'error', strval( - trans( - 'firefly.cannot_add_amount_piggy', - ['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name] - ) - ) + 'error', + strval( + trans( + 'firefly.cannot_add_amount_piggy', + ['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name] + ) + ) ); return redirect(route('piggy-banks.index')); @@ -332,7 +325,8 @@ class PiggyBankController extends Controller 'success', strval( trans( - 'firefly.removed_amount_from_piggy', ['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name] + 'firefly.removed_amount_from_piggy', + ['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name] ) ) ); @@ -344,12 +338,13 @@ class PiggyBankController extends Controller $amount = strval(round($request->get('amount'), 12)); Session::flash( - 'error', strval( - trans( - 'firefly.cannot_remove_from_piggy', - ['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name] - ) - ) + 'error', + strval( + trans( + 'firefly.cannot_remove_from_piggy', + ['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name] + ) + ) ); return redirect(route('piggy-banks.index')); @@ -358,7 +353,6 @@ class PiggyBankController extends Controller /** * @param PiggyBank $piggyBank * - * * @return View */ public function remove(PiggyBank $piggyBank) @@ -367,7 +361,7 @@ class PiggyBankController extends Controller } /** - * Remove money from piggy bank (for mobile devices) + * Remove money from piggy bank (for mobile devices). * * @param PiggyBank $piggyBank * @@ -391,7 +385,6 @@ class PiggyBankController extends Controller $subTitle = e($piggyBank->name); return view('piggy-banks.show', compact('piggyBank', 'events', 'subTitle', 'note')); - } /** @@ -402,13 +395,17 @@ class PiggyBankController extends Controller */ public function store(PiggyBankFormRequest $request, PiggyBankRepositoryInterface $repository) { - $data = $request->getPiggyBankData(); + $data = $request->getPiggyBankData(); + if (null === $data['startdate']) { + $data['startdate'] = new Carbon; + } $piggyBank = $repository->store($data); + Session::flash('success', strval(trans('firefly.stored_piggy_bank', ['name' => $piggyBank->name]))); Preferences::mark(); - if (intval($request->get('create_another')) === 1) { + if (1 === intval($request->get('create_another'))) { // @codeCoverageIgnoreStart Session::put('piggy-banks.create.fromStore', true); @@ -434,7 +431,7 @@ class PiggyBankController extends Controller Session::flash('success', strval(trans('firefly.updated_piggy_bank', ['name' => $piggyBank->name]))); Preferences::mark(); - if (intval($request->get('return_to_edit')) === 1) { + if (1 === intval($request->get('return_to_edit'))) { // @codeCoverageIgnoreStart Session::put('piggy-banks.edit.fromUpdate', true); diff --git a/app/Http/Controllers/Popup/ReportController.php b/app/Http/Controllers/Popup/ReportController.php index 276f42dcc8..1b08f49932 100644 --- a/app/Http/Controllers/Popup/ReportController.php +++ b/app/Http/Controllers/Popup/ReportController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Popup; - use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collection\BalanceLine; @@ -39,13 +37,10 @@ use Response; use View; /** - * Class ReportController - * - * @package FireflyIII\Http\Controllers\Popup + * Class ReportController. */ class ReportController extends Controller { - /** @var AccountRepositoryInterface */ private $accountRepository; /** @var BudgetRepositoryInterface */ @@ -55,7 +50,6 @@ class ReportController extends Controller /** @var PopupReportInterface */ private $popupHelper; - /** * */ @@ -64,30 +58,28 @@ class ReportController extends Controller parent::__construct(); $this->middleware( function ($request, $next) { - - /** @var AccountRepositoryInterface $repository */ + // @var AccountRepositoryInterface $repository $this->accountRepository = app(AccountRepositoryInterface::class); - /** @var BudgetRepositoryInterface $repository */ + // @var BudgetRepositoryInterface $repository $this->budgetRepository = app(BudgetRepositoryInterface::class); - /** @var CategoryRepositoryInterface categoryRepository */ + // @var CategoryRepositoryInterface categoryRepository $this->categoryRepository = app(CategoryRepositoryInterface::class); - /** @var PopupReportInterface popupHelper */ + // @var PopupReportInterface popupHelper $this->popupHelper = app(PopupReportInterface::class); return $next($request); } ); - } - /** * @param Request $request * * @return \Illuminate\Http\JsonResponse + * * @throws FireflyException */ public function general(Request $request) @@ -119,14 +111,13 @@ class ReportController extends Controller } return Response::json(['html' => $html]); - - } /** * @param $attributes * * @return string + * * @throws FireflyException */ private function balanceAmount(array $attributes): string @@ -136,20 +127,20 @@ class ReportController extends Controller $account = $this->accountRepository->find(intval($attributes['accountId'])); switch (true) { - case ($role === BalanceLine::ROLE_DEFAULTROLE && !is_null($budget->id)): + case BalanceLine::ROLE_DEFAULTROLE === $role && null !== $budget->id: // normal row with a budget: $journals = $this->popupHelper->balanceForBudget($budget, $account, $attributes); break; - case ($role === BalanceLine::ROLE_DEFAULTROLE && is_null($budget->id)): + case BalanceLine::ROLE_DEFAULTROLE === $role && null === $budget->id: // normal row without a budget: $journals = $this->popupHelper->balanceForNoBudget($account, $attributes); $budget->name = strval(trans('firefly.no_budget')); break; - case ($role === BalanceLine::ROLE_DIFFROLE): + case BalanceLine::ROLE_DIFFROLE === $role: $journals = $this->popupHelper->balanceDifference($account, $attributes); $budget->name = strval(trans('firefly.leftUnbalanced')); break; - case ($role === BalanceLine::ROLE_TAGROLE): + case BalanceLine::ROLE_TAGROLE === $role: // row with tag info. throw new FireflyException('Firefly cannot handle this type of info-button (BalanceLine::TagRole)'); } @@ -164,6 +155,7 @@ class ReportController extends Controller * @param array $attributes * * @return string + * * @throws FireflyException */ private function budgetSpentAmount(array $attributes): string @@ -181,6 +173,7 @@ class ReportController extends Controller * @param $attributes * * @return string + * * @throws FireflyException */ private function categoryEntry(array $attributes): string @@ -198,6 +191,7 @@ class ReportController extends Controller * @param $attributes * * @return string + * * @throws FireflyException */ private function expenseEntry(array $attributes): string @@ -215,6 +209,7 @@ class ReportController extends Controller * @param $attributes * * @return string + * * @throws FireflyException */ private function incomeEntry(array $attributes): string @@ -230,6 +225,7 @@ class ReportController extends Controller * @param array $attributes * * @return array + * * @throws FireflyException */ private function parseAttributes(array $attributes): array @@ -248,8 +244,6 @@ class ReportController extends Controller throw new FireflyException('Could not parse start date "' . e($attributes['endDate']) . '".'); } - return $attributes; } - } diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index 0b605feb42..4dfa42d049 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -34,13 +33,10 @@ use Session; use View; /** - * Class PreferencesController - * - * @package FireflyIII\Http\Controllers + * Class PreferencesController. */ class PreferencesController extends Controller { - /** * */ @@ -48,7 +44,6 @@ class PreferencesController extends Controller { parent::__construct(); - $this->middleware( function ($request, $next) { View::share('title', trans('firefly.preferences')); @@ -71,7 +66,6 @@ class PreferencesController extends Controller Session::flash('two-factor-secret', $secret); $image = $google2fa->getQRCodeInline($domain, auth()->user()->email, $secret, 200); - return view('preferences.code', compact('image')); } @@ -107,15 +101,24 @@ class PreferencesController extends Controller $fiscalYearStart = date('Y') . '-' . $fiscalYearStartStr; $tjOptionalFields = Preferences::get('transaction_journal_optional_fields', [])->data; $is2faEnabled = Preferences::get('twoFactorAuthEnabled', 0)->data; // twoFactorAuthEnabled - $has2faSecret = !is_null(Preferences::get('twoFactorAuthSecret')); // hasTwoFactorAuthSecret - $showIncomplete = env('SHOW_INCOMPLETE_TRANSLATIONS', false) === true; + $has2faSecret = null !== Preferences::get('twoFactorAuthSecret'); // hasTwoFactorAuthSecret + $showIncomplete = true === env('SHOW_INCOMPLETE_TRANSLATIONS', false); return view( 'preferences.index', compact( - 'language', 'accounts', 'frontPageAccounts', 'tjOptionalFields', - 'viewRange', 'customFiscalYear', 'transactionPageSize', 'fiscalYearStart', 'is2faEnabled', - 'has2faSecret', 'showIncomplete', 'showDeps' + 'language', + 'accounts', + 'frontPageAccounts', + 'tjOptionalFields', + 'viewRange', + 'customFiscalYear', + 'transactionPageSize', + 'fiscalYearStart', + 'is2faEnabled', + 'has2faSecret', + 'showIncomplete', + 'showDeps' ) ); } @@ -139,7 +142,6 @@ class PreferencesController extends Controller /** * @param Request $request - * * @param UserRepositoryInterface $repository * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector @@ -163,13 +165,13 @@ class PreferencesController extends Controller Session::forget('range'); // custom fiscal year - $customFiscalYear = intval($request->get('customFiscalYear')) === 1; + $customFiscalYear = 1 === intval($request->get('customFiscalYear')); $fiscalYearStart = date('m-d', strtotime(strval($request->get('fiscalYearStart')))); Preferences::set('customFiscalYear', $customFiscalYear); Preferences::set('fiscalYearStart', $fiscalYearStart); // show deposits frontpage: - $showDepositsFrontpage = intval($request->get('showDepositsFrontpage')) === 1; + $showDepositsFrontpage = 1 === intval($request->get('showDepositsFrontpage')); Preferences::set('showDepositsFrontpage', $showDepositsFrontpage); // save page size: @@ -184,7 +186,7 @@ class PreferencesController extends Controller if (!$repository->hasRole(auth()->user(), 'demo')) { // two factor auth $twoFactorAuthEnabled = intval($request->get('twoFactorAuthEnabled')); - $hasTwoFactorAuthSecret = !is_null(Preferences::get('twoFactorAuthSecret')); + $hasTwoFactorAuthSecret = null !== Preferences::get('twoFactorAuthSecret'); // If we already have a secret, just set the two factor auth enabled to 1, and let the user continue with the existing secret. if ($hasTwoFactorAuthSecret) { @@ -213,13 +215,12 @@ class PreferencesController extends Controller ]; Preferences::set('transaction_journal_optional_fields', $optionalTj); - Session::flash('success', strval(trans('firefly.saved_preferences'))); Preferences::mark(); // if we don't have a valid secret yet, redirect to the code page. // AND USER HAS ACTUALLY ENABLED 2FA - if (!$hasTwoFactorAuthSecret && $twoFactorAuthEnabled === 1) { + if (!$hasTwoFactorAuthSecret && 1 === $twoFactorAuthEnabled) { return redirect(route('preferences.code')); } @@ -236,5 +237,4 @@ class PreferencesController extends Controller return $parts['host']; } - } diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 2a9e37caf4..959b46b342 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -35,15 +34,16 @@ use FireflyIII\Models\Preference; use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\User; use Hash; +use Illuminate\Contracts\Auth\Guard; use Log; use Preferences; use Session; use View; /** - * Class ProfileController + * Class ProfileController. * - * @package FireflyIII\Http\Controllers + * @method Guard guard() */ class ProfileController extends Controller { @@ -54,7 +54,6 @@ class ProfileController extends Controller { parent::__construct(); - $this->middleware( function ($request, $next) { View::share('title', trans('firefly.profile')); @@ -64,7 +63,6 @@ class ProfileController extends Controller } ); $this->middleware(IsLimitedUser::class)->except(['confirmEmailChange', 'undoEmailChange']); - } /** @@ -96,6 +94,7 @@ class ProfileController extends Controller * @param string $token * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * * @throws FireflyException */ public function confirmEmailChange(string $token) @@ -110,7 +109,7 @@ class ProfileController extends Controller } } // update user to clear blocked and blocked_code. - if (is_null($user)) { + if (null === $user) { throw new FireflyException('Invalid token.'); } $user->blocked = 0; @@ -137,7 +136,6 @@ class ProfileController extends Controller /** * @return View - * */ public function index() { @@ -146,7 +144,7 @@ class ProfileController extends Controller // get access token or create one. $accessToken = Preferences::get('access_token', null); - if (is_null($accessToken)) { + if (null === $accessToken) { $token = auth()->user()->generateAccessToken(); $accessToken = Preferences::set('access_token', $token); } @@ -172,7 +170,7 @@ class ProfileController extends Controller return redirect(route('profile.change-email'))->withInput(); } $existing = $repository->findByEmail($newEmail); - if (!is_null($existing)) { + if (null !== $existing) { // force user logout. $this->guard()->logout(); $request->session()->invalidate(); @@ -246,14 +244,13 @@ class ProfileController extends Controller Session::flash('gaEventCategory', 'user'); Session::flash('gaEventAction', 'delete-account'); - return redirect(route('index')); } /** * */ - function regenerate() + public function regenerate() { $token = auth()->user()->generateAccessToken(); Preferences::set('access_token', $token); @@ -266,6 +263,8 @@ class ProfileController extends Controller * @param string $token * @param string $hash * + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * * @throws FireflyException */ public function undoEmailChange(string $token, string $hash) @@ -279,7 +278,7 @@ class ProfileController extends Controller $user = $preference->user; } } - if (is_null($user)) { + if (null === $user) { throw new FireflyException('Invalid token.'); } @@ -294,7 +293,7 @@ class ProfileController extends Controller break; } } - if (is_null($match)) { + if (null === $match) { throw new FireflyException('Invalid token.'); } // change user back @@ -315,6 +314,7 @@ class ProfileController extends Controller * @param string $new * * @return bool + * * @throws ValidationException */ protected function validatePassword(User $user, string $current, string $new): bool @@ -328,8 +328,5 @@ class ProfileController extends Controller } return true; - } - - } diff --git a/app/Http/Controllers/Report/AccountController.php b/app/Http/Controllers/Report/AccountController.php index b2c0edeb8f..56215699f4 100644 --- a/app/Http/Controllers/Report/AccountController.php +++ b/app/Http/Controllers/Report/AccountController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Report; - use Carbon\Carbon; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Repositories\Account\AccountTaskerInterface; @@ -31,13 +29,10 @@ use FireflyIII\Support\CacheProperties; use Illuminate\Support\Collection; /** - * Class AccountController - * - * @package FireflyIII\Http\Controllers\Report + * Class AccountController. */ class AccountController extends Controller { - /** * @param Collection $accounts * @param Carbon $start diff --git a/app/Http/Controllers/Report/BalanceController.php b/app/Http/Controllers/Report/BalanceController.php index 5700d1e640..af4a0a629d 100644 --- a/app/Http/Controllers/Report/BalanceController.php +++ b/app/Http/Controllers/Report/BalanceController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Report; - use Carbon\Carbon; use FireflyIII\Helpers\Report\BalanceReportHelperInterface; use FireflyIII\Http\Controllers\Controller; @@ -31,13 +29,10 @@ use FireflyIII\Support\CacheProperties; use Illuminate\Support\Collection; /** - * Class BalanceController - * - * @package FireflyIII\Http\Controllers\Report + * Class BalanceController. */ class BalanceController extends Controller { - /** * @param BalanceReportHelperInterface $helper * @param Collection $accounts @@ -48,8 +43,6 @@ class BalanceController extends Controller */ public function general(BalanceReportHelperInterface $helper, Collection $accounts, Carbon $start, Carbon $end) { - - // chart properties for cache: $cache = new CacheProperties; $cache->addProperty($start); diff --git a/app/Http/Controllers/Report/BudgetController.php b/app/Http/Controllers/Report/BudgetController.php index 6ebe2a1928..60532b58fc 100644 --- a/app/Http/Controllers/Report/BudgetController.php +++ b/app/Http/Controllers/Report/BudgetController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Report; - use Carbon\Carbon; use FireflyIII\Helpers\Report\BudgetReportHelperInterface; use FireflyIII\Http\Controllers\Controller; @@ -33,14 +31,10 @@ use Illuminate\Support\Collection; use Navigation; /** - * Class BudgetController - * - * @package FireflyIII\Http\Controllers\Report + * Class BudgetController. */ class BudgetController extends Controller { - - /** * @param BudgetReportHelperInterface $helper * @param Collection $accounts @@ -51,7 +45,6 @@ class BudgetController extends Controller */ public function general(BudgetReportHelperInterface $helper, Collection $accounts, Carbon $start, Carbon $end) { - // chart properties for cache: $cache = new CacheProperties; $cache->addProperty($start); @@ -68,7 +61,6 @@ class BudgetController extends Controller $cache->store($result); return $result; - } /** @@ -105,7 +97,7 @@ class BudgetController extends Controller } /** - * Filters empty results from getBudgetPeriodReport + * Filters empty results from getBudgetPeriodReport. * * @param array $data * @@ -114,7 +106,7 @@ class BudgetController extends Controller private function filterBudgetPeriodReport(array $data): array { /** - * @var int $budgetId + * @var int * @var array $set */ foreach ($data as $budgetId => $set) { @@ -123,7 +115,7 @@ class BudgetController extends Controller $sum = bcadd($amount, $sum); } $data[$budgetId]['sum'] = $sum; - if (bccomp('0', $sum) === 0) { + if (0 === bccomp('0', $sum)) { unset($data[$budgetId]); } } diff --git a/app/Http/Controllers/Report/CategoryController.php b/app/Http/Controllers/Report/CategoryController.php index 5256c9a881..929b9eb0eb 100644 --- a/app/Http/Controllers/Report/CategoryController.php +++ b/app/Http/Controllers/Report/CategoryController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Report; - use Carbon\Carbon; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\Category; @@ -33,9 +31,7 @@ use Illuminate\Support\Collection; use Navigation; /** - * Class CategoryController - * - * @package FireflyIII\Http\Controllers\Report + * Class CategoryController. */ class CategoryController extends Controller { @@ -71,7 +67,6 @@ class CategoryController extends Controller } /** - * * @param Carbon $start * @param Carbon $end * @param Collection $accounts @@ -108,6 +103,7 @@ class CategoryController extends Controller * @param Carbon $end * * @return mixed|string + * * @internal param ReportHelperInterface $helper */ public function operations(Collection $accounts, Carbon $start, Carbon $end) @@ -129,7 +125,7 @@ class CategoryController extends Controller /** @var Category $category */ foreach ($categories as $category) { $spent = $repository->spentInPeriod(new Collection([$category]), $accounts, $start, $end); - if (bccomp($spent, '0') !== 0) { + if (0 !== bccomp($spent, '0')) { $report[$category->id] = ['name' => $category->name, 'spent' => $spent, 'id' => $category->id]; } } @@ -150,7 +146,7 @@ class CategoryController extends Controller } /** - * Filters empty results from category period report + * Filters empty results from category period report. * * @param array $data * @@ -164,14 +160,11 @@ class CategoryController extends Controller $sum = bcadd($amount, $sum); } $data[$categoryId]['sum'] = $sum; - if (bccomp('0', $sum) === 0) { + if (0 === bccomp('0', $sum)) { unset($data[$categoryId]); } } - return $data; } - - } diff --git a/app/Http/Controllers/Report/OperationsController.php b/app/Http/Controllers/Report/OperationsController.php index 6397ee6f16..860734891a 100644 --- a/app/Http/Controllers/Report/OperationsController.php +++ b/app/Http/Controllers/Report/OperationsController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Report; - use Carbon\Carbon; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Repositories\Account\AccountTaskerInterface; @@ -31,13 +29,10 @@ use FireflyIII\Support\CacheProperties; use Illuminate\Support\Collection; /** - * Class OperationsController - * - * @package FireflyIII\Http\Controllers\Report + * Class OperationsController. */ class OperationsController extends Controller { - /** * @param AccountTaskerInterface $tasker * @param Collection $accounts @@ -63,7 +58,6 @@ class OperationsController extends Controller $cache->store($result); return $result; - } /** @@ -92,7 +86,6 @@ class OperationsController extends Controller $cache->store($result); return $result; - } /** @@ -121,7 +114,8 @@ class OperationsController extends Controller array_map( function ($item) { return $item['sum']; - }, $incomes + }, + $incomes ) ); @@ -129,7 +123,8 @@ class OperationsController extends Controller array_map( function ($item) { return $item['sum']; - }, $expenses + }, + $expenses ) ); @@ -137,7 +132,5 @@ class OperationsController extends Controller $cache->store($result); return $result; - } - } diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 3b7a33b5d6..9a6d131f8b 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -42,9 +41,7 @@ use Session; use View; /** - * Class ReportController - * - * @package FireflyIII\Http\Controllers + * Class ReportController. */ class ReportController extends Controller { @@ -69,7 +66,6 @@ class ReportController extends Controller return $next($request); } ); - } /** @@ -89,22 +85,21 @@ class ReportController extends Controller } View::share( - 'subTitle', trans( - 'firefly.report_audit', - [ - 'start' => $start->formatLocalized($this->monthFormat), - 'end' => $end->formatLocalized($this->monthFormat), - ] - ) + 'subTitle', + trans( + 'firefly.report_audit', + [ + 'start' => $start->formatLocalized($this->monthFormat), + 'end' => $end->formatLocalized($this->monthFormat), + ] + ) ); - $generator = ReportGeneratorFactory::reportGenerator('Audit', $start, $end); $generator->setAccounts($accounts); $result = $generator->generate(); return $result; - } /** @@ -125,13 +120,14 @@ class ReportController extends Controller } View::share( - 'subTitle', trans( - 'firefly.report_budget', - [ - 'start' => $start->formatLocalized($this->monthFormat), - 'end' => $end->formatLocalized($this->monthFormat), - ] - ) + 'subTitle', + trans( + 'firefly.report_budget', + [ + 'start' => $start->formatLocalized($this->monthFormat), + 'end' => $end->formatLocalized($this->monthFormat), + ] + ) ); $generator = ReportGeneratorFactory::reportGenerator('Budget', $start, $end); @@ -140,7 +136,6 @@ class ReportController extends Controller $result = $generator->generate(); return $result; - } /** @@ -161,13 +156,14 @@ class ReportController extends Controller } View::share( - 'subTitle', trans( - 'firefly.report_category', - [ - 'start' => $start->formatLocalized($this->monthFormat), - 'end' => $end->formatLocalized($this->monthFormat), - ] - ) + 'subTitle', + trans( + 'firefly.report_category', + [ + 'start' => $start->formatLocalized($this->monthFormat), + 'end' => $end->formatLocalized($this->monthFormat), + ] + ) ); $generator = ReportGeneratorFactory::reportGenerator('Category', $start, $end); @@ -176,7 +172,6 @@ class ReportController extends Controller $result = $generator->generate(); return $result; - } /** @@ -197,13 +192,14 @@ class ReportController extends Controller } View::share( - 'subTitle', trans( - 'firefly.report_default', - [ - 'start' => $start->formatLocalized($this->monthFormat), - 'end' => $end->formatLocalized($this->monthFormat), - ] - ) + 'subTitle', + trans( + 'firefly.report_default', + [ + 'start' => $start->formatLocalized($this->monthFormat), + 'end' => $end->formatLocalized($this->monthFormat), + ] + ) ); $generator = ReportGeneratorFactory::reportGenerator('Standard', $start, $end); @@ -211,7 +207,6 @@ class ReportController extends Controller $result = $generator->generate(); return $result; - } /** @@ -228,7 +223,6 @@ class ReportController extends Controller $accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]); $accountList = join(',', $accounts->pluck('id')->toArray()); - return view('reports.index', compact('months', 'accounts', 'start', 'accountList', 'customFiscalYear')); } @@ -275,26 +269,26 @@ class ReportController extends Controller $tags = join(',', $request->getTagList()->pluck('tag')->toArray()); $uri = route('reports.index'); - if ($request->getAccountList()->count() === 0) { + if (0 === $request->getAccountList()->count()) { Log::debug('Account count is zero'); Session::flash('error', trans('firefly.select_more_than_one_account')); return redirect(route('reports.index')); } - if ($request->getCategoryList()->count() === 0 && $reportType === 'category') { + if (0 === $request->getCategoryList()->count() && 'category' === $reportType) { Session::flash('error', trans('firefly.select_more_than_one_category')); return redirect(route('reports.index')); } - if ($request->getBudgetList()->count() === 0 && $reportType === 'budget') { + if (0 === $request->getBudgetList()->count() && 'budget' === $reportType) { Session::flash('error', trans('firefly.select_more_than_one_budget')); return redirect(route('reports.index')); } - if ($request->getTagList()->count() === 0 && $reportType === 'tag') { + if (0 === $request->getTagList()->count() && 'tag' === $reportType) { Session::flash('error', trans('firefly.select_more_than_one_tag')); return redirect(route('reports.index')); @@ -343,13 +337,14 @@ class ReportController extends Controller } View::share( - 'subTitle', trans( - 'firefly.report_tag', - [ - 'start' => $start->formatLocalized($this->monthFormat), - 'end' => $end->formatLocalized($this->monthFormat), - ] - ) + 'subTitle', + trans( + 'firefly.report_tag', + [ + 'start' => $start->formatLocalized($this->monthFormat), + 'end' => $end->formatLocalized($this->monthFormat), + ] + ) ); $generator = ReportGeneratorFactory::reportGenerator('Tag', $start, $end); @@ -358,7 +353,6 @@ class ReportController extends Controller $result = $generator->generate(); return $result; - } /** @@ -372,7 +366,6 @@ class ReportController extends Controller $result = view('reports.options.budget', compact('budgets'))->render(); return $result; - } /** @@ -386,7 +379,6 @@ class ReportController extends Controller $result = view('reports.options.category', compact('categories'))->render(); return $result; - } /** @@ -412,6 +404,5 @@ class ReportController extends Controller $result = view('reports.options.tag', compact('tags'))->render(); return $result; - } } diff --git a/app/Http/Controllers/RuleController.php b/app/Http/Controllers/RuleController.php index d96c883d66..aeec282409 100644 --- a/app/Http/Controllers/RuleController.php +++ b/app/Http/Controllers/RuleController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -45,9 +44,7 @@ use Session; use View; /** - * Class RuleController - * - * @package FireflyIII\Http\Controllers + * Class RuleController. */ class RuleController extends Controller { @@ -58,7 +55,6 @@ class RuleController extends Controller { parent::__construct(); - $this->middleware( function ($request, $next) { View::share('title', trans('firefly.rules')); @@ -102,7 +98,7 @@ class RuleController extends Controller $subTitle = trans('firefly.make_new_rule', ['title' => $ruleGroup->title]); // put previous url in session if not redirect from store (not "create another"). - if (session('rules.create.fromStore') !== true) { + if (true !== session('rules.create.fromStore')) { $this->rememberPreviousUri('rules.create.uri'); } Session::forget('rules.create.fromStore'); @@ -110,7 +106,8 @@ class RuleController extends Controller Session::flash('gaEventAction', 'create-rule'); return view( - 'rules.rule.create', compact('subTitleIcon', 'oldTriggers', 'oldActions', 'triggerCount', 'actionCount', 'ruleGroup', 'subTitle') + 'rules.rule.create', + compact('subTitleIcon', 'oldTriggers', 'oldActions', 'triggerCount', 'actionCount', 'ruleGroup', 'subTitle') ); } @@ -143,7 +140,6 @@ class RuleController extends Controller */ public function destroy(RuleRepositoryInterface $repository, Rule $rule) { - $title = $rule->title; $repository->destroy($rule); @@ -164,7 +160,6 @@ class RuleController extends Controller $repository->moveDown($rule); return redirect(route('rules.index')); - } /** @@ -192,7 +187,7 @@ class RuleController extends Controller } // overrule old input when it as no rule data: - if ($triggerCount === 0 && $actionCount === 0) { + if (0 === $triggerCount && 0 === $actionCount) { $oldTriggers = $this->getCurrentTriggers($rule); $triggerCount = count($oldTriggers); $oldActions = $this->getCurrentActions($rule); @@ -204,7 +199,7 @@ class RuleController extends Controller $subTitle = trans('firefly.edit_rule', ['title' => $rule->title]); // put previous url in session if not redirect from store (not "return_to_edit"). - if (session('rules.edit.fromUpdate') !== true) { + if (true !== session('rules.edit.fromUpdate')) { $this->rememberPreviousUri('rules.edit.uri'); } Session::forget('rules.edit.fromUpdate'); @@ -212,21 +207,29 @@ class RuleController extends Controller Session::flash('gaEventAction', 'edit-rule'); return view( - 'rules.rule.edit', compact( - 'rule', 'subTitle', - 'primaryTrigger', 'oldTriggers', 'oldActions', 'triggerCount', 'actionCount', 'ruleGroups' - ) + 'rules.rule.edit', + compact( + 'rule', + 'subTitle', + 'primaryTrigger', + 'oldTriggers', + 'oldActions', + 'triggerCount', + 'actionCount', + 'ruleGroups' + ) ); } /** - * Execute the given rule on a set of existing transactions + * Execute the given rule on a set of existing transactions. * * @param SelectTransactionsRequest $request * @param AccountRepositoryInterface $repository * @param Rule $rule * * @return \Illuminate\Http\RedirectResponse + * * @internal param RuleGroup $ruleGroup */ public function execute(SelectTransactionsRequest $request, AccountRepositoryInterface $repository, Rule $rule) @@ -283,7 +286,6 @@ class RuleController extends Controller } return Response::json('true'); - } /** @@ -301,7 +303,6 @@ class RuleController extends Controller } return Response::json('true'); - } /** @@ -339,7 +340,7 @@ class RuleController extends Controller Session::flash('success', trans('firefly.stored_new_rule', ['title' => $rule->title])); Preferences::mark(); - if (intval($request->get('create_another')) === 1) { + if (1 === intval($request->get('create_another'))) { // @codeCoverageIgnoreStart Session::put('rules.create.fromStore', true); @@ -367,7 +368,7 @@ class RuleController extends Controller // build trigger array from response $triggers = $this->getValidTriggerList($request); - if (count($triggers) === 0) { + if (0 === count($triggers)) { return Response::json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]); } @@ -386,7 +387,7 @@ class RuleController extends Controller if (count($matchingTransactions) === $limit) { $warning = trans('firefly.warning_transaction_subset', ['max_num_transactions' => $limit]); } - if (count($matchingTransactions) === 0) { + if (0 === count($matchingTransactions)) { $warning = trans('firefly.warning_no_matching_transactions', ['num_transactions' => $range]); } @@ -411,10 +412,9 @@ class RuleController extends Controller */ public function testTriggersByRule(Rule $rule) { - $triggers = $rule->ruleTriggers; - if (count($triggers) === 0) { + if (0 === count($triggers)) { return Response::json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]); } @@ -433,7 +433,7 @@ class RuleController extends Controller if (count($matchingTransactions) === $limit) { $warning = trans('firefly.warning_transaction_subset', ['max_num_transactions' => $limit]); } - if (count($matchingTransactions) === 0) { + if (0 === count($matchingTransactions)) { $warning = trans('firefly.warning_no_matching_transactions', ['num_transactions' => $range]); } @@ -454,7 +454,6 @@ class RuleController extends Controller $repository->moveUp($rule); return redirect(route('rules.index')); - } /** @@ -472,7 +471,7 @@ class RuleController extends Controller Session::flash('success', trans('firefly.updated_rule', ['title' => $rule->title])); Preferences::mark(); - if (intval($request->get('return_to_edit')) === 1) { + if (1 === intval($request->get('return_to_edit'))) { // @codeCoverageIgnoreStart Session::put('rules.edit.fromUpdate', true); @@ -488,7 +487,7 @@ class RuleController extends Controller /** @var RuleRepositoryInterface $repository */ $repository = app(RuleRepositoryInterface::class); - if ($repository->count() === 0) { + if (0 === $repository->count()) { $data = [ 'rule_group_id' => $repository->getFirstRuleGroup()->id, 'stop_processing' => 0, @@ -510,7 +509,6 @@ class RuleController extends Controller $repository->store($data); } - } /** @@ -518,11 +516,10 @@ class RuleController extends Controller */ private function createDefaultRuleGroup() { - /** @var RuleGroupRepositoryInterface $repository */ $repository = app(RuleGroupRepositoryInterface::class); - if ($repository->count() === 0) { + if (0 === $repository->count()) { $data = [ 'title' => trans('firefly.default_rule_group_name'), 'description' => trans('firefly.default_rule_group_description'), @@ -554,7 +551,7 @@ class RuleController extends Controller 'count' => $count, ] )->render(); - $index++; + ++$index; } return $actions; @@ -572,7 +569,7 @@ class RuleController extends Controller /** @var RuleTrigger $entry */ foreach ($rule->ruleTriggers as $entry) { - if ($entry->trigger_type !== 'user_action') { + if ('user_action' !== $entry->trigger_type) { $count = ($index + 1); $triggers[] = view( 'rules.partials.trigger', @@ -583,7 +580,7 @@ class RuleController extends Controller 'count' => $count, ] )->render(); - $index++; + ++$index; } } @@ -613,7 +610,7 @@ class RuleController extends Controller 'count' => $count, ] )->render(); - $newIndex++; + ++$newIndex; } return $actions; @@ -642,7 +639,7 @@ class RuleController extends Controller 'count' => $count, ] )->render(); - $newIndex++; + ++$newIndex; } return $triggers; @@ -655,7 +652,6 @@ class RuleController extends Controller */ private function getValidTriggerList(TestRuleFormRequest $request): array { - $triggers = []; $data = [ 'rule-triggers' => $request->get('rule-trigger'), @@ -668,13 +664,11 @@ class RuleController extends Controller $triggers[] = [ 'type' => $triggerType, 'value' => $data['rule-trigger-values'][$index], - 'stopProcessing' => intval($data['rule-trigger-stop'][$index]) === 1 ? true : false, + 'stopProcessing' => 1 === intval($data['rule-trigger-stop'][$index]) ? true : false, ]; } } return $triggers; } - - } diff --git a/app/Http/Controllers/RuleGroupController.php b/app/Http/Controllers/RuleGroupController.php index 6e0d16f0fd..0ba9141041 100644 --- a/app/Http/Controllers/RuleGroupController.php +++ b/app/Http/Controllers/RuleGroupController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -38,9 +37,7 @@ use Session; use View; /** - * Class RuleGroupController - * - * @package FireflyIII\Http\Controllers + * Class RuleGroupController. */ class RuleGroupController extends Controller { @@ -51,7 +48,6 @@ class RuleGroupController extends Controller { parent::__construct(); - $this->middleware( function ($request, $next) { View::share('title', trans('firefly.rules')); @@ -71,7 +67,7 @@ class RuleGroupController extends Controller $subTitle = trans('firefly.make_new_rule_group'); // put previous url in session if not redirect from store (not "create another"). - if (session('rule-groups.create.fromStore') !== true) { + if (true !== session('rule-groups.create.fromStore')) { $this->rememberPreviousUri('rule-groups.create.uri'); } Session::forget('rule-groups.create.fromStore'); @@ -111,13 +107,11 @@ class RuleGroupController extends Controller */ public function destroy(Request $request, RuleGroupRepositoryInterface $repository, RuleGroup $ruleGroup) { - $title = $ruleGroup->title; $moveTo = auth()->user()->ruleGroups()->find(intval($request->get('move_rules_before_delete'))); $repository->destroy($ruleGroup, $moveTo); - Session::flash('success', strval(trans('firefly.deleted_rule_group', ['title' => $title]))); Preferences::mark(); @@ -135,7 +129,6 @@ class RuleGroupController extends Controller $repository->moveDown($ruleGroup); return redirect(route('rules.index')); - } /** @@ -148,7 +141,7 @@ class RuleGroupController extends Controller $subTitle = trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]); // put previous url in session if not redirect from store (not "return_to_edit"). - if (session('rule-groups.edit.fromUpdate') !== true) { + if (true !== session('rule-groups.edit.fromUpdate')) { $this->rememberPreviousUri('rule-groups.edit.uri'); } Session::forget('rule-groups.edit.fromUpdate'); @@ -156,11 +149,10 @@ class RuleGroupController extends Controller Session::flash('gaEventAction', 'edit-rule-group'); return view('rules.rule-group.edit', compact('ruleGroup', 'subTitle')); - } /** - * Execute the given rulegroup on a set of existing transactions + * Execute the given rulegroup on a set of existing transactions. * * @param SelectTransactionsRequest $request * @param AccountRepositoryInterface $repository @@ -226,7 +218,7 @@ class RuleGroupController extends Controller Session::flash('success', strval(trans('firefly.created_new_rule_group', ['title' => $ruleGroup->title]))); Preferences::mark(); - if (intval($request->get('create_another')) === 1) { + if (1 === intval($request->get('create_another'))) { // @codeCoverageIgnoreStart Session::put('rule-groups.create.fromStore', true); @@ -248,7 +240,6 @@ class RuleGroupController extends Controller $repository->moveUp($ruleGroup); return redirect(route('rules.index')); - } /** @@ -263,7 +254,7 @@ class RuleGroupController extends Controller $data = [ 'title' => $request->input('title'), 'description' => $request->input('description'), - 'active' => intval($request->input('active')) === 1, + 'active' => 1 === intval($request->input('active')), ]; $repository->update($ruleGroup, $data); @@ -271,7 +262,7 @@ class RuleGroupController extends Controller Session::flash('success', strval(trans('firefly.updated_rule_group', ['title' => $ruleGroup->title]))); Preferences::mark(); - if (intval($request->get('return_to_edit')) === 1) { + if (1 === intval($request->get('return_to_edit'))) { // @codeCoverageIgnoreStart Session::put('rule-groups.edit.fromUpdate', true); @@ -281,6 +272,5 @@ class RuleGroupController extends Controller // redirect to previous URL. return redirect($this->getPreviousUri('rule-groups.edit.uri')); - } } diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index b276c7b94e..aebb061620 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -26,13 +25,12 @@ namespace FireflyIII\Http\Controllers; use FireflyIII\Support\CacheProperties; use FireflyIII\Support\Search\SearchInterface; use Illuminate\Http\Request; +use Illuminate\Support\Collection; use Response; use View; /** - * Class SearchController - * - * @package FireflyIII\Http\Controllers + * Class SearchController. */ class SearchController extends Controller { @@ -51,7 +49,6 @@ class SearchController extends Controller return $next($request); } ); - } /** @@ -74,8 +71,8 @@ class SearchController extends Controller public function search(Request $request, SearchInterface $searcher) { - $fullQuery = strval($request->get('query')); - + $fullQuery = strval($request->get('query')); + $transactions = new Collection; // cache $cache = new CacheProperties; $cache->addProperty('search'); @@ -96,8 +93,5 @@ class SearchController extends Controller $html = view('search.search', compact('transactions'))->render(); return Response::json(['count' => $transactions->count(), 'html' => $html]); - - } - } diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index caa3266a3a..550b67574d 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -38,7 +37,7 @@ use Session; use View; /** - * Class TagController + * 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. @@ -47,13 +46,10 @@ use View; * 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 { - - /** @var TagRepositoryInterface */ + /** @var TagRepositoryInterface */ protected $repository; /** @@ -88,7 +84,7 @@ class TagController extends Controller $apiKey = env('GOOGLE_MAPS_API_KEY', ''); // put previous url in session if not redirect from store (not "create another"). - if (session('tags.create.fromStore') !== true) { + if (true !== session('tags.create.fromStore')) { $this->rememberPreviousUri('tags.create.uri'); } Session::forget('tags.create.fromStore'); @@ -99,7 +95,7 @@ class TagController extends Controller } /** - * Delete a tag + * Delete a tag. * * @param Tag $tag * @@ -124,7 +120,6 @@ class TagController extends Controller */ public function destroy(Tag $tag) { - $tagName = $tag->tag; $this->repository->destroy($tag); @@ -135,7 +130,7 @@ class TagController extends Controller } /** - * Edit a tag + * Edit a tag. * * @param Tag $tag * @@ -148,7 +143,7 @@ class TagController extends Controller $apiKey = env('GOOGLE_MAPS_API_KEY', ''); // put previous url in session if not redirect from store (not "return_to_edit"). - if (session('tags.edit.fromUpdate') !== true) { + if (true !== session('tags.edit.fromUpdate')) { $this->rememberPreviousUri('tags.edit.uri'); } Session::forget('tags.edit.fromUpdate'); @@ -159,7 +154,7 @@ class TagController extends Controller } /** - * View all tags + * View all tags. * * @param TagRepositoryInterface $repository * @@ -171,13 +166,13 @@ class TagController extends Controller $oldestTag = $repository->oldestTag(); /** @var Carbon $start */ $start = new Carbon; - if (!is_null($oldestTag)) { + if (null !== $oldestTag) { /** @var Carbon $start */ $start = $oldestTag->date; } - if (is_null($oldestTag)) { + if (null === $oldestTag) { /** @var Carbon $start */ - $start = clone(session('first')); + $start = clone session('first'); } $now = new Carbon; @@ -217,7 +212,7 @@ class TagController extends Controller $path = route('tags.show', [$tag->id]); // prep for "all" view. - if ($moment === 'all') { + if ('all' === $moment) { $subTitle = trans('firefly.all_journals_for_tag', ['tag' => $tag->tag]); $start = $repository->firstUseDate($tag); $end = new Carbon; @@ -225,20 +220,20 @@ class TagController extends Controller } // prep for "specific date" view. - if (strlen($moment) > 0 && $moment !== 'all') { + if (strlen($moment) > 0 && 'all' !== $moment) { $start = new Carbon($moment); $end = Navigation::endOfPeriod($start, $range); $subTitle = trans( 'firefly.journals_in_period_for_tag', ['tag' => $tag->tag, - 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)] + 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat),] ); $periods = $this->getPeriodOverview($tag); $path = route('tags.show', [$tag->id, $moment]); } // prep for current period - if (strlen($moment) === 0) { + if (0 === strlen($moment)) { /** @var Carbon $start */ $start = clone session('start', Navigation::startOfPeriod(new Carbon, $range)); /** @var Carbon $end */ @@ -254,12 +249,12 @@ class TagController extends Controller $collector = app(JournalCollectorInterface::class); $collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withOpposingAccount() ->setTag($tag)->withBudgetInformation()->withCategoryInformation()->removeFilter(InternalTransferFilter::class); - $journals = $collector->getPaginatedJournals(); - $journals->setPath($path); + $transactions = $collector->getPaginatedJournals(); + $transactions->setPath($path); $sums = $repository->sumsOfTag($tag, $start, $end); - return view('tags.show', compact('apiKey', 'tag', 'sums', 'periods', 'subTitle', 'subTitleIcon', 'journals', 'start', 'end', 'moment')); + return view('tags.show', compact('apiKey', 'tag', 'sums', 'periods', 'subTitle', 'subTitleIcon', 'transactions', 'start', 'end', 'moment')); } /** @@ -275,7 +270,7 @@ class TagController extends Controller Session::flash('success', strval(trans('firefly.created_tag', ['tag' => $data['tag']]))); Preferences::mark(); - if (intval($request->get('create_another')) === 1) { + if (1 === intval($request->get('create_another'))) { // @codeCoverageIgnoreStart Session::put('tags.create.fromStore', true); @@ -284,7 +279,6 @@ class TagController extends Controller } return redirect($this->getPreviousUri('tags.create.uri')); - } /** @@ -301,7 +295,7 @@ class TagController extends Controller Session::flash('success', strval(trans('firefly.updated_tag', ['tag' => $data['tag']]))); Preferences::mark(); - if (intval($request->get('return_to_edit')) === 1) { + if (1 === intval($request->get('return_to_edit'))) { // @codeCoverageIgnoreStart Session::put('tags.edit.fromUpdate', true); @@ -356,8 +350,5 @@ class TagController extends Controller $cache->store($collection); return $collection; - } - - } diff --git a/app/Http/Controllers/Transaction/ConvertController.php b/app/Http/Controllers/Transaction/ConvertController.php index 9bb9c222e4..c6c2b62b1f 100644 --- a/app/Http/Controllers/Transaction/ConvertController.php +++ b/app/Http/Controllers/Transaction/ConvertController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Transaction; @@ -37,13 +36,11 @@ use Session; use View; /** - * Class ConvertController - * - * @package FireflyIII\Http\Controllers\Transaction + * Class ConvertController. */ class ConvertController extends Controller { - /** @var AccountRepositoryInterface */ + /** @var AccountRepositoryInterface */ private $accounts; /** @@ -107,14 +104,19 @@ class ConvertController extends Controller return view( 'transactions.convert', compact( - 'sourceType', 'destinationType', 'journal', 'assetAccounts', - 'positiveAmount', 'sourceAccount', 'destinationAccount', 'sourceType', - 'subTitle', 'subTitleIcon' - + 'sourceType', + 'destinationType', + 'journal', + 'assetAccounts', + 'positiveAmount', + 'sourceAccount', + 'destinationAccount', + 'sourceType', + 'subTitle', + 'subTitleIcon' ) ); - // convert withdrawal to deposit requires a new source account () // or to transfer requires } @@ -171,6 +173,7 @@ class ConvertController extends Controller * @param array $data * * @return Account + * * @throws FireflyException */ private function getDestinationAccount(TransactionJournal $journal, TransactionType $destinationType, array $data): Account @@ -195,7 +198,7 @@ class ConvertController extends Controller case TransactionType::DEPOSIT . '-' . TransactionType::WITHDRAWAL: case TransactionType::TRANSFER . '-' . TransactionType::WITHDRAWAL: // three and five - if ($data['destination_account_expense'] === '' || is_null($data['destination_account_expense'])) { + if ('' === $data['destination_account_expense'] || null === $data['destination_account_expense']) { // destination is a cash account. $destination = $accountRepository->getCashAccount(); @@ -226,6 +229,7 @@ class ConvertController extends Controller * @param array $data * * @return Account + * * @throws FireflyException */ private function getSourceAccount(TransactionJournal $journal, TransactionType $destinationType, array $data): Account @@ -242,7 +246,7 @@ class ConvertController extends Controller case TransactionType::WITHDRAWAL . '-' . TransactionType::DEPOSIT: case TransactionType::TRANSFER . '-' . TransactionType::DEPOSIT: - if ($data['source_account_revenue'] === '' || is_null($data['source_account_revenue'])) { + if ('' === $data['source_account_revenue'] || null === $data['source_account_revenue']) { // destination is a cash account. $destination = $accountRepository->getCashAccount(); @@ -271,7 +275,5 @@ class ConvertController extends Controller } return $source; - } - } diff --git a/app/Http/Controllers/Transaction/LinkController.php b/app/Http/Controllers/Transaction/LinkController.php index cf86c8c639..866924014a 100644 --- a/app/Http/Controllers/Transaction/LinkController.php +++ b/app/Http/Controllers/Transaction/LinkController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Transaction; - use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Requests\JournalLinkRequest; use FireflyIII\Models\TransactionJournal; @@ -37,14 +35,10 @@ use URL; use View; /** - * Class LinkController - * - * @package FireflyIII\Http\Controllers\Transaction + * Class LinkController. */ class LinkController extends Controller { - - /** * */ @@ -60,10 +54,8 @@ class LinkController extends Controller return $next($request); } ); - } - /** * @param TransactionJournalLink $link * @@ -103,10 +95,13 @@ class LinkController extends Controller * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function store( - JournalLinkRequest $request, LinkTypeRepositoryInterface $repository, JournalRepositoryInterface $journalRepository, TransactionJournal $journal + JournalLinkRequest $request, + LinkTypeRepositoryInterface $repository, + JournalRepositoryInterface $journalRepository, + TransactionJournal $journal ) { $linkInfo = $request->getLinkInfo(); - if ($linkInfo['transaction_journal_id'] === 0) { + if (0 === $linkInfo['transaction_journal_id']) { Session::flash('error', trans('firefly.invalid_link_selection')); return redirect(route('transactions.show', [$journal->id])); @@ -123,13 +118,13 @@ class LinkController extends Controller $journalLink = new TransactionJournalLink; $journalLink->linkType()->associate($linkType); - if ($linkInfo['direction'] === 'inward') { + if ('inward' === $linkInfo['direction']) { Log::debug(sprintf('Link type is inwards ("%s"), so %d is source and %d is destination.', $linkType->inward, $other->id, $journal->id)); $journalLink->source()->associate($other); $journalLink->destination()->associate($journal); } - if ($linkInfo['direction'] === 'outward') { + if ('outward' === $linkInfo['direction']) { Log::debug(sprintf('Link type is inwards ("%s"), so %d is source and %d is destination.', $linkType->outward, $journal->id, $other->id)); $journalLink->source()->associate($journal); $journalLink->destination()->associate($other); @@ -148,12 +143,10 @@ class LinkController extends Controller * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ - public function switch(LinkTypeRepositoryInterface $repository, TransactionJournalLink $link) + public function switchLink(LinkTypeRepositoryInterface $repository, TransactionJournalLink $link) { - $repository->switchLink($link); return redirect(URL::previous()); } - } diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php index 55ba4bf140..ed25b29bf6 100644 --- a/app/Http/Controllers/Transaction/MassController.php +++ b/app/Http/Controllers/Transaction/MassController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Transaction; @@ -39,9 +38,7 @@ use Session; use View; /** - * Class MassController - * - * @package FireflyIII\Http\Controllers\Transaction + * Class MassController. */ class MassController extends Controller { @@ -52,7 +49,6 @@ class MassController extends Controller { parent::__construct(); - $this->middleware( function ($request, $next) { View::share('title', trans('firefly.transactions')); @@ -78,7 +74,6 @@ class MassController extends Controller Session::flash('gaEventAction', 'mass-delete'); return view('transactions.mass-delete', compact('journals', 'subTitle')); - } /** @@ -96,7 +91,7 @@ class MassController extends Controller foreach ($ids as $journalId) { /** @var TransactionJournal $journal */ $journal = $repository->find(intval($journalId)); - if (!is_null($journal->id) && intval($journalId) === $journal->id) { + if (null !== $journal->id && intval($journalId) === $journal->id) { $set->push($journal); } } @@ -107,7 +102,7 @@ class MassController extends Controller /** @var TransactionJournal $journal */ foreach ($set as $journal) { $repository->delete($journal); - $count++; + ++$count; } Preferences::mark(); @@ -115,10 +110,8 @@ class MassController extends Controller // redirect to previous URL: return redirect($this->getPreviousUri('transactions.mass-delete.uri')); - } - /** * @param Collection $journals * @@ -140,9 +133,7 @@ class MassController extends Controller // skip transactions that have multiple destinations, multiple sources or are an opening balance. $filtered = new Collection; $messages = []; - /** - * @var TransactionJournal $journal - */ + // @var TransactionJournal foreach ($journals as $journal) { $sources = $journal->sourceAccountList(); $destinations = $journal->destinationAccountList(); @@ -155,10 +146,17 @@ class MassController extends Controller $messages[] = trans('firefly.cannot_edit_multiple_dest', ['description' => $journal->description, 'id' => $journal->id]); continue; } - if ($journal->transactionType->type === TransactionType::OPENING_BALANCE) { + if (TransactionType::OPENING_BALANCE === $journal->transactionType->type) { $messages[] = trans('firefly.cannot_edit_opening_balance'); continue; } + + // cannot edit reconciled transactions / journals: + if ($journal->transactions->first()->reconciled) { + $messages[] = trans('firefly.cannot_edit_reconciled', ['description' => $journal->description, 'id' => $journal->id]); + continue; + } + $filtered->push($journal); } @@ -186,18 +184,18 @@ class MassController extends Controller $journal->foreign_amount = floatval($transaction->foreign_amount); $journal->foreign_currency = $transaction->foreignCurrency; - if (!is_null($sources->first())) { + if (null !== $sources->first()) { $journal->source_account_id = $sources->first()->id; $journal->source_account_name = $sources->first()->editname; } - if (!is_null($destinations->first())) { + if (null !== $destinations->first()) { $journal->destination_account_id = $destinations->first()->id; $journal->destination_account_name = $destinations->first()->editname; } } ); - if ($filtered->count() === 0) { + if (0 === $filtered->count()) { Session::flash('error', trans('firefly.no_edit_multiple_left')); } @@ -260,16 +258,14 @@ class MassController extends Controller // call repository update function. $repository->update($journal, $data); - $count++; + ++$count; } } - } Preferences::mark(); Session::flash('success', trans('firefly.mass_edited_transactions_success', ['amount' => $count])); // redirect to previous URL: return redirect($this->getPreviousUri('transactions.mass-edit.uri')); - } } diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.php index 1d774223e3..8e746e85e3 100644 --- a/app/Http/Controllers/Transaction/SingleController.php +++ b/app/Http/Controllers/Transaction/SingleController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Transaction; - use Carbon\Carbon; use ExpandedForm; use FireflyIII\Events\StoredTransactionJournal; @@ -42,33 +40,31 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; +use Illuminate\Http\Request; use Log; use Preferences; use Session; -use Steam; use View; /** - * Class SingleController - * - * @package FireflyIII\Http\Controllers\Transaction + * Class SingleController. */ class SingleController extends Controller { - /** @var AccountRepositoryInterface */ + /** @var AccountRepositoryInterface */ private $accounts; /** @var AttachmentHelperInterface */ private $attachments; - /** @var BudgetRepositoryInterface */ + /** @var BudgetRepositoryInterface */ private $budgets; - /** @var CurrencyRepositoryInterface */ + /** @var CurrencyRepositoryInterface */ private $currency; - /** @var PiggyBankRepositoryInterface */ + /** @var PiggyBankRepositoryInterface */ private $piggyBanks; - /** @var JournalRepositoryInterface */ + /** @var JournalRepositoryInterface */ private $repository; /** @@ -78,8 +74,8 @@ class SingleController extends Controller { parent::__construct(); - $maxFileSize = Steam::phpBytes(ini_get('upload_max_filesize')); - $maxPostSize = Steam::phpBytes(ini_get('post_max_size')); + $maxFileSize = app('steam')->phpBytes(ini_get('upload_max_filesize')); + $maxPostSize = app('steam')->phpBytes(ini_get('post_max_size')); $uploadSize = min($maxFileSize, $maxPostSize); View::share('uploadSize', $uploadSize); @@ -99,7 +95,6 @@ class SingleController extends Controller return $next($request); } ); - } public function cloneTransaction(TransactionJournal $journal) @@ -107,14 +102,14 @@ class SingleController extends Controller $source = $journal->sourceAccountList()->first(); $destination = $journal->destinationAccountList()->first(); $budget = $journal->budgets()->first(); - $budgetId = is_null($budget) ? 0 : $budget->id; + $budgetId = null === $budget ? 0 : $budget->id; $category = $journal->categories()->first(); - $categoryName = is_null($category) ? '' : $category->name; + $categoryName = null === $category ? '' : $category->name; $tags = join(',', $journal->tags()->get()->pluck('tag')->toArray()); /** @var Transaction $transaction */ $transaction = $journal->transactions()->first(); - $amount = Steam::positive($transaction->amount); - $foreignAmount = is_null($transaction->foreign_amount) ? null : Steam::positive($transaction->foreign_amount); + $amount = app('steam')->positive($transaction->amount); + $foreignAmount = null === $transaction->foreign_amount ? null : app('steam')->positive($transaction->foreign_amount); $preFilled = [ 'description' => $journal->description, @@ -144,7 +139,7 @@ class SingleController extends Controller /** @var Note $note */ $note = $journal->notes()->first(); - if (!is_null($note)) { + if (null !== $note) { $preFilled['notes'] = $note->text; } @@ -158,10 +153,10 @@ class SingleController extends Controller * * @return View */ - public function create(string $what = TransactionType::DEPOSIT) + public function create(Request $request, string $what = TransactionType::DEPOSIT) { $what = strtolower($what); - $uploadSize = min(Steam::phpBytes(ini_get('upload_max_filesize')), Steam::phpBytes(ini_get('post_max_size'))); + $what = $request->old('what') ?? $what; $assetAccounts = $this->groupedActiveAccountList(); $budgets = ExpandedForm::makeSelectListWithEmpty($this->budgets->getActiveBudgets()); $piggyBanks = $this->piggyBanks->getPiggyBanksWithAmount(); @@ -174,7 +169,7 @@ class SingleController extends Controller Session::put('preFilled', $preFilled); // put previous url in session if not redirect from store (not "create another"). - if (session('transactions.create.fromStore') !== true) { + if (true !== session('transactions.create.fromStore')) { $this->rememberPreviousUri('transactions.create.uri'); } Session::forget('transactions.create.fromStore'); @@ -185,7 +180,7 @@ class SingleController extends Controller return view( 'transactions.single.create', - compact('assetAccounts', 'subTitleIcon', 'uploadSize', 'budgets', 'what', 'piggies', 'subTitle', 'optionalFields', 'preFilled') + compact('assetAccounts', 'subTitleIcon', 'budgets', 'what', 'piggies', 'subTitle', 'optionalFields', 'preFilled') ); } @@ -214,14 +209,13 @@ class SingleController extends Controller Session::flash('gaEventAction', 'delete-' . $what); return view('transactions.single.delete', compact('journal', 'subTitle', 'what')); - - } /** * @param TransactionJournal $transactionJournal * * @return \Illuminate\Http\RedirectResponse + * * @internal param JournalRepositoryInterface $repository */ public function destroy(TransactionJournal $transactionJournal) @@ -261,6 +255,10 @@ class SingleController extends Controller $assetAccounts = $this->groupedAccountList(); $budgetList = ExpandedForm::makeSelectListWithEmpty($this->budgets->getBudgets()); + if ($journal->transactionType->type === TransactionType::RECONCILIATION) { + return redirect(route('accounts.reconcile.edit', [$journal->id])); + } + // view related code $subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]); @@ -269,7 +267,7 @@ class SingleController extends Controller $destinationAccounts = $journal->destinationAccountList(); $optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data; $pTransaction = $journal->positiveTransaction(); - $foreignCurrency = !is_null($pTransaction->foreignCurrency) ? $pTransaction->foreignCurrency : $pTransaction->transactionCurrency; + $foreignCurrency = null !== $pTransaction->foreignCurrency ? $pTransaction->foreignCurrency : $pTransaction->transactionCurrency; $preFilled = [ 'date' => $journal->dateAsString(), 'interest_date' => $journal->dateAsString('interest_date'), @@ -303,13 +301,13 @@ class SingleController extends Controller ]; /** @var Note $note */ $note = $journal->notes()->first(); - if (!is_null($note)) { + if (null !== $note) { $preFilled['notes'] = $note->text; } // amounts for withdrawals and deposits: // amount, native_amount, source_amount, destination_amount - if (($journal->isWithdrawal() || $journal->isDeposit()) && !is_null($pTransaction->foreign_amount)) { + if (($journal->isWithdrawal() || $journal->isDeposit()) && null !== $pTransaction->foreign_amount) { $preFilled['amount'] = $pTransaction->foreign_amount; $preFilled['currency'] = $pTransaction->foreignCurrency; } @@ -319,7 +317,7 @@ class SingleController extends Controller Session::flash('gaEventAction', 'edit-' . $what); // put previous url in session if not redirect from store (not "return_to_edit"). - if (session('transactions.edit.fromUpdate') !== true) { + if (true !== session('transactions.edit.fromUpdate')) { $this->rememberPreviousUri('transactions.edit.uri'); } Session::forget('transactions.edit.fromUpdate'); @@ -338,11 +336,11 @@ class SingleController extends Controller */ public function store(JournalFormRequest $request, JournalRepositoryInterface $repository) { - $doSplit = intval($request->get('split_journal')) === 1; - $createAnother = intval($request->get('create_another')) === 1; + $doSplit = 1 === intval($request->get('split_journal')); + $createAnother = 1 === intval($request->get('create_another')); $data = $request->getJournalData(); $journal = $repository->store($data); - if (is_null($journal->id)) { + if (null === $journal->id) { // error! Log::error('Could not store transaction journal: ', $journal->getErrors()->toArray()); Session::flash('error', $journal->getErrors()->first()); @@ -370,13 +368,13 @@ class SingleController extends Controller Preferences::mark(); // @codeCoverageIgnoreStart - if ($createAnother === true) { + if (true === $createAnother) { Session::put('transactions.create.fromStore', true); return redirect(route('transactions.create', [$request->input('what')]))->withInput(); } - if ($doSplit === true) { + if (true === $doSplit) { return redirect(route('transactions.split.edit', [$journal->id])); } @@ -423,7 +421,7 @@ class SingleController extends Controller Preferences::mark(); // @codeCoverageIgnoreStart - if (intval($request->get('return_to_edit')) === 1) { + if (1 === intval($request->get('return_to_edit'))) { Session::put('transactions.edit.fromUpdate', true); return redirect(route('transactions.edit', [$journal->id]))->withInput(['return_to_edit' => 1]); @@ -444,7 +442,7 @@ class SingleController extends Controller /** @var Account $account */ foreach ($accounts as $account) { $type = $account->getMeta('accountRole'); - if (strlen($type) === 0) { + if (0 === strlen($type)) { $type = 'no_account_type'; } $key = strval(trans('firefly.opt_group_' . $type)); @@ -464,7 +462,7 @@ class SingleController extends Controller /** @var Account $account */ foreach ($accounts as $account) { $type = $account->getMeta('accountRole'); - if (strlen($type) === 0) { + if (0 === strlen($type)) { $type = 'no_account_type'; } $key = strval(trans('firefly.opt_group_' . $type)); diff --git a/app/Http/Controllers/Transaction/SplitController.php b/app/Http/Controllers/Transaction/SplitController.php index c8d055556e..a5fe0a63ef 100644 --- a/app/Http/Controllers/Transaction/SplitController.php +++ b/app/Http/Controllers/Transaction/SplitController.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers\Transaction; - use ExpandedForm; use FireflyIII\Events\UpdatedTransactionJournal; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; @@ -46,21 +44,17 @@ use Steam; use View; /** - * Class SplitController - * - * @package FireflyIII\Http\Controllers\Transaction - * + * Class SplitController. */ class SplitController extends Controller { - - /** @var AccountRepositoryInterface */ + /** @var AccountRepositoryInterface */ private $accounts; /** @var AttachmentHelperInterface */ private $attachments; - /** @var BudgetRepositoryInterface */ + /** @var BudgetRepositoryInterface */ private $budgets; /** @var CurrencyRepositoryInterface */ @@ -76,7 +70,6 @@ class SplitController extends Controller { parent::__construct(); - // some useful repositories: $this->middleware( function ($request, $next) { @@ -123,12 +116,11 @@ class SplitController extends Controller $accountArray[$account->id]['currency_id'] = intval($account->getMeta('currency_id')); } - Session::flash('gaEventCategory', 'transactions'); Session::flash('gaEventAction', 'edit-split-' . $preFilled['what']); // put previous url in session if not redirect from store (not "return_to_edit"). - if (session('transactions.edit-split.fromUpdate') !== true) { + if (true !== session('transactions.edit-split.fromUpdate')) { $this->rememberPreviousUri('transactions.edit-split.uri'); } Session::forget('transactions.edit-split.fromUpdate'); @@ -136,14 +128,21 @@ class SplitController extends Controller return view( 'transactions.split.edit', compact( - 'subTitleIcon', 'currencies', 'optionalFields', - 'preFilled', 'subTitle', 'uploadSize', 'assetAccounts', - 'budgets', 'journal', 'accountArray', 'previous' + 'subTitleIcon', + 'currencies', + 'optionalFields', + 'preFilled', + 'subTitle', + 'uploadSize', + 'assetAccounts', + 'budgets', + 'journal', + 'accountArray', + 'previous' ) ); } - /** * @param SplitJournalFormRequest $request * @param JournalRepositoryInterface $repository @@ -176,7 +175,7 @@ class SplitController extends Controller Preferences::mark(); // @codeCoverageIgnoreStart - if (intval($request->get('return_to_edit')) === 1) { + if (1 === intval($request->get('return_to_edit'))) { // set value so edit routine will not overwrite URL: Session::put('transactions.edit-split.fromUpdate', true); @@ -195,7 +194,7 @@ class SplitController extends Controller */ private function arrayFromInput(SplitJournalFormRequest $request): array { - $tags = is_null($request->get('tags')) ? '' : $request->get('tags'); + $tags = null === $request->get('tags') ? '' : $request->get('tags'); $array = [ 'journal_description' => $request->get('journal_description'), 'journal_source_account_id' => $request->get('journal_source_account_id'), @@ -218,7 +217,6 @@ class SplitController extends Controller 'transactions' => $this->getTransactionDataFromRequest($request), ]; - return $array; } @@ -232,13 +230,13 @@ class SplitController extends Controller { $sourceAccounts = $journal->sourceAccountList(); $destinationAccounts = $journal->destinationAccountList(); - $notes = ''; + $notes = ''; /** @var Note $note */ $note = $journal->notes()->first(); - if (!is_null($note)) { + if (null !== $note) { $notes = $note->text; } - $array = [ + $array = [ 'journal_description' => $request->old('journal_description', $journal->description), 'journal_amount' => $journal->amountPositive(), 'sourceAccounts' => $sourceAccounts, @@ -296,17 +294,15 @@ class SplitController extends Controller 'foreign_currency_id' => $transaction['foreign_currency_id'], 'foreign_currency_code' => $transaction['foreign_currency_code'], 'foreign_currency_symbol' => $transaction['foreign_currency_symbol'], - ]; // set initial category and/or budget: - if (count($transactions) === 1 && $index === 0) { + if (1 === count($transactions) && 0 === $index) { $set['budget_id'] = $journal->budgetId(); $set['category'] = $journal->categoryAsString(); } $return[] = $set; - } return $return; @@ -322,7 +318,6 @@ class SplitController extends Controller $return = []; $transactions = $request->get('transactions'); foreach ($transactions as $transaction) { - $return[] = [ 'description' => $transaction['description'], 'source_account_id' => $transaction['source_account_id'] ?? 0, @@ -335,7 +330,6 @@ class SplitController extends Controller 'category' => $transaction['category'] ?? '', 'transaction_currency_id' => intval($transaction['transaction_currency_id']), 'foreign_currency_id' => $transaction['foreign_currency_id'] ?? null, - ]; } Log::debug(sprintf('Found %d splits in request data.', count($return))); @@ -351,7 +345,7 @@ class SplitController extends Controller */ private function updateWithPrevious($array, $old): array { - if (count($old) === 0 || !isset($old['transactions'])) { + if (0 === count($old) || !isset($old['transactions'])) { return $array; } $old = $old['transactions']; @@ -373,6 +367,4 @@ class SplitController extends Controller return $array; } - - } diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php index 92af78ac40..0f48c39b0a 100644 --- a/app/Http/Controllers/TransactionController.php +++ b/app/Http/Controllers/TransactionController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Controllers; @@ -29,6 +28,7 @@ use FireflyIII\Helpers\Collector\JournalCollectorInterface; use FireflyIII\Helpers\Filter\InternalTransferFilter; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; +use FireflyIII\Models\TransactionType; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Repositories\Journal\JournalTaskerInterface; use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface; @@ -42,9 +42,7 @@ use Response; use View; /** - * Class TransactionController - * - * @package FireflyIII\Http\Controllers + * Class TransactionController. */ class TransactionController extends Controller { @@ -55,7 +53,6 @@ class TransactionController extends Controller { parent::__construct(); - $this->middleware( function ($request, $next) { View::share('title', trans('firefly.transactions')); @@ -64,14 +61,12 @@ class TransactionController extends Controller return $next($request); } ); - } /** * @param Request $request * @param JournalRepositoryInterface $repository * @param string $what - * * @param string $moment * * @return View @@ -90,7 +85,7 @@ class TransactionController extends Controller $path = route('transactions.index', [$what]); // prep for "all" view. - if ($moment === 'all') { + if ('all' === $moment) { $subTitle = trans('firefly.all_' . $what); $first = $repository->first(); $start = $first->date ?? new Carbon; @@ -99,7 +94,7 @@ class TransactionController extends Controller } // prep for "specific date" view. - if (strlen($moment) > 0 && $moment !== 'all') { + if (strlen($moment) > 0 && 'all' !== $moment) { $start = new Carbon($moment); $end = Navigation::endOfPeriod($start, $range); $path = route('transactions.index', [$what, $moment]); @@ -111,7 +106,7 @@ class TransactionController extends Controller } // prep for current period - if (strlen($moment) === 0) { + if (0 === strlen($moment)) { $start = clone session('start', Navigation::startOfPeriod(new Carbon, $range)); $end = clone session('end', Navigation::endOfPeriod(new Carbon, $range)); $periods = $this->getPeriodOverview($what); @@ -125,12 +120,26 @@ class TransactionController extends Controller $collector = app(JournalCollectorInterface::class); $collector->setAllAssetAccounts()->setRange($start, $end)->setTypes($types)->setLimit($pageSize)->setPage($page)->withOpposingAccount(); $collector->removeFilter(InternalTransferFilter::class); - $journals = $collector->getPaginatedJournals(); - $journals->setPath($path); + $transactions = $collector->getPaginatedJournals(); + $transactions->setPath($path); + return view('transactions.index', compact('subTitle', 'what', 'subTitleIcon', 'transactions', 'periods', 'start', 'end', 'moment')); + } - return view('transactions.index', compact('subTitle', 'what', 'subTitleIcon', 'journals', 'periods', 'start', 'end', 'moment')); + /** + * @param Request $request + * @param JournalRepositoryInterface $repository + */ + public function reconcile(Request $request, JournalRepositoryInterface $repository) + { + $transactionIds = $request->get('transactions'); + foreach ($transactionIds as $transactionId) { + $transactionId = intval($transactionId); + $transaction = $repository->findTransaction($transactionId); + Log::debug(sprintf('Transaction ID is %d', $transaction->id)); + $repository->reconcile($transaction); + } } /** @@ -150,20 +159,18 @@ class TransactionController extends Controller $journal = $repository->find(intval($id)); if ($journal && $journal->date->isSameDay($date)) { $repository->setOrder($journal, $order); - $order++; + ++$order; } } } Preferences::mark(); return Response::json([true]); - } /** * @param TransactionJournal $journal * @param JournalTaskerInterface $tasker - * * @param LinkTypeRepositoryInterface $linkTypeRepository * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View @@ -173,6 +180,9 @@ class TransactionController extends Controller if ($this->isOpeningBalance($journal)) { return $this->redirectToAccount($journal); } + if ($journal->transactionType->type === TransactionType::RECONCILIATION) { + return redirect(route('accounts.reconcile.show', [$journal->id])); + } $linkTypes = $linkTypeRepository->get(); $links = $linkTypeRepository->getLinks($journal); $events = $tasker->getPiggyBankEvents($journal); @@ -181,14 +191,13 @@ class TransactionController extends Controller $subTitle = trans('firefly.' . $what) . ' "' . $journal->description . '"'; return view('transactions.show', compact('journal', 'events', 'subTitle', 'what', 'transactions', 'linkTypes', 'links')); - - } /** * @param string $what * * @return Collection + * * @throws FireflyException */ private function getPeriodOverview(string $what): Collection @@ -280,11 +289,10 @@ class TransactionController extends Controller } // save amount: $return[$currencyId]['sum'] = bcadd($return[$currencyId]['sum'], $transaction->transaction_amount); - $return[$currencyId]['count']++; + ++$return[$currencyId]['count']; } asort($return); return $return; } - } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 02130a9c93..d1e66021d3 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - /** * Kernel.php * Copyright (c) 2017 thegrumpydictator@gmail.com @@ -57,7 +55,6 @@ use Illuminate\Routing\Middleware\SubstituteBindings; use Illuminate\Routing\Middleware\ThrottleRequests; use Illuminate\View\Middleware\ShareErrorsFromSession; - class Kernel extends HttpKernel { /** @@ -96,7 +93,6 @@ class Kernel extends HttpKernel SubstituteBindings::class, ], - // MUST NOT be logged in. Does not care about 2FA or confirmation. 'user-not-logged-in' => [ Sandstorm::class, @@ -174,14 +170,12 @@ class Kernel extends HttpKernel Binder::class, ], - 'api' => [ 'throttle:60,1', 'bindings', ], ]; - /** * The application's route middleware. * diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index 015770f866..bd07886e0a 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Middleware; @@ -29,18 +28,16 @@ use Illuminate\Support\Facades\Auth; use Session; /** - * Class Authenticate - * - * @package FireflyIII\Http\Middleware + * Class Authenticate. */ class Authenticate { /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $guard + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string|null $guard * * @return mixed */ @@ -53,9 +50,9 @@ class Authenticate return redirect()->guest('login'); } - if (intval(auth()->user()->blocked) === 1) { + if (1 === intval(auth()->user()->blocked)) { $message = strval(trans('firefly.block_account_logout')); - if (auth()->user()->blocked_code === 'email_changed') { + if ('email_changed' === auth()->user()->blocked_code) { $message = strval(trans('firefly.email_changed_logout')); } diff --git a/app/Http/Middleware/AuthenticateTwoFactor.php b/app/Http/Middleware/AuthenticateTwoFactor.php index 57aba99e62..840ac16ab1 100644 --- a/app/Http/Middleware/AuthenticateTwoFactor.php +++ b/app/Http/Middleware/AuthenticateTwoFactor.php @@ -18,13 +18,11 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Middleware; use Closure; -use Cookie; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Log; @@ -32,24 +30,21 @@ use Preferences; use Session; /** - * Class AuthenticateTwoFactor - * - * @package FireflyIII\Http\Middleware + * Class AuthenticateTwoFactor. */ class AuthenticateTwoFactor { /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $guard + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string|null $guard * * @return mixed */ public function handle(Request $request, Closure $next, $guard = null) { - // do the usual auth, again: if (Auth::guard($guard)->guest()) { if ($request->ajax()) { @@ -59,17 +54,17 @@ class AuthenticateTwoFactor return redirect()->guest('login'); } - if (intval(auth()->user()->blocked) === 1) { + if (1 === intval(auth()->user()->blocked)) { Auth::guard($guard)->logout(); Session::flash('logoutMessage', trans('firefly.block_account_logout')); return redirect()->guest('login'); } $is2faEnabled = Preferences::get('twoFactorAuthEnabled', false)->data; - $has2faSecret = !is_null(Preferences::get('twoFactorAuthSecret')); + $has2faSecret = null !== Preferences::get('twoFactorAuthSecret'); - // grab 2auth information from cookie, not from session. - $is2faAuthed = Cookie::get('twoFactorAuthenticated') === 'true'; + // grab 2auth information from session. + $is2faAuthed = 'true' === $request->cookie('twoFactorAuthenticated'); if ($is2faEnabled && $has2faSecret && !$is2faAuthed) { Log::debug('Does not seem to be 2 factor authed, redirect.'); diff --git a/app/Http/Middleware/Binder.php b/app/Http/Middleware/Binder.php index f635600c36..056fff3f9a 100644 --- a/app/Http/Middleware/Binder.php +++ b/app/Http/Middleware/Binder.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Middleware; @@ -27,11 +26,8 @@ use Closure; use FireflyIII\Support\Domain; use Illuminate\Http\Request; - /** - * Class Binder - * - * @package FireflyIII\Http\Middleware + * Class Binder. */ class Binder { @@ -48,8 +44,8 @@ class Binder /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next + * @param \Illuminate\Http\Request $request + * @param \Closure $next * * @return mixed */ diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php index 168e27c01b..ef7bcceca5 100644 --- a/app/Http/Middleware/EncryptCookies.php +++ b/app/Http/Middleware/EncryptCookies.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - /** * EncryptCookies.php * Copyright (c) 2017 thegrumpydictator@gmail.com @@ -44,6 +42,5 @@ class EncryptCookies extends Middleware */ protected $except = [ - // ]; } diff --git a/app/Http/Middleware/IsAdmin.php b/app/Http/Middleware/IsAdmin.php index 887ecd0713..3fb6dbdd8e 100644 --- a/app/Http/Middleware/IsAdmin.php +++ b/app/Http/Middleware/IsAdmin.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Middleware; @@ -29,18 +28,16 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; /** - * Class IsAdmin - * - * @package FireflyIII\Http\Middleware + * Class IsAdmin. */ class IsAdmin { /** * Handle an incoming request. Must be admin. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $guard + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string|null $guard * * @return mixed */ diff --git a/app/Http/Middleware/IsLimitedUser.php b/app/Http/Middleware/IsLimitedUser.php index ba998b8e20..01fc8163ea 100644 --- a/app/Http/Middleware/IsLimitedUser.php +++ b/app/Http/Middleware/IsLimitedUser.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Middleware; @@ -30,18 +29,16 @@ use Illuminate\Support\Facades\Auth; use Session; /** - * Class IsAdmin - * - * @package FireflyIII\Http\Middleware + * Class IsAdmin. */ class IsLimitedUser { /** * Handle an incoming request. May not be a limited user (ie. Sandstorm env. or demo user). * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $guard + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string|null $guard * * @return mixed */ @@ -62,7 +59,7 @@ class IsLimitedUser return redirect(route('index')); } - if (intval(getenv('SANDSTORM')) === 1) { + if (1 === intval(getenv('SANDSTORM'))) { Session::flash('warning', strval(trans('firefly.sandstorm_not_available'))); return redirect(route('index')); diff --git a/app/Http/Middleware/Range.php b/app/Http/Middleware/Range.php index 673775747a..8f5a9badcc 100644 --- a/app/Http/Middleware/Range.php +++ b/app/Http/Middleware/Range.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Middleware; @@ -35,11 +34,8 @@ use Preferences; use Session; use View; - /** - * Class SessionFilter - * - * @package FireflyIII\Http\Middleware + * Class SessionFilter. */ class Range { @@ -53,8 +49,7 @@ class Range /** * Create a new filter instance. * - * @param Guard $auth - * + * @param Guard $auth */ public function __construct(Guard $auth) { @@ -64,16 +59,15 @@ class Range /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param Closure $next - * @param string|null $guard + * @param \Illuminate\Http\Request $request + * @param Closure $next + * @param string|null $guard * * @return mixed */ public function handle(Request $request, Closure $next, $guard = null) { if (!Auth::guard($guard)->guest()) { - // set start, end and finish: $this->setRange(); @@ -85,7 +79,6 @@ class Range } return $next($request); - } /** @@ -110,11 +103,10 @@ class Range $moneyResult = setlocale(LC_MONETARY, $locale); // send error to view if could not set money format - if ($moneyResult === false) { + if (false === $moneyResult) { View::share('invalidMonetaryLocale', true); } - // save some formats: $monthAndDayFormat = (string)trans('config.month_and_day'); $dateTimeFormat = (string)trans('config.date_time'); @@ -132,7 +124,6 @@ class Range { // ignore preference. set the range to be the current month: if (!Session::has('start') && !Session::has('end')) { - $viewRange = Preferences::get('viewRange', '1M')->data; $start = new Carbon; $start = Navigation::updateStartDate($viewRange, $start); @@ -147,11 +138,10 @@ class Range $journal = $repository->first(); $first = Carbon::now()->startOfYear(); - if (!is_null($journal->id)) { + if (null !== $journal->id) { $first = $journal->date; } Session::put('first', $first); } } - } diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index 1794d539c5..8b6e5232fb 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - /** * RedirectIfAuthenticated.php * Copyright (c) 2017 thegrumpydictator@gmail.com @@ -41,9 +39,9 @@ class RedirectIfAuthenticated /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $guard + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string|null $guard * * @return mixed */ diff --git a/app/Http/Middleware/RedirectIfTwoFactorAuthenticated.php b/app/Http/Middleware/RedirectIfTwoFactorAuthenticated.php index 1a60c762fb..dce366ed4c 100644 --- a/app/Http/Middleware/RedirectIfTwoFactorAuthenticated.php +++ b/app/Http/Middleware/RedirectIfTwoFactorAuthenticated.php @@ -18,42 +18,36 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Middleware; use Closure; -use Cookie; use Illuminate\Support\Facades\Auth; use Preferences; - /** - * Class RedirectIfTwoFactorAuthenticated - * - * @package FireflyIII\Http\Middleware + * Class RedirectIfTwoFactorAuthenticated. */ class RedirectIfTwoFactorAuthenticated { /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $guard + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string|null $guard * * @return mixed */ public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->check()) { - $is2faEnabled = Preferences::get('twoFactorAuthEnabled', false)->data; - $has2faSecret = !is_null(Preferences::get('twoFactorAuthSecret')); + $has2faSecret = null !== Preferences::get('twoFactorAuthSecret'); - // grab 2auth information from cookie - $is2faAuthed = Cookie::get('twoFactorAuthenticated') === 'true'; + // grab 2auth information from cookie. + $is2faAuthed = 'true' === $request->cookie('twoFactorAuthenticated'); if ($is2faEnabled && $has2faSecret && $is2faAuthed) { return redirect('/'); diff --git a/app/Http/Middleware/Sandstorm.php b/app/Http/Middleware/Sandstorm.php index c67298e711..83759a0c96 100644 --- a/app/Http/Middleware/Sandstorm.php +++ b/app/Http/Middleware/Sandstorm.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Middleware; @@ -33,9 +32,7 @@ use Illuminate\Http\Request; use View; /** - * Class Sandstorm - * - * @package FireflyIII\Http\Middleware + * Class Sandstorm. */ class Sandstorm { @@ -43,18 +40,19 @@ class Sandstorm * Detects if is using Sandstorm, and responds by logging the user * in and/or creating an account. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $guard + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string|null $guard * * @return mixed + * * @throws FireflyException * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function handle(Request $request, Closure $next, $guard = null) { // is in Sandstorm environment? - $sandstorm = intval(getenv('SANDSTORM')) === 1; + $sandstorm = 1 === intval(getenv('SANDSTORM')); View::share('SANDSTORM', $sandstorm); if (!$sandstorm) { return $next($request); @@ -72,7 +70,7 @@ class Sandstorm // access the same data so we have no choice but to simply login // the new user to the same account and just forget about Bob and Alice // and any other differences there may be between these users. - if ($count === 1 && strlen($userId) > 0) { + if (1 === $count && strlen($userId) > 0) { // login as first user user. $user = User::first(); Auth::guard($guard)->login($user); @@ -81,7 +79,7 @@ class Sandstorm return $next($request); } - if ($count === 1 && strlen($userId) === 0) { + if (1 === $count && 0 === strlen($userId)) { // login but indicate anonymous $user = User::first(); Auth::guard($guard)->login($user); @@ -90,7 +88,7 @@ class Sandstorm return $next($request); } - if ($count === 0 && strlen($userId) > 0) { + if (0 === $count && strlen($userId) > 0) { // create new user. $email = $userId . '@firefly'; /** @var User $user */ @@ -110,14 +108,13 @@ class Sandstorm return $next($request); } - if ($count === 0 && strlen($userId) === 0) { + if (0 === $count && 0 === strlen($userId)) { throw new FireflyException('The first visit to a new Firefly III administration cannot be by a guest user.'); } if ($count > 1) { throw new FireflyException('Your Firefly III installation has more than one user, which is weird.'); } - } return $next($request); diff --git a/app/Http/Middleware/StartFireflySession.php b/app/Http/Middleware/StartFireflySession.php index e354451512..1d9ee97647 100644 --- a/app/Http/Middleware/StartFireflySession.php +++ b/app/Http/Middleware/StartFireflySession.php @@ -18,50 +18,31 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Middleware; - use Closure; use Illuminate\Http\Request; use Illuminate\Session\Middleware\StartSession; /** - * Class StartFireflySession - * - * @package FireflyIII\Http\Middleware + * Class StartFireflySession. */ class StartFireflySession extends StartSession { - /** - * 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); // defer to the right stuff -// } - /** * Store the current URL for the request if necessary. * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Contracts\Session\Session $session - * - * @return void + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Contracts\Session\Session $session */ protected function storeCurrentUrl(Request $request, $session) { $uri = $request->fullUrl(); $strpos = strpos($uri, 'jscript'); - if ($request->method() === 'GET' && $request->route() && !$request->ajax() && $strpos === false) { + if ('GET' === $request->method() && $request->route() && !$request->ajax() && false === $strpos) { $session->setPreviousUrl($uri); } } -} \ No newline at end of file +} diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.php index 7ad3a2e0fa..21d5495130 100644 --- a/app/Http/Middleware/TrimStrings.php +++ b/app/Http/Middleware/TrimStrings.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - /** * TrimStrings.php * Copyright (c) 2017 thegrumpydictator@gmail.com diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php index 878aa0ea98..62ef14a3f3 100644 --- a/app/Http/Middleware/TrustProxies.php +++ b/app/Http/Middleware/TrustProxies.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - /** * TrustProxies.php * Copyright (c) 2017 thegrumpydictator@gmail.com @@ -55,7 +53,7 @@ class TrustProxies extends Middleware /** * The trusted proxies for this application. * - * @var array + * @var array|string */ protected $proxies; @@ -67,7 +65,7 @@ class TrustProxies extends Middleware public function __construct(Repository $config) { $trustedProxies = env('TRUSTED_PROXIES', null); - if (!is_null($trustedProxies) && strlen($trustedProxies) > 0) { + if (null !== $trustedProxies && strlen($trustedProxies) > 0) { $this->proxies = $trustedProxies; } diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php index 869a532515..838f340dcc 100644 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - /** * VerifyCsrfToken.php * Copyright (c) 2017 thegrumpydictator@gmail.com @@ -44,6 +42,5 @@ class VerifyCsrfToken extends Middleware */ protected $except = [ - // ]; } diff --git a/app/Http/Requests/AccountFormRequest.php b/app/Http/Requests/AccountFormRequest.php index 4f2b0d9f4d..261247f432 100644 --- a/app/Http/Requests/AccountFormRequest.php +++ b/app/Http/Requests/AccountFormRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; @@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests; use FireflyIII\Repositories\Account\AccountRepositoryInterface; /** - * Class AccountFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class AccountFormRequest. */ class AccountFormRequest extends Request { @@ -52,12 +48,12 @@ class AccountFormRequest extends Request 'active' => $this->boolean('active'), 'accountType' => $this->string('what'), 'currency_id' => $this->integer('currency_id'), - 'virtualBalance' => $this->float('virtualBalance'), + 'virtualBalance' => $this->string('virtualBalance'), 'iban' => $this->string('iban'), 'BIC' => $this->string('BIC'), 'accountNumber' => $this->string('accountNumber'), 'accountRole' => $this->string('accountRole'), - 'openingBalance' => $this->float('openingBalance'), + 'openingBalance' => $this->string('openingBalance'), 'openingBalanceDate' => $this->date('openingBalanceDate'), 'ccType' => $this->string('ccType'), 'ccMonthlyPaymentDate' => $this->string('ccMonthlyPaymentDate'), @@ -77,7 +73,7 @@ class AccountFormRequest extends Request $nameRule = 'required|min:1|uniqueAccountForUser'; $idRule = ''; - if (!is_null($repository->find(intval($this->get('id')))->id)) { + if (null !== $repository->find(intval($this->get('id')))->id) { $idRule = 'belongsToUser:accounts'; $nameRule = 'required|min:1|uniqueAccountForUser:' . intval($this->get('id')); } diff --git a/app/Http/Requests/AttachmentFormRequest.php b/app/Http/Requests/AttachmentFormRequest.php index 6acf0ad729..7797903735 100644 --- a/app/Http/Requests/AttachmentFormRequest.php +++ b/app/Http/Requests/AttachmentFormRequest.php @@ -18,16 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; /** - * Class AttachmentFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class AttachmentFormRequest. */ class AttachmentFormRequest extends Request { diff --git a/app/Http/Requests/BillFormRequest.php b/app/Http/Requests/BillFormRequest.php index 5cddd73f60..91535dc30e 100644 --- a/app/Http/Requests/BillFormRequest.php +++ b/app/Http/Requests/BillFormRequest.php @@ -18,16 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; /** - * Class BillFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class BillFormRequest. */ class BillFormRequest extends Request { @@ -48,15 +44,16 @@ class BillFormRequest extends Request return [ 'name' => $this->string('name'), 'match' => $this->string('match'), - 'amount_min' => $this->float('amount_min'), + 'amount_min' => $this->string('amount_min'), 'amount_currency_id_amount_min' => $this->integer('amount_currency_id_amount_min'), 'amount_currency_id_amount_max' => $this->integer('amount_currency_id_amount_max'), - 'amount_max' => $this->float('amount_max'), + 'amount_max' => $this->string('amount_max'), 'date' => $this->date('date'), 'repeat_freq' => $this->string('repeat_freq'), 'skip' => $this->integer('skip'), 'automatch' => $this->boolean('automatch'), 'active' => $this->boolean('active'), + 'notes' => $this->string('notes'), ]; } diff --git a/app/Http/Requests/BudgetFormRequest.php b/app/Http/Requests/BudgetFormRequest.php index 428a766ed9..a7f8266aac 100644 --- a/app/Http/Requests/BudgetFormRequest.php +++ b/app/Http/Requests/BudgetFormRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; @@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; /** - * Class BudgetFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class BudgetFormRequest. */ class BudgetFormRequest extends Request { @@ -61,7 +57,7 @@ class BudgetFormRequest extends Request /** @var BudgetRepositoryInterface $repository */ $repository = app(BudgetRepositoryInterface::class); $nameRule = 'required|between:1,100|uniqueObjectForUser:budgets,name'; - if (!is_null($repository->find(intval($this->get('id')))->id)) { + if (null !== $repository->find(intval($this->get('id')))->id) { $nameRule = 'required|between:1,100|uniqueObjectForUser:budgets,name,' . intval($this->get('id')); } diff --git a/app/Http/Requests/BudgetIncomeRequest.php b/app/Http/Requests/BudgetIncomeRequest.php index 9dd7ce13cf..94fd15117a 100644 --- a/app/Http/Requests/BudgetIncomeRequest.php +++ b/app/Http/Requests/BudgetIncomeRequest.php @@ -18,16 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; /** - * Class BudgetIncomeRequest - * - * - * @package FireflyIII\Http\Requests + * Class BudgetIncomeRequest. */ class BudgetIncomeRequest extends Request { diff --git a/app/Http/Requests/CategoryFormRequest.php b/app/Http/Requests/CategoryFormRequest.php index 6b412ec859..316076b85f 100644 --- a/app/Http/Requests/CategoryFormRequest.php +++ b/app/Http/Requests/CategoryFormRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; @@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; /** - * Class CategoryFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class CategoryFormRequest. */ class CategoryFormRequest extends Request { @@ -60,7 +56,7 @@ class CategoryFormRequest extends Request /** @var CategoryRepositoryInterface $repository */ $repository = app(CategoryRepositoryInterface::class); $nameRule = 'required|between:1,100|uniqueObjectForUser:categories,name'; - if (!is_null($repository->find(intval($this->get('id')))->id)) { + if (null !== $repository->find(intval($this->get('id')))->id) { $nameRule = 'required|between:1,100|uniqueObjectForUser:categories,name,' . intval($this->get('id')); } diff --git a/app/Http/Requests/ConfigurationRequest.php b/app/Http/Requests/ConfigurationRequest.php index 51b12a7efb..facdf0652d 100644 --- a/app/Http/Requests/ConfigurationRequest.php +++ b/app/Http/Requests/ConfigurationRequest.php @@ -18,16 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; /** - * Class ConfigurationRequest - * - * - * @package FireflyIII\Http\Requests + * Class ConfigurationRequest. */ class ConfigurationRequest extends Request { diff --git a/app/Http/Requests/CurrencyFormRequest.php b/app/Http/Requests/CurrencyFormRequest.php index 7fc18f86ee..54f0a742de 100644 --- a/app/Http/Requests/CurrencyFormRequest.php +++ b/app/Http/Requests/CurrencyFormRequest.php @@ -18,16 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; /** - * Class BillFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class BillFormRequest. */ class CurrencyFormRequest extends Request { diff --git a/app/Http/Requests/DeleteAccountFormRequest.php b/app/Http/Requests/DeleteAccountFormRequest.php index e14d0e9159..091e660feb 100644 --- a/app/Http/Requests/DeleteAccountFormRequest.php +++ b/app/Http/Requests/DeleteAccountFormRequest.php @@ -18,16 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; /** - * Class DeleteAccountFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class DeleteAccountFormRequest. */ class DeleteAccountFormRequest extends Request { diff --git a/app/Http/Requests/EmailFormRequest.php b/app/Http/Requests/EmailFormRequest.php index 34f1b4e6bc..0574e39ac2 100644 --- a/app/Http/Requests/EmailFormRequest.php +++ b/app/Http/Requests/EmailFormRequest.php @@ -18,16 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; /** - * Class EmailFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class EmailFormRequest. */ class EmailFormRequest extends Request { diff --git a/app/Http/Requests/ExportFormRequest.php b/app/Http/Requests/ExportFormRequest.php index 895f661acb..2b1dc46df0 100644 --- a/app/Http/Requests/ExportFormRequest.php +++ b/app/Http/Requests/ExportFormRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; @@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests; use Carbon\Carbon; /** - * Class ExportFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class ExportFormRequest. */ class ExportFormRequest extends Request { diff --git a/app/Http/Requests/ImportUploadRequest.php b/app/Http/Requests/ImportUploadRequest.php index 3fa5782bc6..1a4ac97c9e 100644 --- a/app/Http/Requests/ImportUploadRequest.php +++ b/app/Http/Requests/ImportUploadRequest.php @@ -18,16 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; /** - * Class ImportUploadRequest - * - * - * @package FireflyIII\Http\Requests + * Class ImportUploadRequest. */ class ImportUploadRequest extends Request { @@ -53,6 +49,5 @@ class ImportUploadRequest extends Request 'import_file_type' => 'required|in:' . join(',', $types), 'configuration_file' => 'file', ]; - } } diff --git a/app/Http/Requests/JournalFormRequest.php b/app/Http/Requests/JournalFormRequest.php index 7e3912a707..56c2836e47 100644 --- a/app/Http/Requests/JournalFormRequest.php +++ b/app/Http/Requests/JournalFormRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; @@ -27,10 +26,7 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\TransactionType; /** - * Class JournalFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class JournalFormRequest. */ class JournalFormRequest extends Request { @@ -68,7 +64,7 @@ class JournalFormRequest extends Request // transaction / journal data: 'description' => $this->string('description'), - 'amount' => $this->float('amount'), + 'amount' => $this->string('amount'), 'budget_id' => $this->integer('budget_id'), 'category' => $this->string('category'), 'source_account_id' => $this->integer('source_account_id'), @@ -78,10 +74,9 @@ class JournalFormRequest extends Request 'piggy_bank_id' => $this->integer('piggy_bank_id'), // native amount and stuff like that: - 'native_amount' => $this->float('native_amount'), - 'source_amount' => $this->float('source_amount'), - 'destination_amount' => $this->float('destination_amount'), - + 'native_amount' => $this->string('native_amount'), + 'source_amount' => $this->string('source_amount'), + 'destination_amount' => $this->string('destination_amount'), ]; return $data; @@ -130,12 +125,13 @@ class JournalFormRequest extends Request } /** - * Inspired by https://www.youtube.com/watch?v=WwnI0RS6J5A + * Inspired by https://www.youtube.com/watch?v=WwnI0RS6J5A. * * @param string $what * @param array $rules * * @return array + * * @throws FireflyException */ private function enhanceRules(string $what, array $rules): array diff --git a/app/Http/Requests/JournalLinkRequest.php b/app/Http/Requests/JournalLinkRequest.php index 06bcdf4b95..85d8728e5c 100644 --- a/app/Http/Requests/JournalLinkRequest.php +++ b/app/Http/Requests/JournalLinkRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; @@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests; use FireflyIII\Models\LinkType; /** - * Class JournalLink - * - * - * @package FireflyIII\Http\Requests + * Class JournalLink. */ class JournalLinkRequest extends Request { @@ -54,7 +50,7 @@ class JournalLinkRequest extends Request $return['transaction_journal_id'] = $this->integer('link_journal_id'); $return['comments'] = strlen($this->string('comments')) > 0 ? $this->string('comments') : null; $return['direction'] = $parts[1]; - if ($return['transaction_journal_id'] === 0 && ctype_digit($this->string('link_other'))) { + if (0 === $return['transaction_journal_id'] && ctype_digit($this->string('link_other'))) { $return['transaction_journal_id'] = $this->integer('link_other'); } diff --git a/app/Http/Requests/LinkTypeFormRequest.php b/app/Http/Requests/LinkTypeFormRequest.php index 8895dd2199..b113f24a53 100644 --- a/app/Http/Requests/LinkTypeFormRequest.php +++ b/app/Http/Requests/LinkTypeFormRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; @@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests; use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface; /** - * Class BillFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class BillFormRequest. */ class LinkTypeFormRequest extends Request { @@ -53,7 +49,7 @@ class LinkTypeFormRequest extends Request $repository = app(LinkTypeRepositoryInterface::class); $nameRule = 'required|min:1|unique:link_types,name'; $idRule = ''; - if (!is_null($repository->find($this->integer('id'))->id)) { + if (null !== $repository->find($this->integer('id'))->id) { $idRule = 'exists:link_types,id'; $nameRule = 'required|min:1'; } diff --git a/app/Http/Requests/MassDeleteJournalRequest.php b/app/Http/Requests/MassDeleteJournalRequest.php index 7d5a65d394..dc386dca03 100644 --- a/app/Http/Requests/MassDeleteJournalRequest.php +++ b/app/Http/Requests/MassDeleteJournalRequest.php @@ -18,16 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; /** - * Class MassDeleteJournalRequest - * - * - * @package FireflyIII\Http\Requests + * Class MassDeleteJournalRequest. */ class MassDeleteJournalRequest extends Request { diff --git a/app/Http/Requests/MassEditJournalRequest.php b/app/Http/Requests/MassEditJournalRequest.php index eb82783c5b..0bf81bcfea 100644 --- a/app/Http/Requests/MassEditJournalRequest.php +++ b/app/Http/Requests/MassEditJournalRequest.php @@ -18,16 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; /** - * Class MassEditJournalRequest - * - * - * @package FireflyIII\Http\Requests + * Class MassEditJournalRequest. */ class MassEditJournalRequest extends Request { diff --git a/app/Http/Requests/NewUserFormRequest.php b/app/Http/Requests/NewUserFormRequest.php index bded8431d1..7cbcf455f2 100644 --- a/app/Http/Requests/NewUserFormRequest.php +++ b/app/Http/Requests/NewUserFormRequest.php @@ -18,16 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; /** - * Class NewUserFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class NewUserFormRequest. */ class NewUserFormRequest extends Request { diff --git a/app/Http/Requests/PiggyBankFormRequest.php b/app/Http/Requests/PiggyBankFormRequest.php index 3e126a2715..38c209887a 100644 --- a/app/Http/Requests/PiggyBankFormRequest.php +++ b/app/Http/Requests/PiggyBankFormRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; @@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests; use Carbon\Carbon; /** - * Class PiggyBankFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class PiggyBankFormRequest. */ class PiggyBankFormRequest extends Request { @@ -49,9 +45,9 @@ class PiggyBankFormRequest extends Request { return [ 'name' => $this->string('name'), - 'startdate' => new Carbon, + 'startdate' => $this->date('startdate'), 'account_id' => $this->integer('account_id'), - 'targetamount' => $this->float('targetamount'), + 'targetamount' => $this->string('targetamount'), 'targetdate' => $this->date('targetdate'), 'note' => $this->string('note'), ]; @@ -62,13 +58,11 @@ class PiggyBankFormRequest extends Request */ public function rules() { - $nameRule = 'required|between:1,255|uniquePiggyBankForUser'; if (intval($this->get('id'))) { $nameRule = 'required|between:1,255|uniquePiggyBankForUser:' . intval($this->get('id')); } - $rules = [ 'name' => $nameRule, 'account_id' => 'required|belongsToUser:accounts', @@ -77,7 +71,6 @@ class PiggyBankFormRequest extends Request 'startdate' => 'date', 'targetdate' => 'date|nullable', 'order' => 'integer|min:1', - ]; return $rules; diff --git a/app/Http/Requests/ProfileFormRequest.php b/app/Http/Requests/ProfileFormRequest.php index e53eb5efe5..c12219d758 100644 --- a/app/Http/Requests/ProfileFormRequest.php +++ b/app/Http/Requests/ProfileFormRequest.php @@ -18,16 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; /** - * Class ProfileFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class ProfileFormRequest. */ class ProfileFormRequest extends Request { diff --git a/app/Http/Requests/ReconciliationFormRequest.php b/app/Http/Requests/ReconciliationFormRequest.php new file mode 100644 index 0000000000..1f6f2c6238 --- /dev/null +++ b/app/Http/Requests/ReconciliationFormRequest.php @@ -0,0 +1,68 @@ +. + */ +declare(strict_types=1); + +namespace FireflyIII\Http\Requests; + +/** + * Class ReconciliationFormRequest. + */ +class ReconciliationFormRequest extends Request +{ + /** + * @return bool + */ + public function authorize() + { + // Only allow logged in users + return auth()->check(); + } + + /** + * Returns and validates the data required to update a reconciliation. + * + * @return array + */ + public function getJournalData() + { + $data = [ + 'tags' => explode(',', $this->string('tags')), + 'amount' => $this->string('amount'), + 'category' => $this->string('category'), + ]; + + return $data; + } + + /** + * @return array + */ + public function rules() + { + $rules = [ + 'amount' => 'numeric|required', + 'category' => 'between:1,255|nullable', + ]; + + return $rules; + } + +} diff --git a/app/Http/Requests/ReportFormRequest.php b/app/Http/Requests/ReportFormRequest.php index 76761deb3c..40eee6037b 100644 --- a/app/Http/Requests/ReportFormRequest.php +++ b/app/Http/Requests/ReportFormRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; @@ -33,10 +32,7 @@ use FireflyIII\Repositories\Tag\TagRepositoryInterface; use Illuminate\Support\Collection; /** - * Class CategoryFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class CategoryFormRequest. */ class ReportFormRequest extends Request { @@ -62,7 +58,7 @@ class ReportFormRequest extends Request if (is_array($set)) { foreach ($set as $accountId) { $account = $repository->find(intval($accountId)); - if (!is_null($account->id)) { + if (null !== $account->id) { $collection->push($account); } } @@ -83,7 +79,7 @@ class ReportFormRequest extends Request if (is_array($set)) { foreach ($set as $budgetId) { $budget = $repository->find(intval($budgetId)); - if (!is_null($budget->id)) { + if (null !== $budget->id) { $collection->push($budget); } } @@ -104,7 +100,7 @@ class ReportFormRequest extends Request if (is_array($set)) { foreach ($set as $categoryId) { $category = $repository->find(intval($categoryId)); - if (!is_null($category->id)) { + if (null !== $category->id) { $collection->push($category); } } @@ -115,6 +111,7 @@ class ReportFormRequest extends Request /** * @return Carbon + * * @throws FireflyException */ public function getEndDate(): Carbon @@ -122,7 +119,7 @@ class ReportFormRequest extends Request $date = new Carbon; $range = $this->get('daterange'); $parts = explode(' - ', strval($range)); - if (count($parts) === 2) { + if (2 === count($parts)) { try { $date = new Carbon($parts[1]); } catch (Exception $e) { @@ -135,6 +132,7 @@ class ReportFormRequest extends Request /** * @return Carbon + * * @throws FireflyException */ public function getStartDate(): Carbon @@ -142,7 +140,7 @@ class ReportFormRequest extends Request $date = new Carbon; $range = $this->get('daterange'); $parts = explode(' - ', strval($range)); - if (count($parts) === 2) { + if (2 === count($parts)) { try { $date = new Carbon($parts[0]); } catch (Exception $e) { @@ -165,7 +163,7 @@ class ReportFormRequest extends Request if (is_array($set)) { foreach ($set as $tagTag) { $tag = $repository->findByTag($tagTag); - if (!is_null($tag->id)) { + if (null !== $tag->id) { $collection->push($tag); } } @@ -183,5 +181,4 @@ class ReportFormRequest extends Request 'report_type' => 'in:audit,default,category,budget,tag', ]; } - } diff --git a/app/Http/Requests/Request.php b/app/Http/Requests/Request.php index 71c845b08a..f26c4113d6 100644 --- a/app/Http/Requests/Request.php +++ b/app/Http/Requests/Request.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; @@ -27,9 +26,7 @@ use Carbon\Carbon; use Illuminate\Foundation\Http\FormRequest; /** - * Class Request - * - * @package FireflyIII\Http\Requests + * Class Request. */ class Request extends FormRequest { @@ -40,7 +37,7 @@ class Request extends FormRequest */ public function boolean(string $field): bool { - return intval($this->input($field)) === 1; + return 1 === intval($this->input($field)); } /** diff --git a/app/Http/Requests/RuleFormRequest.php b/app/Http/Requests/RuleFormRequest.php index 89f484a09a..eb4453070b 100644 --- a/app/Http/Requests/RuleFormRequest.php +++ b/app/Http/Requests/RuleFormRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; @@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests; use FireflyIII\Repositories\Rule\RuleRepositoryInterface; /** - * Class RuleFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class RuleFormRequest. */ class RuleFormRequest extends Request { @@ -77,7 +73,7 @@ class RuleFormRequest extends Request $contextActions = join(',', config('firefly.rule-actions-text')); $titleRule = 'required|between:1,100|uniqueObjectForUser:rules,title'; - if (!is_null($repository->find(intval($this->get('id')))->id)) { + if (null !== $repository->find(intval($this->get('id')))->id) { $titleRule = 'required|between:1,100|uniqueObjectForUser:rules,title,' . intval($this->get('id')); } $rules = [ @@ -91,7 +87,7 @@ class RuleFormRequest extends Request 'rule-action.*' => 'required|in:' . join(',', $validActions), ]; // since Laravel does not support this stuff yet, here's a trick. - for ($i = 0; $i < 10; $i++) { + for ($i = 0; $i < 10; ++$i) { $rules['rule-action-value.' . $i] = 'required_if:rule-action.' . $i . ',' . $contextActions . '|ruleActionValue'; } diff --git a/app/Http/Requests/RuleGroupFormRequest.php b/app/Http/Requests/RuleGroupFormRequest.php index fa9163a177..539f647446 100644 --- a/app/Http/Requests/RuleGroupFormRequest.php +++ b/app/Http/Requests/RuleGroupFormRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; @@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests; use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface; /** - * Class RuleGroupFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class RuleGroupFormRequest. */ class RuleGroupFormRequest extends Request { @@ -62,7 +58,7 @@ class RuleGroupFormRequest extends Request /** @var RuleGroupRepositoryInterface $repository */ $repository = app(RuleGroupRepositoryInterface::class); $titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title'; - if (!is_null($repository->find(intval($this->get('id')))->id)) { + if (null !== $repository->find(intval($this->get('id')))->id) { $titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title,' . intval($this->get('id')); } diff --git a/app/Http/Requests/SelectTransactionsRequest.php b/app/Http/Requests/SelectTransactionsRequest.php index 2ff802a032..1c96d0eb83 100644 --- a/app/Http/Requests/SelectTransactionsRequest.php +++ b/app/Http/Requests/SelectTransactionsRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; @@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests; use Carbon\Carbon; /** - * Class ExportFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class ExportFormRequest. */ class SelectTransactionsRequest extends Request { diff --git a/app/Http/Requests/SplitJournalFormRequest.php b/app/Http/Requests/SplitJournalFormRequest.php index 0c7b41ca43..0865751fb4 100644 --- a/app/Http/Requests/SplitJournalFormRequest.php +++ b/app/Http/Requests/SplitJournalFormRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; @@ -26,9 +25,7 @@ namespace FireflyIII\Http\Requests; use Steam; /** - * Class SplitJournalFormRequest - * - * @package FireflyIII\Http\Requests + * Class SplitJournalFormRequest. */ class SplitJournalFormRequest extends Request { diff --git a/app/Http/Requests/TagFormRequest.php b/app/Http/Requests/TagFormRequest.php index 2280099ed0..dd835fd9a6 100644 --- a/app/Http/Requests/TagFormRequest.php +++ b/app/Http/Requests/TagFormRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; @@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests; use FireflyIII\Repositories\Tag\TagRepositoryInterface; /** - * Class TagFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class TagFormRequest. */ class TagFormRequest extends Request { @@ -51,7 +47,7 @@ class TagFormRequest extends Request $longitude = null; $zoomLevel = null; - if ($this->get('tag_position_has_tag') === 'true') { + if ('true' === $this->get('tag_position_has_tag')) { $latitude = $this->string('tag_position_latitude'); $longitude = $this->string('tag_position_longitude'); $zoomLevel = $this->integer('tag_position_zoomlevel'); @@ -67,8 +63,6 @@ class TagFormRequest extends Request ]; return $data; - - } /** @@ -80,7 +74,7 @@ class TagFormRequest extends Request $repository = app(TagRepositoryInterface::class); $idRule = ''; $tagRule = 'required|min:1|uniqueObjectForUser:tags,tag'; - if (!is_null($repository->find(intval($this->get('id')))->id)) { + if (null !== $repository->find(intval($this->get('id')))->id) { $idRule = 'belongsToUser:tags'; $tagRule = 'required|min:1|uniqueObjectForUser:tags,tag,' . $this->get('id'); } diff --git a/app/Http/Requests/TestRuleFormRequest.php b/app/Http/Requests/TestRuleFormRequest.php index 93454f522e..098315e0f9 100644 --- a/app/Http/Requests/TestRuleFormRequest.php +++ b/app/Http/Requests/TestRuleFormRequest.php @@ -18,16 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; /** - * Class RuleFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class RuleFormRequest. */ class TestRuleFormRequest extends Request { diff --git a/app/Http/Requests/TokenFormRequest.php b/app/Http/Requests/TokenFormRequest.php index 4b9b17cbac..e3b2f3819f 100644 --- a/app/Http/Requests/TokenFormRequest.php +++ b/app/Http/Requests/TokenFormRequest.php @@ -18,16 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; /** - * Class TokenFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class TokenFormRequest. */ class TokenFormRequest extends Request { diff --git a/app/Http/Requests/UserFormRequest.php b/app/Http/Requests/UserFormRequest.php index 5d21912927..ffb06350ea 100644 --- a/app/Http/Requests/UserFormRequest.php +++ b/app/Http/Requests/UserFormRequest.php @@ -18,16 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; /** - * Class UserFormRequest - * - * - * @package FireflyIII\Http\Requests + * Class UserFormRequest. */ class UserFormRequest extends Request { @@ -47,7 +43,7 @@ class UserFormRequest extends Request { return [ 'email' => $this->string('email'), - 'blocked' => $this->integer('blocked') === 1, + 'blocked' => 1 === $this->integer('blocked'), 'blocked_code' => $this->string('blocked_code'), 'password' => $this->string('password'), ]; diff --git a/app/Http/Requests/UserRegistrationRequest.php b/app/Http/Requests/UserRegistrationRequest.php index c14439f810..dffe9a3223 100644 --- a/app/Http/Requests/UserRegistrationRequest.php +++ b/app/Http/Requests/UserRegistrationRequest.php @@ -18,16 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Http\Requests; /** - * Class UserRegistrationRequest - * - * - * @package FireflyIII\Http\Requests + * Class UserRegistrationRequest. */ class UserRegistrationRequest extends Request { @@ -49,7 +45,6 @@ class UserRegistrationRequest extends Request return [ 'email' => 'email|required', 'password' => 'confirmed|secure_password', - ]; } } diff --git a/app/Http/breadcrumbs.php b/app/Http/breadcrumbs.php index aababe0719..424c2857cf 100644 --- a/app/Http/breadcrumbs.php +++ b/app/Http/breadcrumbs.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); use Carbon\Carbon; @@ -43,13 +42,10 @@ use FireflyIII\Models\TransactionType; use FireflyIII\User; use Illuminate\Support\Collection; -/** - * HOME - */ +// HOME Breadcrumbs::register( 'home', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->push(trans('breadcrumbs.home'), route('index')); } ); @@ -57,859 +53,896 @@ Breadcrumbs::register( Breadcrumbs::register( 'index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->push(trans('breadcrumbs.home'), route('index')); } ); -/** - * ACCOUNTS - */ +// ACCOUNTS Breadcrumbs::register( - 'accounts.index', function (BreadCrumbGenerator $breadcrumbs, string $what) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('firefly.' . strtolower(e($what)) . '_accounts'), route('accounts.index', [$what])); -} -); - -Breadcrumbs::register( - 'accounts.create', function (BreadCrumbGenerator $breadcrumbs, string $what) { - $breadcrumbs->parent('accounts.index', $what); - $breadcrumbs->push(trans('firefly.new_' . strtolower(e($what)) . '_account'), route('accounts.create', [$what])); -} -); - -Breadcrumbs::register( - 'accounts.show', function (BreadCrumbGenerator $breadcrumbs, Account $account, string $moment, Carbon $start, Carbon $end) { - $what = config('firefly.shortNamesByFullName.' . $account->accountType->type); - - $breadcrumbs->parent('accounts.index', $what); - $breadcrumbs->push($account->name, route('accounts.show', [$account->id])); - - // push when is all: - if ($moment === 'all') { - $breadcrumbs->push(trans('firefly.everything'), route('accounts.show', [$account->id, 'all'])); + 'accounts.index', + function (BreadCrumbGenerator $breadcrumbs, string $what) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('firefly.' . strtolower(e($what)) . '_accounts'), route('accounts.index', [$what])); } - // when is specific period or when empty: - if ($moment !== 'all' && $moment !== '(nothing)') { +); + +Breadcrumbs::register( + 'accounts.create', + function (BreadCrumbGenerator $breadcrumbs, string $what) { + $breadcrumbs->parent('accounts.index', $what); + $breadcrumbs->push(trans('firefly.new_' . strtolower(e($what)) . '_account'), route('accounts.create', [$what])); + } +); + +Breadcrumbs::register( + 'accounts.show', + function (BreadCrumbGenerator $breadcrumbs, Account $account, string $moment, Carbon $start, Carbon $end) { + $what = config('firefly.shortNamesByFullName.' . $account->accountType->type); + + $breadcrumbs->parent('accounts.index', $what); + $breadcrumbs->push($account->name, route('accounts.show', [$account->id])); + + // push when is all: + if ('all' === $moment) { + $breadcrumbs->push(trans('firefly.everything'), route('accounts.show', [$account->id, 'all'])); + } + // when is specific period or when empty: + if ('all' !== $moment && '(nothing)' !== $moment) { + $title = trans( + 'firefly.between_dates_breadcrumb', + ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), + 'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),] + ); + $breadcrumbs->push($title, route('accounts.show', [$account->id, $moment, $start, $end])); + } + } +); + +Breadcrumbs::register( + 'accounts.delete', + function (BreadCrumbGenerator $breadcrumbs, Account $account) { + $breadcrumbs->parent('accounts.show', $account, '(nothing)', new Carbon, new Carbon); + $breadcrumbs->push(trans('firefly.delete_account', ['name' => e($account->name)]), route('accounts.delete', [$account->id])); + } +); + +Breadcrumbs::register( + 'accounts.edit', + function (BreadCrumbGenerator $breadcrumbs, Account $account) { + $breadcrumbs->parent('accounts.show', $account, '(nothing)', new Carbon, new Carbon); + $what = config('firefly.shortNamesByFullName.' . $account->accountType->type); + + $breadcrumbs->push(trans('firefly.edit_' . $what . '_account', ['name' => e($account->name)]), route('accounts.edit', [$account->id])); + } +); + +// ADMIN +Breadcrumbs::register( + 'admin.index', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('firefly.administration'), route('admin.index')); + } +); + +Breadcrumbs::register( + 'admin.users', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('admin.index'); + $breadcrumbs->push(trans('firefly.list_all_users'), route('admin.users')); + } +); + +Breadcrumbs::register( + 'admin.users.show', + function (BreadCrumbGenerator $breadcrumbs, User $user) { + $breadcrumbs->parent('admin.users'); + $breadcrumbs->push(trans('firefly.single_user_administration', ['email' => $user->email]), route('admin.users.show', [$user->id])); + } +); +Breadcrumbs::register( + 'admin.users.edit', + function (BreadCrumbGenerator $breadcrumbs, User $user) { + $breadcrumbs->parent('admin.users'); + $breadcrumbs->push(trans('firefly.edit_user', ['email' => $user->email]), route('admin.users.edit', [$user->id])); + } +); +Breadcrumbs::register( + 'admin.users.delete', + function (BreadCrumbGenerator $breadcrumbs, User $user) { + $breadcrumbs->parent('admin.users'); + $breadcrumbs->push(trans('firefly.delete_user', ['email' => $user->email]), route('admin.users.delete', [$user->id])); + } +); + +Breadcrumbs::register( + 'admin.users.domains', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('admin.index'); + $breadcrumbs->push(trans('firefly.blocked_domains'), route('admin.users.domains')); + } +); + +Breadcrumbs::register( + 'admin.configuration.index', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('admin.index'); + $breadcrumbs->push(trans('firefly.instance_configuration'), route('admin.configuration.index')); + } +); + +Breadcrumbs::register( + 'admin.links.index', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('admin.index'); + $breadcrumbs->push(trans('firefly.journal_link_configuration'), route('admin.links.index')); + } +); + +Breadcrumbs::register( + 'admin.links.create', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('admin.links.index'); + $breadcrumbs->push(trans('firefly.create_new_link_type'), route('admin.links.create')); + } +); + +Breadcrumbs::register( + 'admin.links.show', + function (BreadCrumbGenerator $breadcrumbs, LinkType $linkType) { + $breadcrumbs->parent('admin.links.index'); + $breadcrumbs->push(trans('firefly.overview_for_link', [$linkType->name]), route('admin.links.show', [$linkType->id])); + } +); + +Breadcrumbs::register( + 'admin.links.edit', + function (BreadCrumbGenerator $breadcrumbs, LinkType $linkType) { + $breadcrumbs->parent('admin.links.index'); + $breadcrumbs->push(trans('firefly.edit_link_type', ['name' => $linkType->name]), route('admin.links.edit', [$linkType->id])); + } +); + +Breadcrumbs::register( + 'admin.links.delete', + function (BreadCrumbGenerator $breadcrumbs, LinkType $linkType) { + $breadcrumbs->parent('admin.links.index'); + $breadcrumbs->push(trans('firefly.delete_link_type', ['name' => $linkType->name]), route('admin.links.delete', [$linkType->id])); + } +); + +Breadcrumbs::register( + 'transactions.link.delete', + function (BreadCrumbGenerator $breadcrumbs, TransactionJournalLink $link) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('breadcrumbs.delete_journal_link'), route('transactions.link.delete', $link->id)); + } +); + +// ATTACHMENTS +Breadcrumbs::register( + 'attachments.edit', + function (BreadCrumbGenerator $breadcrumbs, Attachment $attachment) { + $object = $attachment->attachable; + if ($object instanceof TransactionJournal) { + $breadcrumbs->parent('transactions.show', $object); + $breadcrumbs->push($attachment->filename, route('attachments.edit', [$attachment])); + } else { + throw new FireflyException('Cannot make breadcrumb for attachment connected to object of type ' . get_class($object)); + } + } +); +Breadcrumbs::register( + 'attachments.delete', + function (BreadCrumbGenerator $breadcrumbs, Attachment $attachment) { + $object = $attachment->attachable; + if ($object instanceof TransactionJournal) { + $breadcrumbs->parent('transactions.show', $object); + $breadcrumbs->push(trans('firefly.delete_attachment', ['name' => $attachment->filename]), route('attachments.edit', [$attachment])); + } else { + throw new FireflyException('Cannot make breadcrumb for attachment connected to object of type ' . get_class($object)); + } + } +); + +// BILLS +Breadcrumbs::register( + 'bills.index', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('breadcrumbs.bills'), route('bills.index')); + } +); +Breadcrumbs::register( + 'bills.create', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('bills.index'); + $breadcrumbs->push(trans('breadcrumbs.newBill'), route('bills.create')); + } +); + +Breadcrumbs::register( + 'bills.edit', + function (BreadCrumbGenerator $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 (BreadCrumbGenerator $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 (BreadCrumbGenerator $breadcrumbs, Bill $bill) { + $breadcrumbs->parent('bills.index'); + $breadcrumbs->push(e($bill->name), route('bills.show', [$bill->id])); + } +); + +// BUDGETS +Breadcrumbs::register( + 'budgets.index', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('firefly.budgets'), route('budgets.index')); + } +); +Breadcrumbs::register( + 'budgets.create', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('budgets.index'); + $breadcrumbs->push(trans('firefly.create_new_budget'), route('budgets.create')); + } +); + +Breadcrumbs::register( + 'budgets.edit', + function (BreadCrumbGenerator $breadcrumbs, Budget $budget) { + $breadcrumbs->parent('budgets.show', $budget); + $breadcrumbs->push(trans('firefly.edit_budget', ['name' => e($budget->name)]), route('budgets.edit', [$budget->id])); + } +); +Breadcrumbs::register( + 'budgets.delete', + function (BreadCrumbGenerator $breadcrumbs, Budget $budget) { + $breadcrumbs->parent('budgets.show', $budget); + $breadcrumbs->push(trans('firefly.delete_budget', ['name' => e($budget->name)]), route('budgets.delete', [$budget->id])); + } +); + +Breadcrumbs::register( + 'budgets.no-budget', + function (BreadCrumbGenerator $breadcrumbs, string $moment, Carbon $start, Carbon $end) { + $breadcrumbs->parent('budgets.index'); + $breadcrumbs->push(trans('firefly.journals_without_budget'), route('budgets.no-budget')); + + // push when is all: + if ('all' === $moment) { + $breadcrumbs->push(trans('firefly.everything'), route('budgets.no-budget', ['all'])); + } + // when is specific period or when empty: + if ('all' !== $moment && '(nothing)' !== $moment) { + $title = trans( + 'firefly.between_dates_breadcrumb', + ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), + 'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),] + ); + $breadcrumbs->push($title, route('budgets.no-budget', [$moment])); + } + } +); + +Breadcrumbs::register( + 'budgets.show', + function (BreadCrumbGenerator $breadcrumbs, Budget $budget) { + $breadcrumbs->parent('budgets.index'); + $breadcrumbs->push(e($budget->name), route('budgets.show', [$budget->id])); + $breadcrumbs->push(trans('firefly.everything'), route('budgets.show', [$budget->id])); + } +); + +Breadcrumbs::register( + 'budgets.show.limit', + function (BreadCrumbGenerator $breadcrumbs, Budget $budget, BudgetLimit $budgetLimit) { + $breadcrumbs->parent('budgets.index'); + $breadcrumbs->push(e($budget->name), route('budgets.show', [$budget->id])); + $title = trans( - 'firefly.between_dates_breadcrumb', ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), - 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] + 'firefly.between_dates_breadcrumb', + ['start' => $budgetLimit->start_date->formatLocalized(strval(trans('config.month_and_day'))), + 'end' => $budgetLimit->end_date->formatLocalized(strval(trans('config.month_and_day'))),] ); - $breadcrumbs->push($title, route('accounts.show', [$account->id, $moment, $start, $end])); - } -} -); - -Breadcrumbs::register( - 'accounts.delete', function (BreadCrumbGenerator $breadcrumbs, Account $account) { - $breadcrumbs->parent('accounts.show', $account, '(nothing)', new Carbon, new Carbon); - $breadcrumbs->push(trans('firefly.delete_account', ['name' => e($account->name)]), route('accounts.delete', [$account->id])); -} -); - - -Breadcrumbs::register( - 'accounts.edit', function (BreadCrumbGenerator $breadcrumbs, Account $account) { - $breadcrumbs->parent('accounts.show', $account, '(nothing)', new Carbon, new Carbon); - $what = config('firefly.shortNamesByFullName.' . $account->accountType->type); - - $breadcrumbs->push(trans('firefly.edit_' . $what . '_account', ['name' => e($account->name)]), route('accounts.edit', [$account->id])); -} -); - -/** - * ADMIN - */ -Breadcrumbs::register( - 'admin.index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('firefly.administration'), route('admin.index')); -} -); - -Breadcrumbs::register( - 'admin.users', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('admin.index'); - $breadcrumbs->push(trans('firefly.list_all_users'), route('admin.users')); -} -); - -Breadcrumbs::register( - 'admin.users.show', function (BreadCrumbGenerator $breadcrumbs, User $user) { - $breadcrumbs->parent('admin.users'); - $breadcrumbs->push(trans('firefly.single_user_administration', ['email' => $user->email]), route('admin.users.show', [$user->id])); -} -); -Breadcrumbs::register( - 'admin.users.edit', function (BreadCrumbGenerator $breadcrumbs, User $user) { - $breadcrumbs->parent('admin.users'); - $breadcrumbs->push(trans('firefly.edit_user', ['email' => $user->email]), route('admin.users.edit', [$user->id])); -} -); -Breadcrumbs::register( - 'admin.users.delete', function (BreadCrumbGenerator $breadcrumbs, User $user) { - $breadcrumbs->parent('admin.users'); - $breadcrumbs->push(trans('firefly.delete_user', ['email' => $user->email]), route('admin.users.delete', [$user->id])); -} -); - -Breadcrumbs::register( - 'admin.users.domains', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('admin.index'); - $breadcrumbs->push(trans('firefly.blocked_domains'), route('admin.users.domains')); -} -); - -Breadcrumbs::register( - 'admin.configuration.index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('admin.index'); - $breadcrumbs->push(trans('firefly.instance_configuration'), route('admin.configuration.index')); -} -); - - -Breadcrumbs::register( - 'admin.links.index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('admin.index'); - $breadcrumbs->push(trans('firefly.journal_link_configuration'), route('admin.links.index')); -} -); - -Breadcrumbs::register( - 'admin.links.create', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('admin.links.index'); - $breadcrumbs->push(trans('firefly.create_new_link_type'), route('admin.links.create')); -} -); - -Breadcrumbs::register( - 'admin.links.show', function (BreadCrumbGenerator $breadcrumbs, LinkType $linkType) { - $breadcrumbs->parent('admin.links.index'); - $breadcrumbs->push(trans('firefly.overview_for_link', [$linkType->name]), route('admin.links.show', [$linkType->id])); -} -); - -Breadcrumbs::register( - 'admin.links.edit', function (BreadCrumbGenerator $breadcrumbs, LinkType $linkType) { - $breadcrumbs->parent('admin.links.index'); - $breadcrumbs->push(trans('firefly.edit_link_type', ['name' => $linkType->name]), route('admin.links.edit', [$linkType->id])); -} -); - -Breadcrumbs::register( - 'admin.links.delete', function (BreadCrumbGenerator $breadcrumbs, LinkType $linkType) { - $breadcrumbs->parent('admin.links.index'); - $breadcrumbs->push(trans('firefly.delete_link_type', ['name' => $linkType->name]), route('admin.links.delete', [$linkType->id])); -} -); - -Breadcrumbs::register( - 'transactions.link.delete', function (BreadCrumbGenerator $breadcrumbs, TransactionJournalLink $link) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('breadcrumbs.delete_journal_link'), route('transactions.link.delete', $link->id)); - -} -); - -/** - * ATTACHMENTS - */ -Breadcrumbs::register( - 'attachments.edit', function (BreadCrumbGenerator $breadcrumbs, Attachment $attachment) { - $object = $attachment->attachable; - if ($object instanceof TransactionJournal) { - $breadcrumbs->parent('transactions.show', $object); - $breadcrumbs->push($attachment->filename, route('attachments.edit', [$attachment])); - - } else { - throw new FireflyException('Cannot make breadcrumb for attachment connected to object of type ' . get_class($object)); - } - -} -); -Breadcrumbs::register( - 'attachments.delete', function (BreadCrumbGenerator $breadcrumbs, Attachment $attachment) { - - $object = $attachment->attachable; - if ($object instanceof TransactionJournal) { - $breadcrumbs->parent('transactions.show', $object); - $breadcrumbs->push(trans('firefly.delete_attachment', ['name' => $attachment->filename]), route('attachments.edit', [$attachment])); - - } else { - throw new FireflyException('Cannot make breadcrumb for attachment connected to object of type ' . get_class($object)); - } -} -); - -/** - * BILLS - */ -Breadcrumbs::register( - 'bills.index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('breadcrumbs.bills'), route('bills.index')); -} -); -Breadcrumbs::register( - 'bills.create', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('bills.index'); - $breadcrumbs->push(trans('breadcrumbs.newBill'), route('bills.create')); -} -); - -Breadcrumbs::register( - 'bills.edit', function (BreadCrumbGenerator $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 (BreadCrumbGenerator $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 (BreadCrumbGenerator $breadcrumbs, Bill $bill) { - $breadcrumbs->parent('bills.index'); - $breadcrumbs->push(e($bill->name), route('bills.show', [$bill->id])); - -} -); - - -/** - * BUDGETS - */ -Breadcrumbs::register( - 'budgets.index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('firefly.budgets'), route('budgets.index')); -} -); -Breadcrumbs::register( - 'budgets.create', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('budgets.index'); - $breadcrumbs->push(trans('firefly.create_new_budget'), route('budgets.create')); -} -); - -Breadcrumbs::register( - 'budgets.edit', function (BreadCrumbGenerator $breadcrumbs, Budget $budget) { - $breadcrumbs->parent('budgets.show', $budget); - $breadcrumbs->push(trans('firefly.edit_budget', ['name' => e($budget->name)]), route('budgets.edit', [$budget->id])); -} -); -Breadcrumbs::register( - 'budgets.delete', function (BreadCrumbGenerator $breadcrumbs, Budget $budget) { - $breadcrumbs->parent('budgets.show', $budget); - $breadcrumbs->push(trans('firefly.delete_budget', ['name' => e($budget->name)]), route('budgets.delete', [$budget->id])); -} -); - -Breadcrumbs::register( - 'budgets.no-budget', function (BreadCrumbGenerator $breadcrumbs, string $moment, Carbon $start, Carbon $end) { - $breadcrumbs->parent('budgets.index'); - $breadcrumbs->push(trans('firefly.journals_without_budget'), route('budgets.no-budget')); - - // push when is all: - if ($moment === 'all') { - $breadcrumbs->push(trans('firefly.everything'), route('budgets.no-budget', ['all'])); - } - // when is specific period or when empty: - if ($moment !== 'all' && $moment !== '(nothing)') { - $title = trans( - 'firefly.between_dates_breadcrumb', ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), - 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] + $breadcrumbs->push( + $title, + route('budgets.show.limit', [$budget->id, $budgetLimit->id]) ); - $breadcrumbs->push($title, route('budgets.no-budget', [$moment])); } - - -} ); +// CATEGORIES Breadcrumbs::register( - 'budgets.show', function (BreadCrumbGenerator $breadcrumbs, Budget $budget) { - $breadcrumbs->parent('budgets.index'); - $breadcrumbs->push(e($budget->name), route('budgets.show', [$budget->id])); - $breadcrumbs->push(trans('firefly.everything'), route('budgets.show', [$budget->id])); -} -); - -Breadcrumbs::register( - 'budgets.show.limit', function (BreadCrumbGenerator $breadcrumbs, Budget $budget, BudgetLimit $budgetLimit) { - $breadcrumbs->parent('budgets.index'); - $breadcrumbs->push(e($budget->name), route('budgets.show', [$budget->id])); - - $title = trans( - 'firefly.between_dates_breadcrumb', ['start' => $budgetLimit->start_date->formatLocalized(strval(trans('config.month_and_day'))), - 'end' => $budgetLimit->end_date->formatLocalized(strval(trans('config.month_and_day'))),] - ); - - $breadcrumbs->push( - $title, route('budgets.show.limit', [$budget->id, $budgetLimit->id]) - ); -} -); - -/** - * CATEGORIES - */ -Breadcrumbs::register( - 'categories.index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('firefly.categories'), route('categories.index')); -} -); -Breadcrumbs::register( - 'categories.create', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('categories.index'); - $breadcrumbs->push(trans('firefly.new_category'), route('categories.create')); -} -); - -Breadcrumbs::register( - 'categories.edit', function (BreadCrumbGenerator $breadcrumbs, Category $category) { - $breadcrumbs->parent('categories.show', $category, '(nothing)', new Carbon, new Carbon); - $breadcrumbs->push(trans('firefly.edit_category', ['name' => e($category->name)]), route('categories.edit', [$category->id])); -} -); -Breadcrumbs::register( - 'categories.delete', function (BreadCrumbGenerator $breadcrumbs, Category $category) { - $breadcrumbs->parent('categories.show', $category, '(nothing)', new Carbon, new Carbon); - $breadcrumbs->push(trans('firefly.delete_category', ['name' => e($category->name)]), route('categories.delete', [$category->id])); -} -); - -Breadcrumbs::register( - 'categories.show', function (BreadCrumbGenerator $breadcrumbs, Category $category, string $moment, Carbon $start, Carbon $end) { - - $breadcrumbs->parent('categories.index'); - $breadcrumbs->push($category->name, route('categories.show', [$category->id])); - - // push when is all: - if ($moment === 'all') { - $breadcrumbs->push(trans('firefly.everything'), route('categories.show', [$category->id, 'all'])); + 'categories.index', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('firefly.categories'), route('categories.index')); } - // when is specific period or when empty: - if ($moment !== 'all' && $moment !== '(nothing)') { - $title = trans( - 'firefly.between_dates_breadcrumb', ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), - 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] +); +Breadcrumbs::register( + 'categories.create', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('categories.index'); + $breadcrumbs->push(trans('firefly.new_category'), route('categories.create')); + } +); + +Breadcrumbs::register( + 'categories.edit', + function (BreadCrumbGenerator $breadcrumbs, Category $category) { + $breadcrumbs->parent('categories.show', $category, '(nothing)', new Carbon, new Carbon); + $breadcrumbs->push(trans('firefly.edit_category', ['name' => e($category->name)]), route('categories.edit', [$category->id])); + } +); +Breadcrumbs::register( + 'categories.delete', + function (BreadCrumbGenerator $breadcrumbs, Category $category) { + $breadcrumbs->parent('categories.show', $category, '(nothing)', new Carbon, new Carbon); + $breadcrumbs->push(trans('firefly.delete_category', ['name' => e($category->name)]), route('categories.delete', [$category->id])); + } +); + +Breadcrumbs::register( + 'categories.show', + function (BreadCrumbGenerator $breadcrumbs, Category $category, string $moment, Carbon $start, Carbon $end) { + $breadcrumbs->parent('categories.index'); + $breadcrumbs->push($category->name, route('categories.show', [$category->id])); + + // push when is all: + if ('all' === $moment) { + $breadcrumbs->push(trans('firefly.everything'), route('categories.show', [$category->id, 'all'])); + } + // when is specific period or when empty: + if ('all' !== $moment && '(nothing)' !== $moment) { + $title = trans( + 'firefly.between_dates_breadcrumb', + ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), + 'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),] + ); + $breadcrumbs->push($title, route('categories.show', [$category->id, $moment])); + } + } +); + +Breadcrumbs::register( + 'categories.no-category', + function (BreadCrumbGenerator $breadcrumbs, string $moment, Carbon $start, Carbon $end) { + $breadcrumbs->parent('categories.index'); + $breadcrumbs->push(trans('firefly.journals_without_category'), route('categories.no-category')); + + // push when is all: + if ('all' === $moment) { + $breadcrumbs->push(trans('firefly.everything'), route('categories.no-category', ['all'])); + } + // when is specific period or when empty: + if ('all' !== $moment && '(nothing)' !== $moment) { + $title = trans( + 'firefly.between_dates_breadcrumb', + ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), + 'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),] + ); + $breadcrumbs->push($title, route('categories.no-category', [$moment])); + } + } +); + +// CURRENCIES +Breadcrumbs::register( + 'currencies.index', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('firefly.currencies'), route('currencies.index')); + } +); + +Breadcrumbs::register( + 'currencies.create', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('currencies.index'); + $breadcrumbs->push(trans('firefly.create_currency'), route('currencies.create')); + } +); + +Breadcrumbs::register( + 'currencies.edit', + function (BreadCrumbGenerator $breadcrumbs, TransactionCurrency $currency) { + $breadcrumbs->parent('currencies.index'); + $breadcrumbs->push(trans('breadcrumbs.edit_currency', ['name' => e($currency->name)]), route('currencies.edit', [$currency->id])); + } +); +Breadcrumbs::register( + 'currencies.delete', + function (BreadCrumbGenerator $breadcrumbs, TransactionCurrency $currency) { + $breadcrumbs->parent('currencies.index'); + $breadcrumbs->push(trans('breadcrumbs.delete_currency', ['name' => e($currency->name)]), route('currencies.delete', [$currency->id])); + } +); + +// EXPORT +Breadcrumbs::register( + 'export.index', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('firefly.export_data'), route('export.index')); + } +); + +// PIGGY BANKS +Breadcrumbs::register( + 'piggy-banks.index', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('firefly.piggyBanks'), route('piggy-banks.index')); + } +); +Breadcrumbs::register( + 'piggy-banks.create', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('piggy-banks.index'); + $breadcrumbs->push(trans('breadcrumbs.newPiggyBank'), route('piggy-banks.create')); + } +); + +Breadcrumbs::register( + 'piggy-banks.edit', + function (BreadCrumbGenerator $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 (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) { + $breadcrumbs->parent('piggy-banks.show', $piggyBank); + $breadcrumbs->push(trans('firefly.delete_piggy_bank', ['name' => e($piggyBank->name)]), route('piggy-banks.delete', [$piggyBank->id])); + } +); + +Breadcrumbs::register( + 'piggy-banks.show', + function (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) { + $breadcrumbs->parent('piggy-banks.index'); + $breadcrumbs->push(e($piggyBank->name), route('piggy-banks.show', [$piggyBank->id])); + } +); + +Breadcrumbs::register( + 'piggy-banks.add-money-mobile', + function (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) { + $breadcrumbs->parent('piggy-banks.show', $piggyBank); + $breadcrumbs->push(trans('firefly.add_money_to_piggy', ['name' => $piggyBank->name]), route('piggy-banks.add-money-mobile', [$piggyBank->id])); + } +); + +Breadcrumbs::register( + 'piggy-banks.remove-money-mobile', + function (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) { + $breadcrumbs->parent('piggy-banks.show', $piggyBank); + $breadcrumbs->push( + trans('firefly.remove_money_from_piggy_title', ['name' => $piggyBank->name]), + route('piggy-banks.remove-money-mobile', [$piggyBank->id]) ); - $breadcrumbs->push($title, route('categories.show', [$category->id, $moment])); } -} ); +// IMPORT +Breadcrumbs::register( + 'import.index', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('firefly.import'), route('import.index')); + } +); + +// FILE IMPORT +Breadcrumbs::register( + 'import.file.index', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('import.index'); + $breadcrumbs->push(trans('firefly.import_file'), route('import.file.index')); + } +); Breadcrumbs::register( - 'categories.no-category', function (BreadCrumbGenerator $breadcrumbs, string $moment, Carbon $start, Carbon $end) { - $breadcrumbs->parent('categories.index'); - $breadcrumbs->push(trans('firefly.journals_without_category'), route('categories.no-category')); - - // push when is all: - if ($moment === 'all') { - $breadcrumbs->push(trans('firefly.everything'), route('categories.no-category', ['all'])); + 'import.file.configure', + function (BreadCrumbGenerator $breadcrumbs, ImportJob $job) { + $breadcrumbs->parent('import.file.index'); + $breadcrumbs->push(trans('firefly.import_config_sub_title', ['key' => $job->key]), route('import.file.configure', [$job->key])); } - // when is specific period or when empty: - if ($moment !== 'all' && $moment !== '(nothing)') { - $title = trans( - 'firefly.between_dates_breadcrumb', ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), - 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] +); +Breadcrumbs::register( + 'import.file.status', + function (BreadCrumbGenerator $breadcrumbs, ImportJob $job) { + $breadcrumbs->parent('import.file.index'); + $breadcrumbs->push(trans('firefly.import_status_bread_crumb', ['key' => $job->key]), route('import.file.status', [$job->key])); + } +); + +// PREFERENCES +Breadcrumbs::register( + 'preferences.index', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('breadcrumbs.preferences'), route('preferences.index')); + } +); + +Breadcrumbs::register( + 'preferences.code', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('breadcrumbs.preferences'), route('preferences.index')); + } +); + +// PROFILE +Breadcrumbs::register( + 'profile.index', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('breadcrumbs.profile'), route('profile.index')); + } +); +Breadcrumbs::register( + 'profile.change-password', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('profile.index'); + $breadcrumbs->push(trans('breadcrumbs.changePassword'), route('profile.change-password')); + } +); +Breadcrumbs::register( + 'profile.delete-account', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('profile.index'); + $breadcrumbs->push(trans('firefly.delete_account'), route('profile.delete-account')); + } +); + +// REPORTS +Breadcrumbs::register( + 'reports.index', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('breadcrumbs.reports'), route('reports.index')); + } +); + +Breadcrumbs::register( + 'reports.report.audit', + function (BreadCrumbGenerator $breadcrumbs, string $accountIds, Carbon $start, Carbon $end) { + $breadcrumbs->parent('reports.index'); + + $monthFormat = (string)trans('config.month_and_day'); + $startString = $start->formatLocalized($monthFormat); + $endString = $end->formatLocalized($monthFormat); + $title = (string)trans('firefly.report_audit', ['start' => $startString, 'end' => $endString]); + + $breadcrumbs->push($title, route('reports.report.audit', [$accountIds, $start->format('Ymd'), $end->format('Ymd')])); + } +); +Breadcrumbs::register( + 'reports.report.budget', + function (BreadCrumbGenerator $breadcrumbs, string $accountIds, string $budgetIds, Carbon $start, Carbon $end) { + $breadcrumbs->parent('reports.index'); + + $monthFormat = (string)trans('config.month_and_day'); + $startString = $start->formatLocalized($monthFormat); + $endString = $end->formatLocalized($monthFormat); + $title = (string)trans('firefly.report_budget', ['start' => $startString, 'end' => $endString]); + + $breadcrumbs->push($title, route('reports.report.budget', [$accountIds, $budgetIds, $start->format('Ymd'), $end->format('Ymd')])); + } +); + +Breadcrumbs::register( + 'reports.report.tag', + function (BreadCrumbGenerator $breadcrumbs, string $accountIds, string $tagTags, Carbon $start, Carbon $end) { + $breadcrumbs->parent('reports.index'); + + $monthFormat = (string)trans('config.month_and_day'); + $startString = $start->formatLocalized($monthFormat); + $endString = $end->formatLocalized($monthFormat); + $title = (string)trans('firefly.report_tag', ['start' => $startString, 'end' => $endString]); + + $breadcrumbs->push($title, route('reports.report.tag', [$accountIds, $tagTags, $start->format('Ymd'), $end->format('Ymd')])); + } +); + +Breadcrumbs::register( + 'reports.report.category', + function (BreadCrumbGenerator $breadcrumbs, string $accountIds, string $categoryIds, Carbon $start, Carbon $end) { + $breadcrumbs->parent('reports.index'); + + $monthFormat = (string)trans('config.month_and_day'); + $startString = $start->formatLocalized($monthFormat); + $endString = $end->formatLocalized($monthFormat); + $title = (string)trans('firefly.report_category', ['start' => $startString, 'end' => $endString]); + + $breadcrumbs->push($title, route('reports.report.category', [$accountIds, $categoryIds, $start->format('Ymd'), $end->format('Ymd')])); + } +); + +Breadcrumbs::register( + 'reports.report.default', + function (BreadCrumbGenerator $breadcrumbs, string $accountIds, Carbon $start, Carbon $end) { + $breadcrumbs->parent('reports.index'); + + $monthFormat = (string)trans('config.month_and_day'); + $startString = $start->formatLocalized($monthFormat); + $endString = $end->formatLocalized($monthFormat); + $title = (string)trans('firefly.report_default', ['start' => $startString, 'end' => $endString]); + + $breadcrumbs->push($title, route('reports.report.default', [$accountIds, $start->format('Ymd'), $end->format('Ymd')])); + } +); + +// New user Controller +Breadcrumbs::register( + 'new-user.index', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('firefly.getting_started'), route('new-user.index')); + } +); + +// Rules +Breadcrumbs::register( + 'rules.index', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('firefly.rules'), route('rules.index')); + } +); + +Breadcrumbs::register( + 'rules.create', + function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) { + $breadcrumbs->parent('rules.index'); + $breadcrumbs->push(trans('firefly.make_new_rule', ['title' => $ruleGroup->title]), route('rules.create', [$ruleGroup])); + } +); +Breadcrumbs::register( + 'rules.edit', + function (BreadCrumbGenerator $breadcrumbs, Rule $rule) { + $breadcrumbs->parent('rules.index'); + $breadcrumbs->push(trans('firefly.edit_rule', ['title' => $rule->title]), route('rules.edit', [$rule])); + } +); +Breadcrumbs::register( + 'rules.delete', + function (BreadCrumbGenerator $breadcrumbs, Rule $rule) { + $breadcrumbs->parent('rules.index'); + $breadcrumbs->push(trans('firefly.delete_rule', ['title' => $rule->title]), route('rules.delete', [$rule])); + } +); +Breadcrumbs::register( + 'rule-groups.create', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('rules.index'); + $breadcrumbs->push(trans('firefly.make_new_rule_group'), route('rule-groups.create')); + } +); +Breadcrumbs::register( + 'rule-groups.edit', + function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) { + $breadcrumbs->parent('rules.index'); + $breadcrumbs->push(trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]), route('rule-groups.edit', [$ruleGroup])); + } +); +Breadcrumbs::register( + 'rule-groups.delete', + function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) { + $breadcrumbs->parent('rules.index'); + $breadcrumbs->push(trans('firefly.delete_rule_group', ['title' => $ruleGroup->title]), route('rule-groups.delete', [$ruleGroup])); + } +); + +Breadcrumbs::register( + 'rule-groups.select-transactions', + function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) { + $breadcrumbs->parent('rules.index'); + $breadcrumbs->push( + trans('firefly.rule_group_select_transactions', ['title' => $ruleGroup->title]), route('rule-groups.select-transactions', [$ruleGroup]) ); - $breadcrumbs->push($title, route('categories.no-category', [$moment])); } - - -} -); - - -/** - * CURRENCIES - */ -Breadcrumbs::register( - 'currencies.index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('firefly.currencies'), route('currencies.index')); -} ); Breadcrumbs::register( - 'currencies.create', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('currencies.index'); - $breadcrumbs->push(trans('firefly.create_currency'), route('currencies.create')); -} -); - -Breadcrumbs::register( - 'currencies.edit', function (BreadCrumbGenerator $breadcrumbs, TransactionCurrency $currency) { - $breadcrumbs->parent('currencies.index'); - $breadcrumbs->push(trans('breadcrumbs.edit_currency', ['name' => e($currency->name)]), route('currencies.edit', [$currency->id])); -} -); -Breadcrumbs::register( - 'currencies.delete', function (BreadCrumbGenerator $breadcrumbs, TransactionCurrency $currency) { - $breadcrumbs->parent('currencies.index'); - $breadcrumbs->push(trans('breadcrumbs.delete_currency', ['name' => e($currency->name)]), route('currencies.delete', [$currency->id])); -} -); - -/** - * EXPORT - */ -Breadcrumbs::register( - 'export.index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('firefly.export_data'), route('export.index')); -} -); - -/** - * PIGGY BANKS - */ -Breadcrumbs::register( - 'piggy-banks.index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('firefly.piggyBanks'), route('piggy-banks.index')); -} -); -Breadcrumbs::register( - 'piggy-banks.create', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('piggy-banks.index'); - $breadcrumbs->push(trans('breadcrumbs.newPiggyBank'), route('piggy-banks.create')); -} -); - -Breadcrumbs::register( - 'piggy-banks.edit', function (BreadCrumbGenerator $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 (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) { - $breadcrumbs->parent('piggy-banks.show', $piggyBank); - $breadcrumbs->push(trans('firefly.delete_piggy_bank', ['name' => e($piggyBank->name)]), route('piggy-banks.delete', [$piggyBank->id])); -} -); - -Breadcrumbs::register( - 'piggy-banks.show', function (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) { - $breadcrumbs->parent('piggy-banks.index'); - $breadcrumbs->push(e($piggyBank->name), route('piggy-banks.show', [$piggyBank->id])); -} -); - -Breadcrumbs::register( - 'piggy-banks.add-money-mobile', function (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) { - $breadcrumbs->parent('piggy-banks.show', $piggyBank); - $breadcrumbs->push(trans('firefly.add_money_to_piggy', ['name' => $piggyBank->name]), route('piggy-banks.add-money-mobile', [$piggyBank->id])); -} -); - -Breadcrumbs::register( - 'piggy-banks.remove-money-mobile', function (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) { - $breadcrumbs->parent('piggy-banks.show', $piggyBank); - $breadcrumbs->push( - trans('firefly.remove_money_from_piggy_title', ['name' => $piggyBank->name]), route('piggy-banks.remove-money-mobile', [$piggyBank->id]) - ); -} -); - -/** - * IMPORT - */ -Breadcrumbs::register( - 'import.index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('firefly.import'), route('import.index')); -} -); - -/** - * FILE IMPORT - */ -Breadcrumbs::register( - 'import.file.index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('import.index'); - $breadcrumbs->push(trans('firefly.import_file'), route('import.file.index')); -} -); - -Breadcrumbs::register( - 'import.file.configure', function (BreadCrumbGenerator $breadcrumbs, ImportJob $job) { - $breadcrumbs->parent('import.file.index'); - $breadcrumbs->push(trans('firefly.import_config_sub_title', ['key' => $job->key]), route('import.file.configure', [$job->key])); -} -); -Breadcrumbs::register( - 'import.file.status', function (BreadCrumbGenerator $breadcrumbs, ImportJob $job) { - $breadcrumbs->parent('import.file.index'); - $breadcrumbs->push(trans('firefly.import_status_bread_crumb', ['key' => $job->key]), route('import.file.status', [$job->key])); -} -); - -/** - * PREFERENCES - */ -Breadcrumbs::register( - 'preferences.index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('breadcrumbs.preferences'), route('preferences.index')); -} -); - -Breadcrumbs::register( - 'preferences.code', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('breadcrumbs.preferences'), route('preferences.index')); - -} -); - -/** - * PROFILE - */ -Breadcrumbs::register( - 'profile.index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('breadcrumbs.profile'), route('profile.index')); - -} -); -Breadcrumbs::register( - 'profile.change-password', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('profile.index'); - $breadcrumbs->push(trans('breadcrumbs.changePassword'), route('profile.change-password')); - -} -); -Breadcrumbs::register( - 'profile.delete-account', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('profile.index'); - $breadcrumbs->push(trans('firefly.delete_account'), route('profile.delete-account')); - -} -); - -/** - * REPORTS - */ -Breadcrumbs::register( - 'reports.index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('breadcrumbs.reports'), route('reports.index')); -} -); - -Breadcrumbs::register( - 'reports.report.audit', function (BreadCrumbGenerator $breadcrumbs, string $accountIds, Carbon $start, Carbon $end) { - $breadcrumbs->parent('reports.index'); - - $monthFormat = (string)trans('config.month_and_day'); - $startString = $start->formatLocalized($monthFormat); - $endString = $end->formatLocalized($monthFormat); - $title = (string)trans('firefly.report_audit', ['start' => $startString, 'end' => $endString]); - - $breadcrumbs->push($title, route('reports.report.audit', [$accountIds, $start->format('Ymd'), $end->format('Ymd')])); -} -); -Breadcrumbs::register( - 'reports.report.budget', function (BreadCrumbGenerator $breadcrumbs, string $accountIds, string $budgetIds, Carbon $start, Carbon $end) { - $breadcrumbs->parent('reports.index'); - - $monthFormat = (string)trans('config.month_and_day'); - $startString = $start->formatLocalized($monthFormat); - $endString = $end->formatLocalized($monthFormat); - $title = (string)trans('firefly.report_budget', ['start' => $startString, 'end' => $endString]); - - $breadcrumbs->push($title, route('reports.report.budget', [$accountIds, $budgetIds, $start->format('Ymd'), $end->format('Ymd')])); -} -); - -Breadcrumbs::register( - 'reports.report.tag', function (BreadCrumbGenerator $breadcrumbs, string $accountIds, string $tagTags, Carbon $start, Carbon $end) { - $breadcrumbs->parent('reports.index'); - - $monthFormat = (string)trans('config.month_and_day'); - $startString = $start->formatLocalized($monthFormat); - $endString = $end->formatLocalized($monthFormat); - $title = (string)trans('firefly.report_tag', ['start' => $startString, 'end' => $endString]); - - $breadcrumbs->push($title, route('reports.report.tag', [$accountIds, $tagTags, $start->format('Ymd'), $end->format('Ymd')])); -} -); - -Breadcrumbs::register( - 'reports.report.category', function (BreadCrumbGenerator $breadcrumbs, string $accountIds, string $categoryIds, Carbon $start, Carbon $end) { - $breadcrumbs->parent('reports.index'); - - $monthFormat = (string)trans('config.month_and_day'); - $startString = $start->formatLocalized($monthFormat); - $endString = $end->formatLocalized($monthFormat); - $title = (string)trans('firefly.report_category', ['start' => $startString, 'end' => $endString]); - - $breadcrumbs->push($title, route('reports.report.category', [$accountIds, $categoryIds, $start->format('Ymd'), $end->format('Ymd')])); -} -); - -Breadcrumbs::register( - 'reports.report.default', function (BreadCrumbGenerator $breadcrumbs, string $accountIds, Carbon $start, Carbon $end) { - $breadcrumbs->parent('reports.index'); - - $monthFormat = (string)trans('config.month_and_day'); - $startString = $start->formatLocalized($monthFormat); - $endString = $end->formatLocalized($monthFormat); - $title = (string)trans('firefly.report_default', ['start' => $startString, 'end' => $endString]); - - $breadcrumbs->push($title, route('reports.report.default', [$accountIds, $start->format('Ymd'), $end->format('Ymd')])); -} -); - -/** - * New user Controller - */ -Breadcrumbs::register( - 'new-user.index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('firefly.getting_started'), route('new-user.index')); -} -); - -/** - * Rules - */ -Breadcrumbs::register( - 'rules.index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('firefly.rules'), route('rules.index')); -} -); - -Breadcrumbs::register( - 'rules.create', function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) { - $breadcrumbs->parent('rules.index'); - $breadcrumbs->push(trans('firefly.make_new_rule', ['title' => $ruleGroup->title]), route('rules.create', [$ruleGroup])); -} -); -Breadcrumbs::register( - 'rules.edit', function (BreadCrumbGenerator $breadcrumbs, Rule $rule) { - $breadcrumbs->parent('rules.index'); - $breadcrumbs->push(trans('firefly.edit_rule', ['title' => $rule->title]), route('rules.edit', [$rule])); -} -); -Breadcrumbs::register( - 'rules.delete', function (BreadCrumbGenerator $breadcrumbs, Rule $rule) { - $breadcrumbs->parent('rules.index'); - $breadcrumbs->push(trans('firefly.delete_rule', ['title' => $rule->title]), route('rules.delete', [$rule])); -} -); -Breadcrumbs::register( - 'rule-groups.create', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('rules.index'); - $breadcrumbs->push(trans('firefly.make_new_rule_group'), route('rule-groups.create')); -} -); -Breadcrumbs::register( - 'rule-groups.edit', function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) { - $breadcrumbs->parent('rules.index'); - $breadcrumbs->push(trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]), route('rule-groups.edit', [$ruleGroup])); -} -); -Breadcrumbs::register( - 'rule-groups.delete', function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) { - $breadcrumbs->parent('rules.index'); - $breadcrumbs->push(trans('firefly.delete_rule_group', ['title' => $ruleGroup->title]), route('rule-groups.delete', [$ruleGroup])); -} -); - -Breadcrumbs::register( - 'rule-groups.select-transactions', function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) { - $breadcrumbs->parent('rules.index'); - $breadcrumbs->push(trans('firefly.rule_group_select_transactions', ['title' => $ruleGroup->title]), route('rule-groups.select-transactions', [$ruleGroup])); -} -); - -Breadcrumbs::register( - 'rule-groups.select_transactions', function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) { - $breadcrumbs->parent('rules.index'); - $breadcrumbs->push( - trans('firefly.execute_group_on_existing_transactions', ['title' => $ruleGroup->title]), route('rule-groups.select_transactions', [$ruleGroup]) - ); -} -); - - -/** - * SEARCH - */ -Breadcrumbs::register( - 'search.index', function (BreadCrumbGenerator $breadcrumbs, $query) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('breadcrumbs.search_result', ['query' => e($query)]), route('search.index')); -} -); - - -/** - * TAGS - */ -Breadcrumbs::register( - 'tags.index', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('breadcrumbs.tags'), route('tags.index')); -} -); - -Breadcrumbs::register( - 'tags.create', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('tags.index'); - $breadcrumbs->push(trans('breadcrumbs.createTag'), route('tags.create')); -} -); - -Breadcrumbs::register( - 'tags.edit', function (BreadCrumbGenerator $breadcrumbs, Tag $tag) { - $breadcrumbs->parent('tags.show', $tag, '(nothing)', new Carbon, new Carbon); - $breadcrumbs->push(trans('breadcrumbs.edit_tag', ['tag' => e($tag->tag)]), route('tags.edit', [$tag->id])); -} -); - -Breadcrumbs::register( - 'tags.delete', function (BreadCrumbGenerator $breadcrumbs, Tag $tag) { - $breadcrumbs->parent('tags.show', $tag, '(nothing)', new Carbon, new Carbon); - $breadcrumbs->push(trans('breadcrumbs.delete_tag', ['tag' => e($tag->tag)]), route('tags.delete', [$tag->id])); -} -); - - -Breadcrumbs::register( - 'tags.show', function (BreadCrumbGenerator $breadcrumbs, Tag $tag, string $moment, Carbon $start, Carbon $end) { - $breadcrumbs->parent('tags.index'); - $breadcrumbs->push(e($tag->tag), route('tags.show', [$tag->id, $moment])); - if ($moment === 'all') { - $breadcrumbs->push(trans('firefly.everything'), route('tags.show', [$tag->id, $moment])); - } - // when is specific period or when empty: - if ($moment !== 'all' && $moment !== '(nothing)') { - $title = trans( - 'firefly.between_dates_breadcrumb', ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), - 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] + 'rule-groups.select_transactions', + function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) { + $breadcrumbs->parent('rules.index'); + $breadcrumbs->push( + trans('firefly.execute_group_on_existing_transactions', ['title' => $ruleGroup->title]), + route('rule-groups.select_transactions', [$ruleGroup]) ); - $breadcrumbs->push($title, route('tags.show', [$tag->id, $moment])); } -} ); -/** - * TRANSACTIONS - */ +// SEARCH Breadcrumbs::register( - 'transactions.index', function (BreadCrumbGenerator $breadcrumbs, string $what, string $moment = '', Carbon $start, Carbon $end) { - - - $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('breadcrumbs.' . $what . '_list'), route('transactions.index', [$what])); - if ($moment === 'all') { - $breadcrumbs->push(trans('firefly.everything'), route('transactions.index', [$what, 'all'])); + 'search.index', + function (BreadCrumbGenerator $breadcrumbs, $query) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('breadcrumbs.search_result', ['query' => e($query)]), route('search.index')); } +); - // when is specific period or when empty: - if ($moment !== 'all' && $moment !== '(nothing)') { - $title = trans( - 'firefly.between_dates_breadcrumb', ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), - 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] - ); - $breadcrumbs->push($title, route('transactions.index', [$what, $moment])); +// TAGS +Breadcrumbs::register( + 'tags.index', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('breadcrumbs.tags'), route('tags.index')); } - -} ); Breadcrumbs::register( - 'transactions.create', function (BreadCrumbGenerator $breadcrumbs, string $what) { - $breadcrumbs->parent('transactions.index', $what, '(nothing)', new Carbon, new Carbon); - $breadcrumbs->push(trans('breadcrumbs.create_' . e($what)), route('transactions.create', [$what])); -} + 'tags.create', + function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('tags.index'); + $breadcrumbs->push(trans('breadcrumbs.createTag'), route('tags.create')); + } ); Breadcrumbs::register( - 'transactions.edit', function (BreadCrumbGenerator $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 (BreadCrumbGenerator $breadcrumbs, TransactionJournal $journal) { - $breadcrumbs->parent('transactions.show', $journal); - $breadcrumbs->push(trans('breadcrumbs.delete_journal', ['description' => e($journal->description)]), route('transactions.delete', [$journal->id])); -} + 'tags.edit', + function (BreadCrumbGenerator $breadcrumbs, Tag $tag) { + $breadcrumbs->parent('tags.show', $tag, '(nothing)', new Carbon, new Carbon); + $breadcrumbs->push(trans('breadcrumbs.edit_tag', ['tag' => e($tag->tag)]), route('tags.edit', [$tag->id])); + } ); Breadcrumbs::register( - 'transactions.show', function (BreadCrumbGenerator $breadcrumbs, TransactionJournal $journal) { - - $what = strtolower($journal->transactionType->type); - $breadcrumbs->parent('transactions.index', $what, '(nothing)', new Carbon, new Carbon); - $breadcrumbs->push($journal->description, route('transactions.show', [$journal->id])); -} + 'tags.delete', + function (BreadCrumbGenerator $breadcrumbs, Tag $tag) { + $breadcrumbs->parent('tags.show', $tag, '(nothing)', new Carbon, new Carbon); + $breadcrumbs->push(trans('breadcrumbs.delete_tag', ['tag' => e($tag->tag)]), route('tags.delete', [$tag->id])); + } ); Breadcrumbs::register( - 'transactions.convert', function (BreadCrumbGenerator $breadcrumbs, TransactionType $destinationType, TransactionJournal $journal) { - - $breadcrumbs->parent('transactions.show', $journal); - $breadcrumbs->push( - trans('firefly.convert_to_' . $destinationType->type, ['description' => $journal->description]), - route('transactions.convert.index', [strtolower($destinationType->type), $journal->id]) - ); -} + 'tags.show', + function (BreadCrumbGenerator $breadcrumbs, Tag $tag, string $moment, Carbon $start, Carbon $end) { + $breadcrumbs->parent('tags.index'); + $breadcrumbs->push(e($tag->tag), route('tags.show', [$tag->id, $moment])); + if ('all' === $moment) { + $breadcrumbs->push(trans('firefly.everything'), route('tags.show', [$tag->id, $moment])); + } + // when is specific period or when empty: + if ('all' !== $moment && '(nothing)' !== $moment) { + $title = trans( + 'firefly.between_dates_breadcrumb', + ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), + 'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),] + ); + $breadcrumbs->push($title, route('tags.show', [$tag->id, $moment])); + } + } ); -/** - * MASS TRANSACTION EDIT / DELETE - */ +// TRANSACTIONS Breadcrumbs::register( - 'transactions.mass.edit', function (BreadCrumbGenerator $breadcrumbs, Collection $journals): void { + 'transactions.index', + function (BreadCrumbGenerator $breadcrumbs, string $what, string $moment = '', Carbon $start, Carbon $end) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('breadcrumbs.' . $what . '_list'), route('transactions.index', [$what])); + if ('all' === $moment) { + $breadcrumbs->push(trans('firefly.everything'), route('transactions.index', [$what, 'all'])); + } - if ($journals->count() > 0) { - $journalIds = $journals->pluck('id')->toArray(); - $what = strtolower($journals->first()->transactionType->type); + // when is specific period or when empty: + if ('all' !== $moment && '(nothing)' !== $moment) { + $title = trans( + 'firefly.between_dates_breadcrumb', + ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), + 'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),] + ); + $breadcrumbs->push($title, route('transactions.index', [$what, $moment])); + } + } +); + +Breadcrumbs::register( + 'transactions.create', + function (BreadCrumbGenerator $breadcrumbs, string $what) { $breadcrumbs->parent('transactions.index', $what, '(nothing)', new Carbon, new Carbon); - $breadcrumbs->push(trans('firefly.mass_edit_journals'), route('transactions.mass.edit', $journalIds)); + $breadcrumbs->push(trans('breadcrumbs.create_' . e($what)), route('transactions.create', [$what])); + } +); + +Breadcrumbs::register( + 'transactions.edit', + function (BreadCrumbGenerator $breadcrumbs, TransactionJournal $journal) { + $breadcrumbs->parent('transactions.show', $journal); + $breadcrumbs->push(trans('breadcrumbs.edit_journal', ['description' => $journal->description]), route('transactions.edit', [$journal->id])); + } +); + +// also edit reconciliations: +Breadcrumbs::register( + 'accounts.reconcile.edit', + function (BreadCrumbGenerator $breadcrumbs, TransactionJournal $journal) { + $breadcrumbs->parent('transactions.show', $journal); + $breadcrumbs->push(trans('breadcrumbs.edit_reconciliation', ['description' => $journal->description]), route('accounts.reconcile.edit', [$journal->id])); + } +); + +Breadcrumbs::register( + 'transactions.delete', + function (BreadCrumbGenerator $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 (BreadCrumbGenerator $breadcrumbs, TransactionJournal $journal) { + $what = strtolower($journal->transactionType->type); + $breadcrumbs->parent('transactions.index', $what, '(nothing)', new Carbon, new Carbon); + $breadcrumbs->push($journal->description, route('transactions.show', [$journal->id])); + } +); + +Breadcrumbs::register( + 'transactions.convert', + function (BreadCrumbGenerator $breadcrumbs, TransactionType $destinationType, TransactionJournal $journal) { + $breadcrumbs->parent('transactions.show', $journal); + $breadcrumbs->push( + trans('firefly.convert_to_' . $destinationType->type, ['description' => $journal->description]), + route('transactions.convert.index', [strtolower($destinationType->type), $journal->id]) + ); + } +); + +// MASS TRANSACTION EDIT / DELETE +Breadcrumbs::register( + 'transactions.mass.edit', + function (BreadCrumbGenerator $breadcrumbs, Collection $journals): void { + if ($journals->count() > 0) { + $journalIds = $journals->pluck('id')->toArray(); + $what = strtolower($journals->first()->transactionType->type); + $breadcrumbs->parent('transactions.index', $what, '(nothing)', new Carbon, new Carbon); + $breadcrumbs->push(trans('firefly.mass_edit_journals'), route('transactions.mass.edit', $journalIds)); + + return; + } + + $breadcrumbs->parent('index'); return; } - - $breadcrumbs->parent('index'); - - return; -} ); Breadcrumbs::register( - 'transactions.mass.delete', function (BreadCrumbGenerator $breadcrumbs, Collection $journals) { - - $journalIds = $journals->pluck('id')->toArray(); - $what = strtolower($journals->first()->transactionType->type); - $breadcrumbs->parent('transactions.index', $what, '(nothing)', new Carbon, new Carbon); - $breadcrumbs->push(trans('firefly.mass_edit_journals'), route('transactions.mass.delete', $journalIds)); -} + 'transactions.mass.delete', + function (BreadCrumbGenerator $breadcrumbs, Collection $journals) { + $journalIds = $journals->pluck('id')->toArray(); + $what = strtolower($journals->first()->transactionType->type); + $breadcrumbs->parent('transactions.index', $what, '(nothing)', new Carbon, new Carbon); + $breadcrumbs->push(trans('firefly.mass_edit_journals'), route('transactions.mass.delete', $journalIds)); + } ); - -/** - * SPLIT - */ +// SPLIT Breadcrumbs::register( - 'transactions.split.edit', function (BreadCrumbGenerator $breadcrumbs, TransactionJournal $journal) { - $breadcrumbs->parent('transactions.show', $journal); - $breadcrumbs->push(trans('breadcrumbs.edit_journal', ['description' => $journal->description]), route('transactions.split.edit', [$journal->id])); -} + 'transactions.split.edit', + function (BreadCrumbGenerator $breadcrumbs, TransactionJournal $journal) { + $breadcrumbs->parent('transactions.show', $journal); + $breadcrumbs->push(trans('breadcrumbs.edit_journal', ['description' => $journal->description]), route('transactions.split.edit', [$journal->id])); + } ); diff --git a/app/Import/Configurator/ConfiguratorInterface.php b/app/Import/Configurator/ConfiguratorInterface.php index 70a98e55e1..a6781310c7 100644 --- a/app/Import/Configurator/ConfiguratorInterface.php +++ b/app/Import/Configurator/ConfiguratorInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Configurator; @@ -26,9 +25,7 @@ namespace FireflyIII\Import\Configurator; use FireflyIII\Models\ImportJob; /** - * Interface ConfiguratorInterface - * - * @package FireflyIII\Import\Configurator + * Interface ConfiguratorInterface. */ interface ConfiguratorInterface { @@ -76,9 +73,6 @@ interface ConfiguratorInterface /** * @param ImportJob $job - * - * @return void */ public function setJob(ImportJob $job); - } diff --git a/app/Import/Configurator/CsvConfigurator.php b/app/Import/Configurator/CsvConfigurator.php index 24440ebfa1..79593ca556 100644 --- a/app/Import/Configurator/CsvConfigurator.php +++ b/app/Import/Configurator/CsvConfigurator.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Configurator; @@ -32,13 +31,11 @@ use FireflyIII\Support\Import\Configuration\Csv\Roles; use Log; /** - * Class CsvConfigurator - * - * @package FireflyIII\Import\Configurator + * Class CsvConfigurator. */ class CsvConfigurator implements ConfiguratorInterface { - /** @var ImportJob */ + /** @var ImportJob */ private $job; /** @var string */ @@ -57,6 +54,7 @@ class CsvConfigurator implements ConfiguratorInterface * @param array $data * * @return bool + * * @throws FireflyException */ public function configureJob(array $data): bool @@ -76,6 +74,7 @@ class CsvConfigurator implements ConfiguratorInterface * Return the data required for the next step in the job configuration. * * @return array + * * @throws FireflyException */ public function getNextData(): array @@ -87,11 +86,11 @@ class CsvConfigurator implements ConfiguratorInterface $object->setJob($job); return $object->getData(); - } /** * @return string + * * @throws FireflyException */ public function getNextView(): string @@ -147,7 +146,7 @@ class CsvConfigurator implements ConfiguratorInterface public function setJob(ImportJob $job) { $this->job = $job; - if (is_null($this->job->configuration) || count($this->job->configuration) === 0) { + if (null === $this->job->configuration || 0 === count($this->job->configuration)) { Log::debug(sprintf('Gave import job %s initial configuration.', $this->job->key)); $this->job->configuration = config('csv.default_config'); $this->job->save(); @@ -156,26 +155,27 @@ class CsvConfigurator implements ConfiguratorInterface /** * @return string + * * @throws FireflyException */ private function getConfigurationClass(): string { $class = false; switch (true) { - case (!$this->job->configuration['initial-config-complete']): + case !$this->job->configuration['initial-config-complete']: $class = Initial::class; break; - case (!$this->job->configuration['column-roles-complete']): + case !$this->job->configuration['column-roles-complete']: $class = Roles::class; break; - case (!$this->job->configuration['column-mapping-complete']): + case !$this->job->configuration['column-mapping-complete']: $class = Map::class; break; default: break; } - if ($class === false || strlen($class) === 0) { + if (false === $class || 0 === strlen($class)) { throw new FireflyException('Cannot handle current job state in getConfigurationClass().'); } if (!class_exists($class)) { diff --git a/app/Import/Converter/Amount.php b/app/Import/Converter/Amount.php index 9ed5b426d3..0977ccba88 100644 --- a/app/Import/Converter/Amount.php +++ b/app/Import/Converter/Amount.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Converter; @@ -26,16 +25,13 @@ namespace FireflyIII\Import\Converter; use Log; /** - * Class RabobankDebetCredit - * - * @package FireflyIII\Import\Converter + * Class RabobankDebetCredit. */ class Amount implements ConverterInterface { - /** * Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. - * - Jamie Zawinski + * - Jamie Zawinski. * * * @param $value @@ -46,7 +42,7 @@ class Amount implements ConverterInterface */ public function convert($value): string { - if (is_null($value)) { + if (null === $value) { return '0'; } $value = strval($value); @@ -56,35 +52,35 @@ class Amount implements ConverterInterface $altPosition = $len - 2; $decimal = null; - if (($len > 2 && $value{$decimalPosition} === '.') || ($len > 2 && strpos($value, '.') > $decimalPosition)) { + if (($len > 2 && '.' === $value[$decimalPosition]) || ($len > 2 && strpos($value, '.') > $decimalPosition)) { $decimal = '.'; Log::debug(sprintf('Decimal character in "%s" seems to be a dot.', $value)); } - if ($len > 2 && $value{$decimalPosition} === ',') { + if ($len > 2 && ',' === $value[$decimalPosition]) { $decimal = ','; Log::debug(sprintf('Decimal character in "%s" seems to be a comma.', $value)); } // decimal character is null? find out if "0.1" or ".1" or "0,1" or ",1" - if ($len > 1 && ($value{$altPosition} === '.' || $value{$altPosition} === ',')) { - $decimal = $value{$altPosition}; + if ($len > 1 && ('.' === $value[$altPosition] || ',' === $value[$altPosition])) { + $decimal = $value[$altPosition]; Log::debug(sprintf('Alternate search resulted in "%s" for decimal sign.', $decimal)); } // if decimal is dot, replace all comma's and spaces with nothing. then parse as float (round to 4 pos) - if ($decimal === '.') { + if ('.' === $decimal) { $search = [',', ' ']; $oldValue = $value; $value = str_replace($search, '', $value); Log::debug(sprintf('Converted amount from "%s" to "%s".', $oldValue, $value)); } - if ($decimal === ',') { + if (',' === $decimal) { $search = ['.', ' ']; $oldValue = $value; $value = str_replace($search, '', $value); $value = str_replace(',', '.', $value); Log::debug(sprintf('Converted amount from "%s" to "%s".', $oldValue, $value)); } - if (is_null($decimal)) { + if (null === $decimal) { // replace all: $search = ['.', ' ', ',']; $oldValue = $value; @@ -92,7 +88,8 @@ class Amount implements ConverterInterface Log::debug(sprintf('No decimal character found. Converted amount from "%s" to "%s".', $oldValue, $value)); } - return strval(round(floatval($value), 12)); + $number = strval(number_format(round(floatval($value), 12), 12, '.', '')); + return $number; } } diff --git a/app/Import/Converter/AmountCredit.php b/app/Import/Converter/AmountCredit.php new file mode 100644 index 0000000000..2e37f42706 --- /dev/null +++ b/app/Import/Converter/AmountCredit.php @@ -0,0 +1,44 @@ +. + */ +declare(strict_types=1); + +namespace FireflyIII\Import\Converter; + +/** + * Class AmountCredit + */ +class AmountCredit implements ConverterInterface +{ + /** + * @param $value + * + * @return string + */ + public function convert($value): string + { + /** @var ConverterInterface $converter */ + $converter = app(Amount::class); + $result = $converter->convert($value); + $result = app('steam')->positive($result); + + return $result; + } +} diff --git a/app/Import/Converter/AmountDebet.php b/app/Import/Converter/AmountDebet.php new file mode 100644 index 0000000000..a890ae3209 --- /dev/null +++ b/app/Import/Converter/AmountDebet.php @@ -0,0 +1,45 @@ +. + */ +declare(strict_types=1); + +namespace FireflyIII\Import\Converter; + +/** + * Class AmountDebet + */ +class AmountDebet implements ConverterInterface +{ + /** + * @param $value + * + * @return string + */ + public function convert($value): string + { + /** @var ConverterInterface $converter */ + $converter = app(Amount::class); + $result = $converter->convert($value); + $result = app('steam')->positive($result); + $result = bcmul($result, '-1'); + + return $result; + } +} diff --git a/app/Import/Converter/ConverterInterface.php b/app/Import/Converter/ConverterInterface.php index 4047c23924..20a4ba6411 100644 --- a/app/Import/Converter/ConverterInterface.php +++ b/app/Import/Converter/ConverterInterface.php @@ -18,21 +18,17 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Converter; /** - * Interface ConverterInterface - * - * @package FireflyIII\Import\Converter + * Interface ConverterInterface. */ interface ConverterInterface { /** * @param $value - * */ public function convert($value); } diff --git a/app/Import/Converter/INGDebetCredit.php b/app/Import/Converter/INGDebetCredit.php index 2ce63b66b5..2772100bd7 100644 --- a/app/Import/Converter/INGDebetCredit.php +++ b/app/Import/Converter/INGDebetCredit.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Converter; @@ -26,13 +25,10 @@ namespace FireflyIII\Import\Converter; use Log; /** - * Class INGDebetCredit - * - * @package FireflyIII\Import\Converter + * Class INGDebetCredit. */ class INGDebetCredit implements ConverterInterface { - /** * @param $value * @@ -42,7 +38,7 @@ class INGDebetCredit implements ConverterInterface { Log::debug('Going to convert ing debet credit', ['value' => $value]); - if ($value === 'Af') { + if ('Af' === $value) { Log::debug('Return -1'); return -1; @@ -51,6 +47,5 @@ class INGDebetCredit implements ConverterInterface Log::debug('Return 1'); return 1; - } } diff --git a/app/Import/Converter/RabobankDebetCredit.php b/app/Import/Converter/RabobankDebetCredit.php index 064a740f60..81dbd57f96 100644 --- a/app/Import/Converter/RabobankDebetCredit.php +++ b/app/Import/Converter/RabobankDebetCredit.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Converter; @@ -26,13 +25,10 @@ namespace FireflyIII\Import\Converter; use Log; /** - * Class RabobankDebetCredit - * - * @package FireflyIII\Import\Converter + * Class RabobankDebetCredit. */ class RabobankDebetCredit implements ConverterInterface { - /** * @param $value * @@ -42,7 +38,7 @@ class RabobankDebetCredit implements ConverterInterface { Log::debug('Going to convert ', ['value' => $value]); - if ($value === 'D') { + if ('D' === $value) { Log::debug('Return -1'); return -1; diff --git a/app/Import/FileProcessor/CsvProcessor.php b/app/Import/FileProcessor/CsvProcessor.php index 956a2da617..0b547eb026 100644 --- a/app/Import/FileProcessor/CsvProcessor.php +++ b/app/Import/FileProcessor/CsvProcessor.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\FileProcessor; @@ -37,12 +36,10 @@ use Log; * Class CsvProcessor, as the name suggests, goes over CSV file line by line and creates * "ImportJournal" objects, which are used in another step to create new journals and transactions * and what-not. - * - * @package FireflyIII\Import\FileProcessor */ class CsvProcessor implements FileProcessorInterface { - /** @var ImportJob */ + /** @var ImportJob */ private $job; /** @var Collection */ private $objects; @@ -136,6 +133,7 @@ class CsvProcessor implements FileProcessorInterface * @param string $value * * @return array + * * @throws FireflyException */ private function annotateValue(int $index, string $value) @@ -167,7 +165,7 @@ class CsvProcessor implements FileProcessorInterface $config = $this->job->configuration; $reader = Reader::createFromString($content); $delimiter = $config['delimiter']; - if ($delimiter === 'tab') { + if ('tab' === $delimiter) { $delimiter = "\t"; } $reader->setDelimiter($delimiter); @@ -213,6 +211,7 @@ class CsvProcessor implements FileProcessorInterface * @param array $array * * @return string + * * @throws FireflyException */ private function getRowHash(array $array): string @@ -220,7 +219,7 @@ class CsvProcessor implements FileProcessorInterface $json = json_encode($array); $jsonError = json_last_error(); - if ($json === false) { + if (false === $json) { throw new FireflyException(sprintf('Error while encoding JSON for CSV row: %s', $this->getJsonError($jsonError))); } $hash = hash('sha256', $json); @@ -235,6 +234,7 @@ class CsvProcessor implements FileProcessorInterface * @param array $row * * @return ImportJournal + * * @throws FireflyException */ private function importRow(int $index, array $row): ImportJournal @@ -248,7 +248,7 @@ class CsvProcessor implements FileProcessorInterface $journal->setHash($hash); /** - * @var int $rowIndex + * @var int * @var string $value */ foreach ($row as $rowIndex => $value) { @@ -280,12 +280,11 @@ class CsvProcessor implements FileProcessorInterface ->where('data', $json) ->where('name', 'importHash') ->first(); - if (!is_null($entry)) { + if (null !== $entry) { return true; } return false; - } /** @@ -294,6 +293,7 @@ class CsvProcessor implements FileProcessorInterface * @param array $row * * @return array + * * @throws FireflyException */ private function specifics(array $row): array @@ -301,7 +301,6 @@ class CsvProcessor implements FileProcessorInterface $config = $this->job->configuration; $names = array_keys($config['specifics']); foreach ($names as $name) { - if (!in_array($name, $this->validSpecifics)) { throw new FireflyException(sprintf('"%s" is not a valid class name', $name)); } @@ -314,6 +313,5 @@ class CsvProcessor implements FileProcessorInterface } return $row; - } } diff --git a/app/Import/FileProcessor/FileProcessorInterface.php b/app/Import/FileProcessor/FileProcessorInterface.php index 3664e74f3d..e8a480176f 100644 --- a/app/Import/FileProcessor/FileProcessorInterface.php +++ b/app/Import/FileProcessor/FileProcessorInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\FileProcessor; @@ -27,14 +26,10 @@ use FireflyIII\Models\ImportJob; use Illuminate\Support\Collection; /** - * Interface FileProcessorInterface - * - * @package FireflyIII\Import\FileProcessor + * Interface FileProcessorInterface. */ interface FileProcessorInterface { - - /** * @return Collection */ diff --git a/app/Import/Logging/CommandHandler.php b/app/Import/Logging/CommandHandler.php index a21095a6fa..b55c1f9dc7 100644 --- a/app/Import/Logging/CommandHandler.php +++ b/app/Import/Logging/CommandHandler.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Logging; @@ -27,14 +26,11 @@ use Illuminate\Console\Command; use Monolog\Handler\AbstractProcessingHandler; /** - * Class CommandHandler - * - * @package FireflyIII\Import\Logging + * Class CommandHandler. */ class CommandHandler extends AbstractProcessingHandler { - - /** @var Command */ + /** @var Command */ private $command; /** @@ -51,11 +47,9 @@ class CommandHandler extends AbstractProcessingHandler } /** - * Writes the record down to the log of the implementing handler + * Writes the record down to the log of the implementing handler. * - * @param array $record - * - * @return void + * @param array $record */ protected function write(array $record) { diff --git a/app/Import/Mapper/AssetAccountIbans.php b/app/Import/Mapper/AssetAccountIbans.php index 0bcc9407d0..6a53db8941 100644 --- a/app/Import/Mapper/AssetAccountIbans.php +++ b/app/Import/Mapper/AssetAccountIbans.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Mapper; @@ -28,13 +27,10 @@ use FireflyIII\Models\AccountType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; /** - * Class AssetAccounts - * - * @package FireflyIII\Import\Mapper + * Class AssetAccounts. */ class AssetAccountIbans implements MapperInterface { - /** * @return array */ @@ -52,7 +48,7 @@ class AssetAccountIbans implements MapperInterface if (strlen($iban) > 0) { $topList[$account->id] = $account->iban . ' (' . $account->name . ')'; } - if (strlen($iban) === 0) { + if (0 === strlen($iban)) { $list[$account->id] = $account->name; } } @@ -63,6 +59,5 @@ class AssetAccountIbans implements MapperInterface $list = [0 => trans('csv.map_do_not_map')] + $list; return $list; - } } diff --git a/app/Import/Mapper/AssetAccounts.php b/app/Import/Mapper/AssetAccounts.php index 936c496ef2..43188a6833 100644 --- a/app/Import/Mapper/AssetAccounts.php +++ b/app/Import/Mapper/AssetAccounts.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Mapper; @@ -28,13 +27,10 @@ use FireflyIII\Models\AccountType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; /** - * Class AssetAccounts - * - * @package FireflyIII\Import\Mapper + * Class AssetAccounts. */ class AssetAccounts implements MapperInterface { - /** * @return array */ @@ -60,6 +56,5 @@ class AssetAccounts implements MapperInterface $list = [0 => trans('csv.map_do_not_map')] + $list; return $list; - } } diff --git a/app/Import/Mapper/Bills.php b/app/Import/Mapper/Bills.php index 505c9dccd0..b758b52dd1 100644 --- a/app/Import/Mapper/Bills.php +++ b/app/Import/Mapper/Bills.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Mapper; @@ -27,13 +26,10 @@ use FireflyIII\Models\Bill; use FireflyIII\Repositories\Bill\BillRepositoryInterface; /** - * Class Bills - * - * @package FireflyIII\Import\Mapper + * Class Bills. */ class Bills implements MapperInterface { - /** * @return array */ @@ -53,6 +49,5 @@ class Bills implements MapperInterface $list = [0 => trans('csv.map_do_not_map')] + $list; return $list; - } } diff --git a/app/Import/Mapper/Budgets.php b/app/Import/Mapper/Budgets.php index 662b38c815..eb1b73c9d8 100644 --- a/app/Import/Mapper/Budgets.php +++ b/app/Import/Mapper/Budgets.php @@ -18,23 +18,18 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Mapper; - use FireflyIII\Models\Budget; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; /** - * Class Budgets - * - * @package FireflyIII\Import\Mapper + * Class Budgets. */ class Budgets implements MapperInterface { - /** * @return array */ @@ -54,6 +49,5 @@ class Budgets implements MapperInterface $list = [0 => trans('csv.map_do_not_map')] + $list; return $list; - } } diff --git a/app/Import/Mapper/Categories.php b/app/Import/Mapper/Categories.php index 0204012fae..d6e0bd3d0f 100644 --- a/app/Import/Mapper/Categories.php +++ b/app/Import/Mapper/Categories.php @@ -18,23 +18,18 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Mapper; - use FireflyIII\Models\Category; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; /** - * Class Categories - * - * @package FireflyIII\Import\Mapper + * Class Categories. */ class Categories implements MapperInterface { - /** * @return array */ @@ -54,6 +49,5 @@ class Categories implements MapperInterface $list = [0 => trans('csv.map_do_not_map')] + $list; return $list; - } } diff --git a/app/Import/Mapper/MapperInterface.php b/app/Import/Mapper/MapperInterface.php index 528e6e8d3c..b0ca4803b5 100644 --- a/app/Import/Mapper/MapperInterface.php +++ b/app/Import/Mapper/MapperInterface.php @@ -18,19 +18,15 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Mapper; /** - * Interface MapperInterface - * - * @package FireflyIII\Import\Mapper + * Interface MapperInterface. */ interface MapperInterface { - /** * @return array */ diff --git a/app/Import/Mapper/OpposingAccountIbans.php b/app/Import/Mapper/OpposingAccountIbans.php index 476fd073ab..894ff7f509 100644 --- a/app/Import/Mapper/OpposingAccountIbans.php +++ b/app/Import/Mapper/OpposingAccountIbans.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Mapper; @@ -28,13 +27,10 @@ use FireflyIII\Models\AccountType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; /** - * Class OpposingAccounts - * - * @package FireflyIII\Import\Mapper + * Class OpposingAccounts. */ class OpposingAccountIbans implements MapperInterface { - /** * @return array */ @@ -58,7 +54,7 @@ class OpposingAccountIbans implements MapperInterface if (strlen($iban) > 0) { $topList[$account->id] = $account->iban . ' (' . $account->name . ')'; } - if (strlen($iban) === 0) { + if (0 === strlen($iban)) { $list[$account->id] = $account->name; } } @@ -68,7 +64,6 @@ class OpposingAccountIbans implements MapperInterface $list = $topList + $list; $list = [0 => trans('csv.map_do_not_map')] + $list; - return $list; } } diff --git a/app/Import/Mapper/OpposingAccounts.php b/app/Import/Mapper/OpposingAccounts.php index f880ff10d9..c80c1753ab 100644 --- a/app/Import/Mapper/OpposingAccounts.php +++ b/app/Import/Mapper/OpposingAccounts.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Mapper; @@ -28,13 +27,10 @@ use FireflyIII\Models\AccountType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; /** - * Class OpposingAccounts - * - * @package FireflyIII\Import\Mapper + * Class OpposingAccounts. */ class OpposingAccounts implements MapperInterface { - /** * @return array */ diff --git a/app/Import/Mapper/Tags.php b/app/Import/Mapper/Tags.php index 6294e42cc9..8a696ae082 100644 --- a/app/Import/Mapper/Tags.php +++ b/app/Import/Mapper/Tags.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Mapper; @@ -27,13 +26,10 @@ use FireflyIII\Models\Tag; use FireflyIII\Repositories\Tag\TagRepositoryInterface; /** - * Class Tags - * - * @package FireflyIII\Import\Mapper + * Class Tags. */ class Tags implements MapperInterface { - /** * @return array */ @@ -53,6 +49,5 @@ class Tags implements MapperInterface $list = [0 => trans('csv.map_do_not_map')] + $list; return $list; - } } diff --git a/app/Import/Mapper/TransactionCurrencies.php b/app/Import/Mapper/TransactionCurrencies.php index ac8a969a58..0a52533aee 100644 --- a/app/Import/Mapper/TransactionCurrencies.php +++ b/app/Import/Mapper/TransactionCurrencies.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Mapper; @@ -26,13 +25,10 @@ namespace FireflyIII\Import\Mapper; use FireflyIII\Models\TransactionCurrency; /** - * Class TransactionCurrencies - * - * @package FireflyIII\Import\Mapper + * Class TransactionCurrencies. */ class TransactionCurrencies implements MapperInterface { - /** * @return array */ @@ -49,6 +45,5 @@ class TransactionCurrencies implements MapperInterface $list = [0 => trans('csv.map_do_not_map')] + $list; return $list; - } } diff --git a/app/Import/MapperPreProcess/PreProcessorInterface.php b/app/Import/MapperPreProcess/PreProcessorInterface.php index 5de7418756..c8232d0239 100644 --- a/app/Import/MapperPreProcess/PreProcessorInterface.php +++ b/app/Import/MapperPreProcess/PreProcessorInterface.php @@ -18,15 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\MapperPreProcess; /** - * Interface PreProcessorInterface - * - * @package FireflyIII\Import\MapperPreProcess + * Interface PreProcessorInterface. */ interface PreProcessorInterface { @@ -36,5 +33,4 @@ interface PreProcessorInterface * @return array */ public function run(string $value): array; - } diff --git a/app/Import/MapperPreProcess/TagsComma.php b/app/Import/MapperPreProcess/TagsComma.php index 02032cadcd..a7534f0aeb 100644 --- a/app/Import/MapperPreProcess/TagsComma.php +++ b/app/Import/MapperPreProcess/TagsComma.php @@ -18,19 +18,15 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\MapperPreProcess; /** - * Class TagsComma - * - * @package FireflyIII\Import\MapperPreProcess + * Class TagsComma. */ class TagsComma implements PreProcessorInterface { - /** * @param string $value * diff --git a/app/Import/MapperPreProcess/TagsSpace.php b/app/Import/MapperPreProcess/TagsSpace.php index 2db886e10b..02f9bcebe9 100644 --- a/app/Import/MapperPreProcess/TagsSpace.php +++ b/app/Import/MapperPreProcess/TagsSpace.php @@ -18,15 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\MapperPreProcess; /** - * Class TagsSpace - * - * @package FireflyIII\Import\MapperPreProcess + * Class TagsSpace. */ class TagsSpace implements PreProcessorInterface { diff --git a/app/Import/Object/ImportAccount.php b/app/Import/Object/ImportAccount.php index d48d4a3ea1..31786c2be5 100644 --- a/app/Import/Object/ImportAccount.php +++ b/app/Import/Object/ImportAccount.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Object; - use FireflyIII\Models\Account; use FireflyIII\Models\AccountType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; @@ -32,19 +30,15 @@ use Illuminate\Support\Collection; use Log; /** - * - * Class ImportAccount - * - * @package FireflyIII\Import\Object + * Class ImportAccount. */ class ImportAccount { - - /** @var Account */ + /** @var Account */ private $account; /** @var array */ private $accountIban = []; - /** @var array */ + /** @var array */ private $accountId = []; /** @var array */ private $accountName = []; @@ -62,9 +56,9 @@ class ImportAccount * @var int */ private $forbiddenAccountId = 0; - /** @var AccountRepositoryInterface */ + /** @var AccountRepositoryInterface */ private $repository; - /** @var User */ + /** @var User */ private $user; /** @@ -83,7 +77,7 @@ class ImportAccount */ public function getAccount(): Account { - if (is_null($this->account->id)) { + if (null === $this->account->id) { $this->store(); } @@ -175,13 +169,14 @@ class ImportAccount $accountType = AccountType::whereType($this->expectedType)->first(); // 1: find by ID, iban or name (and type) - if (count($this->accountId) === 3) { + if (3 === count($this->accountId)) { Log::debug(sprintf('Finding account of type %d and ID %d', $accountType->id, $this->accountId['value'])); /** @var Account $account */ $account = $this->user->accounts()->where('id', '!=', $this->forbiddenAccountId)->where('account_type_id', $accountType->id)->where( - 'id', $this->accountId['value'] + 'id', + $this->accountId['value'] )->first(); - if (!is_null($account)) { + if (null !== $account) { Log::debug(sprintf('Found unmapped %s account by ID (#%d): %s', $this->expectedType, $account->id, $account->name)); return $account; @@ -191,7 +186,7 @@ class ImportAccount /** @var Collection $accounts */ $accounts = $this->repository->getAccountsByType([$accountType->type]); // Two: find by IBAN (and type): - if (count($this->accountIban) === 3) { + if (3 === count($this->accountIban)) { $iban = $this->accountIban['value']; Log::debug(sprintf('Finding account of type %d and IBAN %s', $accountType->id, $iban)); $filtered = $accounts->filter( @@ -207,14 +202,14 @@ class ImportAccount return null; } ); - if ($filtered->count() === 1) { + if (1 === $filtered->count()) { return $filtered->first(); } Log::debug('Found nothing.'); } // Three: find by name (and type): - if (count($this->accountName) === 3) { + if (3 === count($this->accountName)) { $name = $this->accountName['value']; Log::debug(sprintf('Finding account of type %d and name %s', $accountType->id, $name)); $filtered = $accounts->filter( @@ -229,7 +224,7 @@ class ImportAccount } ); - if ($filtered->count() === 1) { + if (1 === $filtered->count()) { return $filtered->first(); } Log::debug('Found nothing.'); @@ -239,7 +234,6 @@ class ImportAccount Log::debug('Found NO existing accounts.'); return new Account; - } /** @@ -254,12 +248,11 @@ class ImportAccount Log::debug(sprintf('Find mapped account based on field "%s" with value', $field), $array); // check if a pre-mapped object exists. $mapped = $this->getMappedObject($array); - if (!is_null($mapped->id)) { + if (null !== $mapped->id) { Log::debug(sprintf('Found account #%d!', $mapped->id)); return $mapped; } - } Log::debug('Found no account on mapped data or no map present.'); @@ -274,13 +267,13 @@ class ImportAccount private function getMappedObject(array $array): Account { Log::debug('In getMappedObject() for Account'); - if (count($array) === 0) { + if (0 === count($array)) { Log::debug('Array is empty, nothing will come of this.'); return new Account; } - if (array_key_exists('mapped', $array) && is_null($array['mapped'])) { + if (array_key_exists('mapped', $array) && null === $array['mapped']) { Log::debug(sprintf('No map present for value "%s". Return NULL.', $array['value'])); return new Account; @@ -291,7 +284,7 @@ class ImportAccount $search = intval($array['mapped']); $account = $this->repository->find($search); - if (is_null($account->id)) { + if (null === $account->id) { Log::error(sprintf('There is no account with id #%d. Invalid mapping will be ignored!', $search)); return new Account; @@ -299,10 +292,12 @@ class ImportAccount // must be of the same type // except when mapped is an asset, then it's fair game. // which only shows that user must map very carefully. - if ($account->accountType->type !== $this->expectedType && $account->accountType->type !== AccountType::ASSET) { + if ($account->accountType->type !== $this->expectedType && AccountType::ASSET !== $account->accountType->type) { Log::error( sprintf( - 'Mapped account #%d is of type "%s" but we expect a "%s"-account. Mapping will be ignored.', $account->id, $account->accountType->type, + 'Mapped account #%d is of type "%s" but we expect a "%s"-account. Mapping will be ignored.', + $account->id, + $account->accountType->type, $this->expectedType ) ); @@ -322,14 +317,14 @@ class ImportAccount { // 1: find mapped object: $mapped = $this->findMappedObject(); - if (!is_null($mapped->id)) { + if (null !== $mapped->id) { $this->account = $mapped; return true; } // 2: find existing by given values: $found = $this->findExistingObject(); - if (!is_null($found->id)) { + if (null !== $found->id) { $this->account = $found; return true; @@ -340,7 +335,7 @@ class ImportAccount $oldExpectedType = $this->expectedType; $this->expectedType = AccountType::ASSET; $found = $this->findExistingObject(); - if (!is_null($found->id)) { + if (null !== $found->id) { Log::debug('Found asset account!'); $this->account = $found; @@ -349,7 +344,7 @@ class ImportAccount $this->expectedType = $oldExpectedType; // 4: if search for an asset account, fall back to given "default account" (mandatory) - if ($this->expectedType === AccountType::ASSET) { + if (AccountType::ASSET === $this->expectedType) { $this->account = $this->repository->find($this->defaultAccountId); Log::debug(sprintf('Fall back to default account #%d "%s"', $this->account->id, $this->account->name)); @@ -372,6 +367,4 @@ class ImportAccount return true; } - - } diff --git a/app/Import/Object/ImportBill.php b/app/Import/Object/ImportBill.php index 769b8241d1..94cacfd7cf 100644 --- a/app/Import/Object/ImportBill.php +++ b/app/Import/Object/ImportBill.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Object; - use FireflyIII\Models\Bill; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\User; @@ -32,13 +30,10 @@ use Log; use Steam; /** - * Class ImportBill - * - * @package FireflyIII\Import\Object + * Class ImportBill. */ class ImportBill { - /** @var string */ private $amount = '1'; /** @var Bill */ @@ -49,7 +44,7 @@ class ImportBill private $name = []; /** @var BillRepositoryInterface */ private $repository; - /** @var User */ + /** @var User */ private $user; /** @@ -67,7 +62,7 @@ class ImportBill */ public function getBill(): Bill { - if (is_null($this->bill->id)) { + if (null === $this->bill->id) { $this->store(); } @@ -115,11 +110,11 @@ class ImportBill Log::debug('In findExistingObject() for Bill'); // 1: find by ID, or name - if (count($this->id) === 3) { + if (3 === count($this->id)) { Log::debug(sprintf('Finding bill with ID #%d', $this->id['value'])); /** @var Bill $bill */ $bill = $this->repository->find(intval($this->id['value'])); - if (!is_null($bill->id)) { + if (null !== $bill->id) { Log::debug(sprintf('Found unmapped bill by ID (#%d): %s', $bill->id, $bill->name)); return $bill; @@ -127,7 +122,7 @@ class ImportBill Log::debug('Found nothing.'); } // 2: find by name - if (count($this->name) === 3) { + if (3 === count($this->name)) { /** @var Collection $bills */ $bills = $this->repository->getBills(); $name = $this->name['value']; @@ -144,7 +139,7 @@ class ImportBill } ); - if ($filtered->count() === 1) { + if (1 === $filtered->count()) { return $filtered->first(); } Log::debug('Found nothing.'); @@ -154,7 +149,6 @@ class ImportBill Log::debug('Found NO existing bills.'); return new Bill; - } /** @@ -169,12 +163,11 @@ class ImportBill Log::debug(sprintf('Find mapped bill based on field "%s" with value', $field), $array); // check if a pre-mapped object exists. $mapped = $this->getMappedObject($array); - if (!is_null($mapped->id)) { + if (null !== $mapped->id) { Log::debug(sprintf('Found bill #%d!', $mapped->id)); return $mapped; } - } Log::debug('Found no bill on mapped data or no map present.'); @@ -189,13 +182,13 @@ class ImportBill private function getMappedObject(array $array): Bill { Log::debug('In getMappedObject() for Bill'); - if (count($array) === 0) { + if (0 === count($array)) { Log::debug('Array is empty, nothing will come of this.'); return new Bill; } - if (array_key_exists('mapped', $array) && is_null($array['mapped'])) { + if (array_key_exists('mapped', $array) && null === $array['mapped']) { Log::debug(sprintf('No map present for value "%s". Return NULL.', $array['value'])); return new Bill; @@ -206,13 +199,12 @@ class ImportBill $search = intval($array['mapped']); $bill = $this->repository->find($search); - if (is_null($bill->id)) { + if (null === $bill->id) { Log::error(sprintf('There is no bill with id #%d. Invalid mapping will be ignored!', $search)); return new Bill; } - Log::debug(sprintf('Found bill! #%d ("%s"). Return it', $bill->id, $bill->name)); return $bill; @@ -225,21 +217,21 @@ class ImportBill { // 1: find mapped object: $mapped = $this->findMappedObject(); - if (!is_null($mapped->id)) { + if (null !== $mapped->id) { $this->bill = $mapped; return true; } // 2: find existing by given values: $found = $this->findExistingObject(); - if (!is_null($found->id)) { + if (null !== $found->id) { $this->bill = $found; return true; } $name = $this->name['value'] ?? ''; - if (strlen($name) === 0) { + if (0 === strlen($name)) { return true; } @@ -258,11 +250,9 @@ class ImportBill Log::debug('Found no bill so must create one ourselves. Assume default values.', $data); - $this->bill = $this->repository->store($data); Log::debug(sprintf('Successfully stored new bill #%d: %s', $this->bill->id, $this->bill->name)); return true; } - } diff --git a/app/Import/Object/ImportBudget.php b/app/Import/Object/ImportBudget.php index cef49e677d..e8d2a5acf9 100644 --- a/app/Import/Object/ImportBudget.php +++ b/app/Import/Object/ImportBudget.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Object; - use FireflyIII\Models\Budget; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\User; @@ -31,13 +29,10 @@ use Illuminate\Support\Collection; use Log; /** - * Class ImportBudget - * - * @package FireflyIII\Import\Object + * Class ImportBudget. */ class ImportBudget { - /** @var Budget */ private $budget; /** @var array */ @@ -46,7 +41,7 @@ class ImportBudget private $name = []; /** @var BudgetRepositoryInterface */ private $repository; - /** @var User */ + /** @var User */ private $user; /** @@ -64,7 +59,7 @@ class ImportBudget */ public function getBudget(): Budget { - if (is_null($this->budget->id)) { + if (null === $this->budget->id) { $this->store(); } @@ -104,11 +99,11 @@ class ImportBudget Log::debug('In findExistingObject() for Budget'); // 1: find by ID, or name - if (count($this->id) === 3) { + if (3 === count($this->id)) { Log::debug(sprintf('Finding budget with ID #%d', $this->id['value'])); /** @var Budget $budget */ $budget = $this->repository->find(intval($this->id['value'])); - if (!is_null($budget->id)) { + if (null !== $budget->id) { Log::debug(sprintf('Found unmapped budget by ID (#%d): %s', $budget->id, $budget->name)); return $budget; @@ -116,7 +111,7 @@ class ImportBudget Log::debug('Found nothing.'); } // 2: find by name - if (count($this->name) === 3) { + if (3 === count($this->name)) { /** @var Collection $budgets */ $budgets = $this->repository->getBudgets(); $name = $this->name['value']; @@ -133,7 +128,7 @@ class ImportBudget } ); - if ($filtered->count() === 1) { + if (1 === $filtered->count()) { return $filtered->first(); } Log::debug('Found nothing.'); @@ -143,7 +138,6 @@ class ImportBudget Log::debug('Found NO existing budgets.'); return new Budget; - } /** @@ -158,12 +152,11 @@ class ImportBudget Log::debug(sprintf('Find mapped budget based on field "%s" with value', $field), $array); // check if a pre-mapped object exists. $mapped = $this->getMappedObject($array); - if (!is_null($mapped->id)) { + if (null !== $mapped->id) { Log::debug(sprintf('Found budget #%d!', $mapped->id)); return $mapped; } - } Log::debug('Found no budget on mapped data or no map present.'); @@ -178,13 +171,13 @@ class ImportBudget private function getMappedObject(array $array): Budget { Log::debug('In getMappedObject() for Budget'); - if (count($array) === 0) { + if (0 === count($array)) { Log::debug('Array is empty, nothing will come of this.'); return new Budget; } - if (array_key_exists('mapped', $array) && is_null($array['mapped'])) { + if (array_key_exists('mapped', $array) && null === $array['mapped']) { Log::debug(sprintf('No map present for value "%s". Return NULL.', $array['value'])); return new Budget; @@ -195,7 +188,7 @@ class ImportBudget $search = intval($array['mapped']); $budget = $this->repository->find($search); - if (is_null($budget->id)) { + if (null === $budget->id) { Log::error(sprintf('There is no budget with id #%d. Invalid mapping will be ignored!', $search)); return new Budget; @@ -213,21 +206,21 @@ class ImportBudget { // 1: find mapped object: $mapped = $this->findMappedObject(); - if (!is_null($mapped->id)) { + if (null !== $mapped->id) { $this->budget = $mapped; return true; } // 2: find existing by given values: $found = $this->findExistingObject(); - if (!is_null($found->id)) { + if (null !== $found->id) { $this->budget = $found; return true; } $name = $this->name['value'] ?? ''; - if (strlen($name) === 0) { + if (0 === strlen($name)) { return true; } @@ -242,6 +235,4 @@ class ImportBudget return true; } - - } diff --git a/app/Import/Object/ImportCategory.php b/app/Import/Object/ImportCategory.php index bd986623bf..fca23422ab 100644 --- a/app/Import/Object/ImportCategory.php +++ b/app/Import/Object/ImportCategory.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Object; - use FireflyIII\Models\Category; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\User; @@ -40,7 +38,7 @@ class ImportCategory private $name = []; /** @var CategoryRepositoryInterface */ private $repository; - /** @var User */ + /** @var User */ private $user; /** @@ -58,7 +56,7 @@ class ImportCategory */ public function getCategory(): Category { - if (is_null($this->category->id)) { + if (null === $this->category->id) { $this->store(); } @@ -98,11 +96,11 @@ class ImportCategory Log::debug('In findExistingObject() for Category'); // 1: find by ID, or name - if (count($this->id) === 3) { + if (3 === count($this->id)) { Log::debug(sprintf('Finding category with ID #%d', $this->id['value'])); /** @var Category $category */ $category = $this->repository->find(intval($this->id['value'])); - if (!is_null($category->id)) { + if (null !== $category->id) { Log::debug(sprintf('Found unmapped category by ID (#%d): %s', $category->id, $category->name)); return $category; @@ -110,7 +108,7 @@ class ImportCategory Log::debug('Found nothing.'); } // 2: find by name - if (count($this->name) === 3) { + if (3 === count($this->name)) { /** @var Collection $categories */ $categories = $this->repository->getCategories(); $name = $this->name['value']; @@ -127,7 +125,7 @@ class ImportCategory } ); - if ($filtered->count() === 1) { + if (1 === $filtered->count()) { return $filtered->first(); } Log::debug('Found nothing.'); @@ -137,7 +135,6 @@ class ImportCategory Log::debug('Found NO existing categories.'); return new Category; - } /** @@ -152,12 +149,11 @@ class ImportCategory Log::debug(sprintf('Find mapped category based on field "%s" with value', $field), $array); // check if a pre-mapped object exists. $mapped = $this->getMappedObject($array); - if (!is_null($mapped->id)) { + if (null !== $mapped->id) { Log::debug(sprintf('Found category #%d!', $mapped->id)); return $mapped; } - } Log::debug('Found no category on mapped data or no map present.'); @@ -172,13 +168,13 @@ class ImportCategory private function getMappedObject(array $array): Category { Log::debug('In getMappedObject() for Category'); - if (count($array) === 0) { + if (0 === count($array)) { Log::debug('Array is empty, nothing will come of this.'); return new Category; } - if (array_key_exists('mapped', $array) && is_null($array['mapped'])) { + if (array_key_exists('mapped', $array) && null === $array['mapped']) { Log::debug(sprintf('No map present for value "%s". Return NULL.', $array['value'])); return new Category; @@ -189,7 +185,7 @@ class ImportCategory $search = intval($array['mapped']); $category = $this->repository->find($search); - if (is_null($category->id)) { + if (null === $category->id) { Log::error(sprintf('There is no category with id #%d. Invalid mapping will be ignored!', $search)); return new Category; @@ -207,21 +203,21 @@ class ImportCategory { // 1: find mapped object: $mapped = $this->findMappedObject(); - if (!is_null($mapped->id)) { + if (null !== $mapped->id) { $this->category = $mapped; return true; } // 2: find existing by given values: $found = $this->findExistingObject(); - if (!is_null($found->id)) { + if (null !== $found->id) { $this->category = $found; return true; } $name = $this->name['value'] ?? ''; - if (strlen($name) === 0) { + if (0 === strlen($name)) { return true; } @@ -236,6 +232,4 @@ class ImportCategory return true; } - - } diff --git a/app/Import/Object/ImportCurrency.php b/app/Import/Object/ImportCurrency.php index a8daca201a..d995d7a2bb 100644 --- a/app/Import/Object/ImportCurrency.php +++ b/app/Import/Object/ImportCurrency.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Object; - use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\User; @@ -33,17 +31,17 @@ class ImportCurrency { /** @var array */ private $code = []; - /** @var TransactionCurrency */ + /** @var TransactionCurrency */ private $currency; /** @var array */ private $id = []; /** @var array */ private $name = []; - /** @var CurrencyRepositoryInterface */ + /** @var CurrencyRepositoryInterface */ private $repository; /** @var array */ private $symbol = []; - /** @var User */ + /** @var User */ private $user; /** @@ -60,15 +58,14 @@ class ImportCurrency */ public function getTransactionCurrency(): TransactionCurrency { - if (!is_null($this->currency->id)) { + if (null !== $this->currency->id) { return $this->currency; } Log::debug('In createCurrency()'); // check if any of them is mapped: $mapped = $this->findMappedObject(); - if (!is_null($mapped->id)) { - + if (null !== $mapped->id) { Log::debug('Mapped existing currency.', ['new' => $mapped->toArray()]); $this->currency = $mapped; @@ -76,7 +73,7 @@ class ImportCurrency } $searched = $this->findExistingObject(); - if (!is_null($searched->id)) { + if (null !== $searched->id) { Log::debug('Found existing currency.', ['found' => $searched->toArray()]); $this->currency = $searched; @@ -88,7 +85,7 @@ class ImportCurrency 'name' => $this->name['value'] ?? null, 'decimal_places' => 2, ]; - if (is_null($data['code'])) { + if (null === $data['code']) { Log::debug('Need at least a code to create currency, return nothing.'); return new TransactionCurrency(); @@ -99,9 +96,7 @@ class ImportCurrency $this->currency = $currency; Log::info('Made new currency.', ['input' => $data, 'new' => $currency->toArray()]); - return $currency; - } /** @@ -159,11 +154,11 @@ class ImportCurrency ]; foreach ($search as $field => $function) { $value = $this->$field['value'] ?? null; - if (!is_null($value)) { + if (null !== $value) { Log::debug(sprintf('Searching for %s using function %s and value %s', $field, $function, $value)); $currency = $this->repository->$function($value); - if (!is_null($currency->id)) { + if (null !== $currency->id) { return $currency; } } @@ -184,12 +179,11 @@ class ImportCurrency Log::debug(sprintf('Find mapped currency based on field "%s" with value', $field), $array); // check if a pre-mapped object exists. $mapped = $this->getMappedObject($array); - if (!is_null($mapped->id)) { + if (null !== $mapped->id) { Log::debug(sprintf('Found currency #%d!', $mapped->id)); return $mapped; } - } Log::debug('Found no currency on mapped data or no map present.'); @@ -204,13 +198,13 @@ class ImportCurrency private function getMappedObject(array $array): TransactionCurrency { Log::debug('In getMappedObject()'); - if (count($array) === 0) { + if (0 === count($array)) { Log::debug('Array is empty, nothing will come of this.'); return new TransactionCurrency; } - if (array_key_exists('mapped', $array) && is_null($array['mapped'])) { + if (array_key_exists('mapped', $array) && null === $array['mapped']) { Log::debug(sprintf('No map present for value "%s". Return NULL.', $array['value'])); return new TransactionCurrency; @@ -221,8 +215,7 @@ class ImportCurrency $search = intval($array['mapped']); $currency = $this->repository->find($search); - - if (is_null($currency->id)) { + if (null === $currency->id) { Log::error(sprintf('There is no currency with id #%d. Invalid mapping will be ignored!', $search)); return new TransactionCurrency; @@ -232,6 +225,4 @@ class ImportCurrency return $currency; } - - } diff --git a/app/Import/Object/ImportJournal.php b/app/Import/Object/ImportJournal.php index 028086cd34..54f194c481 100644 --- a/app/Import/Object/ImportJournal.php +++ b/app/Import/Object/ImportJournal.php @@ -18,15 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Object; - use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; -use FireflyIII\Import\Converter\Amount; use FireflyIII\Import\Converter\ConverterInterface; use FireflyIII\Import\MapperPreProcess\PreProcessorInterface; use FireflyIII\User; @@ -35,25 +32,23 @@ use Log; use Steam; /** - * Class ImportJournal - * - * @package FireflyIII\Import\Object + * Class ImportJournal. */ class ImportJournal { /** @var ImportAccount */ public $asset; - /** @var ImportBill */ + /** @var ImportBill */ public $bill; /** @var ImportBudget */ public $budget; /** @var ImportCategory */ public $category; - /** @var ImportCurrency */ + /** @var ImportCurrency */ public $currency; - /** @var string */ + /** @var string */ public $description = ''; - /** @var string */ + /** @var string */ public $hash; /** @var array */ public $metaDates = []; @@ -63,9 +58,13 @@ class ImportJournal public $opposing; /** @var array */ public $tags = []; - /** @var string */ + /** @var array */ private $amount; - /** @var string */ + /** @var array */ + private $amountCredit; + /** @var array */ + private $amountDebet; + /** @var string */ private $convertedAmount = null; /** @var string */ private $date = ''; @@ -73,7 +72,7 @@ class ImportJournal private $externalId = ''; /** @var array */ private $modifiers = []; - /** @var User */ + /** @var User */ private $user; /** @@ -99,33 +98,21 @@ class ImportJournal /** * @return string + * * @throws FireflyException */ public function getAmount(): string { Log::debug('Now in getAmount()'); - if (is_null($this->convertedAmount)) { - Log::debug('convertedAmount is NULL'); - /** @var ConverterInterface $amountConverter */ - $amountConverter = app(Amount::class); - $this->convertedAmount = $amountConverter->convert($this->amount); - Log::debug(sprintf('First attempt to convert gives "%s"', $this->convertedAmount)); - // modify - foreach ($this->modifiers as $modifier) { - $class = sprintf('FireflyIII\Import\Converter\%s', config(sprintf('csv.import_roles.%s.converter', $modifier['role']))); - /** @var ConverterInterface $converter */ - $converter = app($class); - Log::debug(sprintf('Now launching converter %s', $class)); - if ($converter->convert($modifier['value']) === -1) { - $this->convertedAmount = Steam::negative($this->convertedAmount); - } - Log::debug(sprintf('convertedAmount after conversion is %s', $this->convertedAmount)); - } + Log::debug(sprintf('amount is %s', var_export($this->amount, true))); + Log::debug(sprintf('debet amount is %s', var_export($this->amountDebet, true))); + Log::debug(sprintf('credit amount is %s', var_export($this->amountCredit, true))); - Log::debug(sprintf('After modifiers the result is: "%s"', $this->convertedAmount)); + if (null === $this->convertedAmount) { + $this->calculateAmount(); } Log::debug(sprintf('convertedAmount is: "%s"', $this->convertedAmount)); - if (bccomp($this->convertedAmount, '0') === 0) { + if (0 === bccomp($this->convertedAmount, '0')) { throw new FireflyException('Amount is zero.'); } @@ -155,7 +142,7 @@ class ImportJournal */ public function getDescription(): string { - if ($this->description === '') { + if ('' === $this->description) { return '(no description)'; } @@ -199,7 +186,13 @@ class ImportJournal $this->asset->setAccountId($array); break; case 'amount': - $this->amount = $array['value']; + $this->amount = $array; + break; + case 'amount_debet': + $this->amountDebet = $array; + break; + case 'amount_credit': + $this->amountCredit = $array; break; case 'account-iban': $this->asset->setAccountIban($array); @@ -289,6 +282,71 @@ class ImportJournal } } + /** + * If convertedAmount is NULL, this method will try to calculate the correct amount. + * It starts with amount, but can be overruled by debet and credit amounts. + * + * @throws FireflyException + */ + private function calculateAmount() + { + // first check if the amount is set: + Log::debug('convertedAmount is NULL'); + + $info = $this->selectAmountInput(); + + if (0 === count($info)) { + throw new FireflyException('No amount information for this row.'); + } + + Log::debug(sprintf('Converter class is %s', $info['class'])); + /** @var ConverterInterface $amountConverter */ + $amountConverter = app($info['class']); + $this->convertedAmount = $amountConverter->convert($info['value']); + Log::debug(sprintf('First attempt to convert gives "%s"', $this->convertedAmount)); + // modify + foreach ($this->modifiers as $modifier) { + $class = sprintf('FireflyIII\Import\Converter\%s', config(sprintf('csv.import_roles.%s.converter', $modifier['role']))); + /** @var ConverterInterface $converter */ + $converter = app($class); + Log::debug(sprintf('Now launching converter %s', $class)); + if ($converter->convert($modifier['value']) === -1) { + $this->convertedAmount = Steam::negative($this->convertedAmount); + } + Log::debug(sprintf('convertedAmount after conversion is %s', $this->convertedAmount)); + } + + Log::debug(sprintf('After modifiers the result is: "%s"', $this->convertedAmount)); + } + + /** + * This methods decides which input to use for the amount calculation. + * + * @return array + */ + private function selectAmountInput() + { + $converterClass = ''; + if (!is_null($this->amount)) { + Log::debug('Amount value is not NULL, assume this is the correct value.'); + $converterClass = sprintf('FireflyIII\Import\Converter\%s', config(sprintf('csv.import_roles.%s.converter', $this->amount['role']))); + $info = $this->amount; + } + if (!is_null($this->amountDebet)) { + Log::debug('Amount DEBET value is not NULL, assume this is the correct value (overrules Amount).'); + $converterClass = sprintf('FireflyIII\Import\Converter\%s', config(sprintf('csv.import_roles.%s.converter', $this->amountDebet['role']))); + $info = $this->amountDebet; + } + if (!is_null($this->amountCredit)) { + Log::debug('Amount CREDIT value is not NULL, assume this is the correct value (overrules Amount and AmountDebet).'); + $converterClass = sprintf('FireflyIII\Import\Converter\%s', config(sprintf('csv.import_roles.%s.converter', $this->amountCredit['role']))); + $info = $this->amountCredit; + } + $info['class'] = $converterClass; + + return $info; + } + /** * @param array $array */ diff --git a/app/Import/Routine/ImportRoutine.php b/app/Import/Routine/ImportRoutine.php index b55ba10856..74dc52150c 100644 --- a/app/Import/Routine/ImportRoutine.php +++ b/app/Import/Routine/ImportRoutine.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Routine; - use Carbon\Carbon; use DB; use FireflyIII\Import\FileProcessor\FileProcessorInterface; @@ -36,19 +34,17 @@ use Log; class ImportRoutine { - - /** @var Collection */ + /** @var Collection */ public $errors; - /** @var Collection */ + /** @var Collection */ public $journals; /** @var int */ public $lines = 0; - /** @var ImportJob */ + /** @var ImportJob */ private $job; /** * ImportRoutine constructor. - * */ public function __construct() { @@ -61,7 +57,7 @@ class ImportRoutine */ public function run(): bool { - if ($this->job->status !== 'configured') { + if ('configured' !== $this->job->status) { Log::error(sprintf('Job %s is in state "%s" so it cannot be started.', $this->job->key, $this->job->status)); return false; @@ -94,7 +90,6 @@ class ImportRoutine Log::info(sprintf('Done with import job %s', $this->job->key)); - return true; } @@ -118,8 +113,7 @@ class ImportRoutine $processor = app($class); $processor->setJob($this->job); - if ($this->job->status === 'configured') { - + if ('configured' === $this->job->status) { // set job as "running"... $this->job->status = 'running'; $this->job->save(); @@ -138,6 +132,13 @@ class ImportRoutine private function createImportTag(): Tag { Log::debug('Now in createImportTag()'); + + if ($this->journals->count() < 1) { + Log::info(sprintf('Will not create tag, %d journals imported.', $this->journals->count())); + + return new Tag; + } + /** @var TagRepositoryInterface $repository */ $repository = app(TagRepositoryInterface::class); $repository->setUser($this->job->user); diff --git a/app/Import/Specifics/AbnAmroDescription.php b/app/Import/Specifics/AbnAmroDescription.php index 59d30ffc00..cd884c7c29 100644 --- a/app/Import/Specifics/AbnAmroDescription.php +++ b/app/Import/Specifics/AbnAmroDescription.php @@ -18,24 +18,21 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Specifics; /** - * Class AbnAmroDescription + * Class AbnAmroDescription. * * Parses the description from txt files for ABN AMRO bank accounts. * * Based on the logic as described in the following Gist: * https://gist.github.com/vDorst/68d555a6a90f62fec004 - * - * @package FireflyIII\Import\Specifics */ class AbnAmroDescription implements SpecificInterface { - /** @var array */ + /** @var array */ public $row; /** @@ -70,7 +67,6 @@ class AbnAmroDescription implements SpecificInterface // Try to parse the description in known formats. $parsed = $this->parseSepaDescription() || $this->parseTRTPDescription() || $this->parseGEABEADescription() || $this->parseABNAMRODescription(); - // If the description could not be parsed, specify an unknown opposing // account, as an opposing account is required if (!$parsed) { @@ -81,7 +77,7 @@ class AbnAmroDescription implements SpecificInterface } /** - * Parses the current description with costs from ABN AMRO itself + * Parses the current description with costs from ABN AMRO itself. * * @return bool true if the description is GEA/BEA-format, false otherwise */ @@ -89,7 +85,6 @@ class AbnAmroDescription implements SpecificInterface { // See if the current description is formatted in ABN AMRO format if (preg_match('/ABN AMRO.{24} (.*)/', $this->row[7], $matches)) { - $this->row[8] = 'ABN AMRO'; // this one is new (opposing account name) $this->row[7] = $matches[1]; // this is the description @@ -100,7 +95,7 @@ class AbnAmroDescription implements SpecificInterface } /** - * Parses the current description in GEA/BEA format + * Parses the current description in GEA/BEA format. * * @return bool true if the description is GEA/BEAformat, false otherwise */ @@ -108,12 +103,11 @@ class AbnAmroDescription implements SpecificInterface { // See if the current description is formatted in GEA/BEA format if (preg_match('/([BG]EA) +(NR:[a-zA-Z:0-9]+) +([0-9.\/]+) +([^,]*)/', $this->row[7], $matches)) { - // description and opposing account will be the same. $this->row[8] = $matches[4]; // 'opposing-account-name' $this->row[7] = $matches[4]; // 'description' - if ($matches[1] === 'GEA') { + if ('GEA' === $matches[1]) { $this->row[7] = 'GEA ' . $matches[4]; // 'description' } @@ -124,15 +118,16 @@ class AbnAmroDescription implements SpecificInterface } /** - * Parses the current description in SEPA format + * Parses the current description in SEPA format. + * * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * * @return bool true if the description is SEPA format, false otherwise */ protected function parseSepaDescription() { // See if the current description is formatted as a SEPA plain description if (preg_match('/^SEPA(.{28})/', $this->row[7], $matches)) { - $type = $matches[1]; $reference = ''; $name = ''; @@ -168,7 +163,7 @@ class AbnAmroDescription implements SpecificInterface // Set a new description for the current transaction. If none was given // set the description to type, name and reference $this->row[7] = $newDescription; - if (strlen($newDescription) === 0) { + if (0 === strlen($newDescription)) { $this->row[7] = sprintf('%s - %s (%s)', $type, $name, $reference); } @@ -179,7 +174,7 @@ class AbnAmroDescription implements SpecificInterface } /** - * Parses the current description in TRTP format + * Parses the current description in TRTP format. * * @return bool true if the description is TRTP format, false otherwise */ @@ -187,7 +182,6 @@ class AbnAmroDescription implements SpecificInterface { // See if the current description is formatted in TRTP format if (preg_match_all('!\/([A-Z]{3,4})\/([^/]*)!', $this->row[7], $matches, PREG_SET_ORDER)) { - $type = ''; $name = ''; $reference = ''; @@ -224,7 +218,7 @@ class AbnAmroDescription implements SpecificInterface // Set a new description for the current transaction. If none was given // set the description to type, name and reference $this->row[7] = $newDescription; - if (strlen($newDescription) === 0) { + if (0 === strlen($newDescription)) { $this->row[7] = sprintf('%s - %s (%s)', $type, $name, $reference); } } @@ -234,6 +228,4 @@ class AbnAmroDescription implements SpecificInterface return false; } - - } diff --git a/app/Import/Specifics/IngDescription.php b/app/Import/Specifics/IngDescription.php index cb14ee71e2..010b93801d 100644 --- a/app/Import/Specifics/IngDescription.php +++ b/app/Import/Specifics/IngDescription.php @@ -1,7 +1,7 @@ . */ - declare(strict_types=1); namespace FireflyIII\Import\Specifics; /** - * Class IngDescription + * Class IngDescription. * * Parses the description from CSV files for Ing bank accounts. * @@ -32,12 +31,10 @@ namespace FireflyIII\Import\Specifics; * 'Incasso' the Name of Opposing account the Opposing IBAN number are in the * Description. This class will remove them, and add Name in description by * 'Betaalautomaat' so those are easily recognizable - * - * @package FireflyIII\Import\Specifics */ class IngDescription implements SpecificInterface { - /** @var array */ + /** @var array */ public $row; /** @@ -84,7 +81,7 @@ class IngDescription implements SpecificInterface /** * Add the Opposing name from cell 1 in the description for Betaalautomaten - * Otherwise the description is only: 'Pasvolgnr: Transactie: Term:' + * Otherwise the description is only: 'Pasvolgnr: Transactie: Term:'. * * @return bool true */ @@ -97,7 +94,7 @@ class IngDescription implements SpecificInterface /** * Remove IBAN number out of the description - * Default description of Description is: Naam: Omschrijving: IBAN: + * Default description of Description is: Naam: Omschrijving: IBAN: . * * @return bool true */ @@ -110,7 +107,7 @@ class IngDescription implements SpecificInterface } /** - * Remove name from the description (Remove everything before the description incl the word 'Omschrijving' ) + * Remove name from the description (Remove everything before the description incl the word 'Omschrijving' ). * * @return bool true */ @@ -121,5 +118,4 @@ class IngDescription implements SpecificInterface return true; } - } diff --git a/app/Import/Specifics/PresidentsChoice.php b/app/Import/Specifics/PresidentsChoice.php index 11203ba03c..1c0d5ca1ba 100644 --- a/app/Import/Specifics/PresidentsChoice.php +++ b/app/Import/Specifics/PresidentsChoice.php @@ -18,19 +18,15 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Specifics; /** - * Class PresidentsChoice - * - * @package FireflyIII\Import\Specifics + * Class PresidentsChoice. */ class PresidentsChoice implements SpecificInterface { - /** * @return string */ @@ -56,7 +52,7 @@ class PresidentsChoice implements SpecificInterface { // first, if column 2 is empty and 3 is not, do nothing. // if column 3 is empty and column 2 is not, move amount to column 3, *-1 - if (isset($row[3]) && strlen($row[3]) === 0) { + if (isset($row[3]) && 0 === strlen($row[3])) { $row[3] = bcmul($row[2], '-1'); } if (isset($row[1])) { @@ -65,7 +61,5 @@ class PresidentsChoice implements SpecificInterface } return $row; - - } } diff --git a/app/Import/Specifics/RabobankDescription.php b/app/Import/Specifics/RabobankDescription.php index 420b5d8e26..94a9e1f559 100644 --- a/app/Import/Specifics/RabobankDescription.php +++ b/app/Import/Specifics/RabobankDescription.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Specifics; @@ -26,9 +25,7 @@ namespace FireflyIII\Import\Specifics; use Log; /** - * Class RabobankDescription - * - * @package FireflyIII\Import\Specifics + * Class RabobankDescription. */ class RabobankDescription implements SpecificInterface { @@ -64,7 +61,8 @@ class RabobankDescription implements SpecificInterface Log::debug( sprintf( 'Rabobank specific: Opposite account and opposite name are' . - ' both empty. Will use "%s" (from description) instead', $alternateName + ' both empty. Will use "%s" (from description) instead', + $alternateName ) ); $row[6] = $alternateName; diff --git a/app/Import/Specifics/SnsDescription.php b/app/Import/Specifics/SnsDescription.php index ab6c941580..3f52171846 100644 --- a/app/Import/Specifics/SnsDescription.php +++ b/app/Import/Specifics/SnsDescription.php @@ -21,24 +21,19 @@ /** * snsDescription.php - * Author 2017 hugovanduijn@gmail.com + * Author 2017 hugovanduijn@gmail.com. * * This software may be modified and distributed under the terms of the * Creative Commons Attribution-ShareAlike 4.0 International License. * * See the LICENSE file for details. */ - declare(strict_types=1); namespace FireflyIII\Import\Specifics; -use Log; - /** - * Class SnsDescription - * - * @package FireflyIII\Import\Specifics + * Class SnsDescription. */ class SnsDescription implements SpecificInterface { @@ -65,8 +60,9 @@ class SnsDescription implements SpecificInterface */ public function run(array $row): array { - $row[17] = ltrim($row[17],"'"); - $row[17] = rtrim($row[17],"'"); + $row[17] = ltrim($row[17], "'"); + $row[17] = rtrim($row[17], "'"); + return $row; } } diff --git a/app/Import/Specifics/SpecificInterface.php b/app/Import/Specifics/SpecificInterface.php index 148aed45aa..837966be3e 100644 --- a/app/Import/Specifics/SpecificInterface.php +++ b/app/Import/Specifics/SpecificInterface.php @@ -18,15 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Specifics; /** - * Interface SpecificInterface - * - * @package FireflyIII\Import\Specifics + * Interface SpecificInterface. */ interface SpecificInterface { @@ -46,5 +43,4 @@ interface SpecificInterface * @return array */ public function run(array $row): array; - } diff --git a/app/Import/Storage/ImportStorage.php b/app/Import/Storage/ImportStorage.php index 2761a6881f..47ba783826 100644 --- a/app/Import/Storage/ImportStorage.php +++ b/app/Import/Storage/ImportStorage.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Storage; @@ -35,21 +34,19 @@ use Log; /** * Is capable of storing individual ImportJournal objects. - * Class ImportStorage - * - * @package FireflyIII\Import\Storage + * Class ImportStorage. */ class ImportStorage { use ImportSupport; - /** @var Collection */ + /** @var Collection */ public $errors; /** @var Collection */ public $journals; - /** @var int */ + /** @var int */ protected $defaultCurrencyId = 1; // yes, hard coded - /** @var ImportJob */ + /** @var ImportJob */ protected $job; /** @var Collection */ protected $rules; @@ -57,7 +54,7 @@ class ImportStorage private $dateFormat = 'Ymd'; /** @var Collection */ private $objects; - /** @var array */ + /** @var array */ private $transfers = []; /** @@ -125,6 +122,7 @@ class ImportStorage * @param ImportJournal $importJournal * * @return bool + * * @throws FireflyException */ protected function storeImportJournal(int $index, ImportJournal $importJournal): bool @@ -139,7 +137,7 @@ class ImportStorage $transactionType = $this->getTransactionType($amount, $opposingAccount); $description = $importJournal->getDescription(); - /*** First step done! */ + // First step done! $this->job->addStepsDone(1); /** @@ -159,7 +157,6 @@ class ImportStorage $message = sprintf('Detected a possible duplicate, skip this one (hash: %s).', $importJournal->hash); Log::error($message, $parameters); throw new FireflyException($message); - } unset($parameters); @@ -174,12 +171,11 @@ class ImportStorage 'date' => $date, 'hash' => $importJournal->hash, 'amount' => $amount, - ]; $journal = $this->storeJournal($parameters); unset($parameters); - /*** Another step done! */ + // Another step done! $this->job->addStepsDone(1); // store meta object things: @@ -203,12 +199,12 @@ class ImportStorage $journal->completed = true; $journal->save(); - /*** Another step done! */ + // Another step done! $this->job->addStepsDone(1); // run rules: $this->applyRules($journal); - /*** Another step done! */ + // Another step done! $this->job->addStepsDone(1); $this->journals->push($journal); @@ -225,7 +221,7 @@ class ImportStorage private function isDoubleTransfer(array $parameters): bool { Log::debug('Check if is a double transfer.'); - if ($parameters['type'] !== TransactionType::TRANSFER) { + if (TransactionType::TRANSFER !== $parameters['type']) { Log::debug(sprintf('Is a %s, not a transfer so no.', $parameters['type'])); return false; @@ -240,32 +236,32 @@ class ImportStorage foreach ($this->transfers as $transfer) { $hits = 0; if ($parameters['description'] === $transfer['description']) { - $hits++; + ++$hits; Log::debug(sprintf('Description "%s" equals "%s", hits = %d', $parameters['description'], $transfer['description'], $hits)); } if ($names === $transfer['names']) { - $hits++; + ++$hits; Log::debug(sprintf('Involved accounts, "%s" equals "%s", hits = %d', join(',', $names), join(',', $transfer['names']), $hits)); } - if (bccomp($amount, $transfer['amount']) === 0) { - $hits++; + if (0 === bccomp($amount, $transfer['amount'])) { + ++$hits; Log::debug(sprintf('Amount %s equals %s, hits = %d', $amount, $transfer['amount'], $hits)); } if ($parameters['date'] === $transfer['date']) { - $hits++; + ++$hits; Log::debug(sprintf('Date %s equals %s, hits = %d', $parameters['date'], $transfer['date'], $hits)); } // number of hits is 4? Then it's a match - if ($hits === 4) { + if (4 === $hits) { Log::error( - 'There already is a transfer imported with these properties. Compare existing with new. ', ['existing' => $transfer, 'new' => $parameters] + 'There already is a transfer imported with these properties. Compare existing with new. ', + ['existing' => $transfer, 'new' => $parameters] ); return true; } } - return false; } } diff --git a/app/Import/Storage/ImportSupport.php b/app/Import/Storage/ImportSupport.php index 93019b3689..248fd2074f 100644 --- a/app/Import/Storage/ImportSupport.php +++ b/app/Import/Storage/ImportSupport.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Import\Storage; - use Carbon\Carbon; use Exception; use FireflyIII\Exceptions\FireflyException; @@ -47,17 +45,15 @@ use Illuminate\Support\Collection; use Log; /** - * Trait ImportSupport - * - * @package FireflyIII\Import\Storage + * Trait ImportSupport. */ trait ImportSupport { /** @var int */ protected $defaultCurrencyId = 1; - /** @var ImportJob */ + /** @var ImportJob */ protected $job; - /** @var Collection */ + /** @var Collection */ protected $rules; /** @@ -89,6 +85,7 @@ trait ImportSupport * @param array $parameters * * @return bool + * * @throws FireflyException */ private function createTransaction(array $parameters): bool @@ -101,7 +98,7 @@ trait ImportSupport $transaction->foreign_currency_id = $parameters['foreign_currency']; $transaction->foreign_amount = $parameters['foreign_amount']; $transaction->save(); - if (is_null($transaction->id)) { + if (null === $transaction->id) { $errorText = join(', ', $transaction->getErrors()->all()); throw new FireflyException($errorText); } @@ -130,7 +127,7 @@ trait ImportSupport // use given currency $currency = $importJournal->currency->getTransactionCurrency(); - if (!is_null($currency->id)) { + if (null !== $currency->id) { return $currency->id; } @@ -138,7 +135,6 @@ trait ImportSupport $currency = $this->defaultCurrencyId; return $currency; - } /** @@ -156,7 +152,7 @@ trait ImportSupport { // use given currency by import journal. $currency = $importJournal->currency->getTransactionCurrency(); - if (!is_null($currency->id) && $currency->id !== $currencyId) { + if (null !== $currency->id && $currency->id !== $currencyId) { return $currency->id; } @@ -197,7 +193,6 @@ trait ImportSupport $databaseAccount = $account->getAccount(); return $databaseAccount; - } /** @@ -219,7 +214,6 @@ trait ImportSupport Log::debug(sprintf('Found %d user rules.', $set->count())); return $set; - } /** @@ -230,7 +224,9 @@ trait ImportSupport * @param Account $account * * @return string + * * @throws FireflyException + * * @see ImportSupport::getOpposingAccount() */ private function getTransactionType(string $amount, Account $account): string @@ -241,18 +237,18 @@ trait ImportSupport $transactionType = TransactionType::WITHDRAWAL; } - if (bccomp($amount, '0') === 1) { + if (1 === bccomp($amount, '0')) { $transactionType = TransactionType::DEPOSIT; } // if opposing is an asset account, it's a transfer: - if ($account->accountType->type === AccountType::ASSET) { + if (AccountType::ASSET === $account->accountType->type) { Log::debug(sprintf('Opposing account #%d %s is an asset account, make transfer.', $account->id, $account->name)); $transactionType = TransactionType::TRANSFER; } // verify that opposing account is of the correct type: - if ($account->accountType->type === AccountType::EXPENSE && $transactionType !== TransactionType::WITHDRAWAL) { + if (AccountType::EXPENSE === $account->accountType->type && TransactionType::WITHDRAWAL !== $transactionType) { $message = 'This row is imported as a withdrawal but opposing is an expense account. This cannot be!'; Log::error($message); throw new FireflyException($message); @@ -272,16 +268,20 @@ trait ImportSupport { $set = TransactionJournal::leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') ->leftJoin( - 'transactions AS source', function (JoinClause $join) { - $join->on('transaction_journals.id', '=', 'source.transaction_journal_id')->where('source.amount', '<', 0); - } + 'transactions AS source', + function (JoinClause $join) { + $join->on('transaction_journals.id', '=', 'source.transaction_journal_id')->where('source.amount', '<', 0); + } ) ->leftJoin( - 'transactions AS destination', function (JoinClause $join) { - $join->on('transaction_journals.id', '=', 'destination.transaction_journal_id')->where( - 'destination.amount', '>', 0 - ); - } + 'transactions AS destination', + function (JoinClause $join) { + $join->on('transaction_journals.id', '=', 'destination.transaction_journal_id')->where( + 'destination.amount', + '>', + 0 + ); + } ) ->leftJoin('accounts as source_accounts', 'source.account_id', '=', 'source_accounts.id') ->leftJoin('accounts as destination_accounts', 'destination.account_id', '=', 'destination_accounts.id') @@ -289,8 +289,8 @@ trait ImportSupport ->where('transaction_types.type', TransactionType::TRANSFER) ->get( ['transaction_journals.id', 'transaction_journals.encrypted', 'transaction_journals.description', - 'source_accounts.name as source_name', 'destination_accounts.name as destination_name', 'destination.amount' - , 'transaction_journals.date'] + 'source_accounts.name as source_name', 'destination_accounts.name as destination_name', 'destination.amount', + 'transaction_journals.date',] ); $array = []; /** @var TransactionJournal $entry */ @@ -323,14 +323,13 @@ trait ImportSupport ->where('data', $json) ->where('name', 'importHash') ->first(); - if (!is_null($entry)) { + if (null !== $entry) { Log::error(sprintf('A journal with hash %s has already been imported (spoiler: it\'s journal #%d)', $hash, $entry->transaction_journal_id)); return true; } return false; - } /** @@ -339,7 +338,7 @@ trait ImportSupport */ private function storeBill(TransactionJournal $journal, Bill $bill) { - if (!is_null($bill->id)) { + if (null !== $bill->id) { Log::debug(sprintf('Linked bill #%d to journal #%d', $bill->id, $journal->id)); $journal->bill()->associate($bill); $journal->save(); @@ -352,7 +351,7 @@ trait ImportSupport */ private function storeBudget(TransactionJournal $journal, Budget $budget) { - if (!is_null($budget->id)) { + if (null !== $budget->id) { Log::debug(sprintf('Linked budget #%d to journal #%d', $budget->id, $journal->id)); $journal->budgets()->save($budget); } @@ -364,12 +363,10 @@ trait ImportSupport */ private function storeCategory(TransactionJournal $journal, Category $category) { - - if (!is_null($category->id)) { + if (null !== $category->id) { Log::debug(sprintf('Linked category #%d to journal #%d', $category->id, $journal->id)); $journal->categories()->save($category); } - } private function storeJournal(array $parameters): TransactionJournal @@ -406,7 +403,7 @@ trait ImportSupport 'currency' => $parameters['currency'], 'amount' => $parameters['amount'], 'foreign_currency' => $parameters['foreign_currency'], - 'foreign_amount' => is_null($parameters['foreign_currency']) ? null : $parameters['amount'], + 'foreign_amount' => null === $parameters['foreign_currency'] ? null : $parameters['amount'], ]; $opposite = app('steam')->opposite($parameters['amount']); $two = [ @@ -415,7 +412,7 @@ trait ImportSupport 'currency' => $parameters['currency'], 'amount' => $opposite, 'foreign_currency' => $parameters['foreign_currency'], - 'foreign_amount' => is_null($parameters['foreign_currency']) ? null : $opposite, + 'foreign_amount' => null === $parameters['foreign_currency'] ? null : $opposite, ]; $this->createTransaction($one); $this->createTransaction($two); @@ -452,10 +449,10 @@ trait ImportSupport foreach ($tags as $tag) { $dbTag = $repository->findByTag($tag); - if (is_null($dbTag->id)) { + if (null === $dbTag->id) { $dbTag = $repository->store( ['tag' => $tag, 'date' => null, 'description' => null, 'latitude' => null, 'longitude' => null, - 'zoomLevel' => null, 'tagMode' => 'nothing'] + 'zoomLevel' => null, 'tagMode' => 'nothing',] ); } $journal->tags()->save($dbTag); @@ -464,5 +461,4 @@ trait ImportSupport return; } - } diff --git a/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php b/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php index af3769eae9..77aa4174f4 100644 --- a/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php +++ b/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Jobs; @@ -34,9 +33,7 @@ use Illuminate\Queue\SerializesModels; use Illuminate\Support\Collection; /** - * Class ExecuteRuleGroupOnExistingTransactions - * - * @package FireflyIII\Jobs + * Class ExecuteRuleGroupOnExistingTransactions. */ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue { @@ -44,13 +41,13 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue /** @var Collection */ private $accounts; - /** @var Carbon */ + /** @var Carbon */ private $endDate; /** @var RuleGroup */ private $ruleGroup; - /** @var Carbon */ + /** @var Carbon */ private $startDate; - /** @var User */ + /** @var User */ private $user; /** @@ -72,7 +69,6 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue } /** - * * @param Collection $accounts */ public function setAccounts(Collection $accounts) @@ -89,7 +85,6 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue } /** - * * @param Carbon $date */ public function setEndDate(Carbon $date) @@ -106,7 +101,6 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue } /** - * * @param Carbon $date */ public function setStartDate(Carbon $date) @@ -123,7 +117,6 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue } /** - * * @param User $user */ public function setUser(User $user) @@ -133,8 +126,6 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue /** * Execute the job. - * - * @return void */ public function handle() { @@ -159,7 +150,7 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue } /** - * Collect all journals that should be processed + * Collect all journals that should be processed. * * @return Collection */ @@ -174,7 +165,7 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue } /** - * Collects a list of rule processors, one for each rule within the rule group + * Collects a list of rule processors, one for each rule within the rule group. * * @return array */ @@ -192,8 +183,8 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue return array_map( function ($rule) { return Processor::make($rule); - }, $rules->all() + }, + $rules->all() ); } - } diff --git a/app/Jobs/ExecuteRuleOnExistingTransactions.php b/app/Jobs/ExecuteRuleOnExistingTransactions.php index 9dba6dde22..0c7fbd7fd1 100644 --- a/app/Jobs/ExecuteRuleOnExistingTransactions.php +++ b/app/Jobs/ExecuteRuleOnExistingTransactions.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Jobs; @@ -35,9 +34,7 @@ use Illuminate\Support\Collection; use Log; /** - * Class ExecuteRuleOnExistingTransactions - * - * @package FireflyIII\Jobs + * Class ExecuteRuleOnExistingTransactions. */ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue { @@ -45,13 +42,13 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue /** @var Collection */ private $accounts; - /** @var Carbon */ + /** @var Carbon */ private $endDate; /** @var Rule */ private $rule; - /** @var Carbon */ + /** @var Carbon */ private $startDate; - /** @var User */ + /** @var User */ private $user; /** @@ -73,7 +70,6 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue } /** - * * @param Collection $accounts */ public function setAccounts(Collection $accounts) @@ -90,7 +86,6 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue } /** - * * @param Carbon $date */ public function setEndDate(Carbon $date) @@ -107,7 +102,6 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue } /** - * * @param Carbon $date */ public function setStartDate(Carbon $date) @@ -124,7 +118,6 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue } /** - * * @param User $user */ public function setUser(User $user) @@ -134,8 +127,6 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue /** * Execute the job. - * - * @return void */ public function handle() { @@ -147,13 +138,13 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue $total = 0; // Execute the rules for each transaction foreach ($transactions as $transaction) { - $total++; + ++$total; $result = $processor->handleTransaction($transaction); if ($result) { - $hits++; + ++$hits; } if (!$result) { - $misses++; + ++$misses; } Log::info(sprintf('Current progress: %d Transactions. Hits: %d, misses: %d', $total, $hits, $misses)); // Stop processing this group if the rule specifies 'stop_processing' @@ -162,11 +153,10 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue } } Log::info(sprintf('Total transactions: %d. Hits: %d, misses: %d', $total, $hits, $misses)); - } /** - * Collect all journals that should be processed + * Collect all journals that should be processed. * * @return Collection */ @@ -179,5 +169,4 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue return $collector->getJournals(); } - } diff --git a/app/Jobs/Job.php b/app/Jobs/Job.php index 34ec0ec156..738c8a0ff6 100644 --- a/app/Jobs/Job.php +++ b/app/Jobs/Job.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Jobs; @@ -26,12 +25,9 @@ namespace FireflyIII\Jobs; use Illuminate\Bus\Queueable; /** - * Class Job - * - * @package FireflyIII\Jobs + * Class Job. */ abstract class Job { - use Queueable; } diff --git a/app/Jobs/MailError.php b/app/Jobs/MailError.php index 5c8482d80e..58835eb59f 100644 --- a/app/Jobs/MailError.php +++ b/app/Jobs/MailError.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Jobs; @@ -33,21 +32,19 @@ use Mail; use Swift_TransportException; /** - * Class MailError - * - * @package FireflyIII\Jobs + * Class MailError. */ class MailError extends Job implements ShouldQueue { use InteractsWithQueue, SerializesModels; - /** @var string */ + /** @var string */ protected $destination; - /** @var array */ + /** @var array */ protected $exception; - /** @var string */ + /** @var string */ protected $ipAddress; - /** @var array */ + /** @var array */ protected $userData; /** @@ -57,7 +54,6 @@ class MailError extends Job implements ShouldQueue * @param string $destination * @param string $ipAddress * @param array $exceptionData - * */ public function __construct(array $userData, string $destination, string $ipAddress, array $exceptionData) { @@ -72,8 +68,6 @@ class MailError extends Job implements ShouldQueue /** * Execute the job. - * - * @return void */ public function handle() { @@ -87,9 +81,10 @@ class MailError extends Job implements ShouldQueue $args['ip'] = $this->ipAddress; Mail::send( - ['emails.error-html', 'emails.error-text'], $args, + ['emails.error-html', 'emails.error-text'], + $args, function (Message $message) use ($email) { - if ($email !== 'mail@example.com') { + if ('mail@example.com' !== $email) { $message->to($email, $email)->subject('Caught an error in Firely III'); } } diff --git a/app/Mail/AdminTestMail.php b/app/Mail/AdminTestMail.php index a83047fa22..9895359c3b 100644 --- a/app/Mail/AdminTestMail.php +++ b/app/Mail/AdminTestMail.php @@ -19,6 +19,9 @@ * along with Firefly III. If not, see . */ +declare(strict_types=1); + + namespace FireflyIII\Mail; use Illuminate\Bus\Queueable; @@ -26,17 +29,17 @@ use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; /** - * Class AdminTestMail + * Class AdminTestMail. * - * @package FireflyIII\Mail + * Sends a test mail to administrators. */ class AdminTestMail extends Mailable { use Queueable, SerializesModels; - /** @var string */ + /** @var string Email address of admin */ public $email; - /** @var string */ + /** @var string IP address of admin */ public $ipAddress; /** diff --git a/app/Mail/ConfirmEmailChangeMail.php b/app/Mail/ConfirmEmailChangeMail.php index 344aab2822..d08b62eba5 100644 --- a/app/Mail/ConfirmEmailChangeMail.php +++ b/app/Mail/ConfirmEmailChangeMail.php @@ -19,23 +19,30 @@ * along with Firefly III. If not, see . */ +declare(strict_types=1); + namespace FireflyIII\Mail; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; +/** + * Class ConfirmEmailChangeMail + * + * Sends message to new address to confirm change. + */ class ConfirmEmailChangeMail extends Mailable { use Queueable, SerializesModels; - /** @var string */ + /** @var string IP address of user */ public $ipAddress; - /** @var string */ + /** @var string New email address */ public $newEmail; - /** @var string */ + /** @var string Old email address */ public $oldEmail; - /** @var string */ + /** @var string Confirmation link */ public $uri; /** @@ -48,7 +55,6 @@ class ConfirmEmailChangeMail extends Mailable */ public function __construct(string $newEmail, string $oldEmail, string $uri, string $ipAddress) { - $this->newEmail = $newEmail; $this->oldEmail = $oldEmail; $this->uri = $uri; diff --git a/app/Mail/RegisteredUser.php b/app/Mail/RegisteredUser.php index 2b59f302f7..1e01647930 100644 --- a/app/Mail/RegisteredUser.php +++ b/app/Mail/RegisteredUser.php @@ -19,10 +19,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - /** * RegisteredUser.php * Copyright (c) 2017 thegrumpydictator@gmail.com @@ -38,12 +36,17 @@ use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; +/** + * Sends newly registered user an email message. + * + * Class RegisteredUser + */ class RegisteredUser extends Mailable { use Queueable, SerializesModels; - /** @var string */ + /** @var string Email address of user */ public $address; - /** @var string */ + /** @var string IP address of user */ public $ipAddress; /** diff --git a/app/Mail/RequestedNewPassword.php b/app/Mail/RequestedNewPassword.php index 3f28c654da..6041424d62 100644 --- a/app/Mail/RequestedNewPassword.php +++ b/app/Mail/RequestedNewPassword.php @@ -19,10 +19,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - /** * RequestedNewPassword.php * Copyright (c) 2017 thegrumpydictator@gmail.com @@ -38,12 +36,16 @@ use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; +/** + * Sends user link for new password. + * Class RequestedNewPassword + */ class RequestedNewPassword extends Mailable { use Queueable, SerializesModels; - /** @var string */ + /** @var string IP address of user */ public $ipAddress; - /** @var string */ + /** @var string URI of password change link */ public $url; /** diff --git a/app/Mail/UndoEmailChangeMail.php b/app/Mail/UndoEmailChangeMail.php index 16e5ef8187..6fc85d6e07 100644 --- a/app/Mail/UndoEmailChangeMail.php +++ b/app/Mail/UndoEmailChangeMail.php @@ -19,23 +19,30 @@ * along with Firefly III. If not, see . */ +declare(strict_types=1); + + + namespace FireflyIII\Mail; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; +/** + * Class UndoEmailChangeMail + */ class UndoEmailChangeMail extends Mailable { use Queueable, SerializesModels; - /** @var string */ + /** @var string IP address of user*/ public $ipAddress; - /** @var string */ + /** @var string New email address */ public $newEmail; - /** @var string */ + /** @var string Old email address */ public $oldEmail; - /** @var string */ + /** @var string URI to undo */ public $uri; /** @@ -48,7 +55,6 @@ class UndoEmailChangeMail extends Mailable */ public function __construct(string $newEmail, string $oldEmail, string $uri, string $ipAddress) { - $this->newEmail = $newEmail; $this->oldEmail = $oldEmail; $this->uri = $uri; diff --git a/app/Models/Account.php b/app/Models/Account.php index 3848ac32f2..50c6ec7618 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -36,11 +35,8 @@ use Illuminate\Database\Query\JoinClause; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Watson\Validating\ValidatingTrait; - /** - * Class Account - * - * @package FireflyIII\Models + * Class Account. */ class Account extends Model { @@ -53,15 +49,13 @@ class Account extends Model */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', 'active' => 'boolean', 'encrypted' => 'boolean', ]; /** @var array */ - protected $dates = ['created_at', 'updated_at', 'deleted_at']; - /** @var array */ protected $fillable = ['user_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban']; /** @var array */ protected $hidden = ['encrypted']; @@ -73,13 +67,14 @@ class Account extends Model 'active' => 'required|boolean', 'iban' => 'between:1,50|iban', ]; - /** @var bool */ + /** @var bool */ private $joinedAccountTypes; /** * @param array $fields * * @return Account + * * @throws FireflyException */ public static function firstOrCreateEncrypted(array $fields) @@ -102,7 +97,6 @@ class Account extends Model $fields['name'] = $fields['iban']; } - /** @var Account $account */ foreach ($set as $account) { if ($account->name === $fields['name']) { @@ -114,7 +108,6 @@ class Account extends Model $account = self::create($fields); return $account; - } /** @@ -124,7 +117,6 @@ class Account extends Model */ public static function routeBinder(Account $value) { - if (auth()->check()) { if (intval($value->user_id) === auth()->user()->id) { return $value; @@ -156,7 +148,7 @@ class Account extends Model { $name = $this->name; - if ($this->accountType->type === AccountType::CASH) { + if (AccountType::CASH === $this->accountType->type) { return ''; } @@ -164,16 +156,17 @@ class Account extends Model } /** - * FIxxME can return null + * FIxxME can return null. * * @param $value * * @return string + * * @throws FireflyException */ public function getIbanAttribute($value): string { - if (is_null($value) || strlen(strval($value)) === 0) { + if (null === $value || 0 === strlen(strval($value))) { return ''; } try { @@ -181,7 +174,7 @@ class Account extends Model } catch (DecryptException $e) { throw new FireflyException('Cannot decrypt value "' . $value . '" for account #' . $this->id); } - if (is_null($result)) { + if (null === $result) { return ''; } @@ -189,7 +182,6 @@ class Account extends Model } /** - * * @param string $fieldName * * @return string @@ -206,14 +198,12 @@ class Account extends Model } /** - * * @param $value * * @return string */ public function getNameAttribute($value): string { - if ($this->encrypted) { return Crypt::decrypt($value); } @@ -222,9 +212,10 @@ class Account extends Model } /** - * Returns the opening balance + * Returns the opening balance. * * @return TransactionJournal + * * @throws FireflyException */ public function getOpeningBalance(): TransactionJournal @@ -234,7 +225,7 @@ class Account extends Model ->where('transactions.account_id', $this->id) ->transactionTypes([TransactionType::OPENING_BALANCE]) ->first(['transaction_journals.*']); - if (is_null($journal)) { + if (null === $journal) { return new TransactionJournal; } @@ -245,6 +236,7 @@ class Account extends Model * Returns the amount of the opening balance for this account. * * @return string + * * @throws FireflyException */ public function getOpeningBalanceAmount(): string @@ -254,16 +246,16 @@ class Account extends Model ->where('transactions.account_id', $this->id) ->transactionTypes([TransactionType::OPENING_BALANCE]) ->first(['transaction_journals.*']); - if (is_null($journal)) { + if (null === $journal) { return '0'; } $count = $journal->transactions()->count(); - if ($count !== 2) { + if (2 !== $count) { throw new FireflyException(sprintf('Cannot use getFirstTransaction on journal #%d', $journal->id)); } $transaction = $journal->transactions()->where('account_id', $this->id)->first(); - if (is_null($transaction)) { + if (null === $transaction) { return '0'; } @@ -271,9 +263,10 @@ class Account extends Model } /** - * Returns the date of the opening balance for this account. If no date, will return 01-01-1900 + * Returns the date of the opening balance for this account. If no date, will return 01-01-1900. * * @return Carbon + * * @throws FireflyException */ public function getOpeningBalanceDate(): Carbon @@ -284,7 +277,7 @@ class Account extends Model ->where('transactions.account_id', $this->id) ->transactionTypes([TransactionType::OPENING_BALANCE]) ->first(['transaction_journals.*']); - if (is_null($journal)) { + if (null === $journal) { return $date; } @@ -300,13 +293,12 @@ class Account extends Model } /** - * * @param EloquentBuilder $query * @param array $types */ public function scopeAccountTypeIn(EloquentBuilder $query, array $types) { - if (is_null($this->joinedAccountTypes)) { + if (null === $this->joinedAccountTypes) { $query->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id'); $this->joinedAccountTypes = true; } @@ -314,7 +306,6 @@ class Account extends Model } /** - * * @param EloquentBuilder $query * @param string $name * @param string $value @@ -323,15 +314,15 @@ class Account extends Model { $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); - } + '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)); } /** - * * @param $value */ public function setIbanAttribute($value) @@ -340,7 +331,6 @@ class Account extends Model } /** - * * @param $value */ public function setNameAttribute($value) @@ -352,7 +342,6 @@ class Account extends Model /** * @param $value - * */ public function setVirtualBalanceAttribute($value) { diff --git a/app/Models/AccountMeta.php b/app/Models/AccountMeta.php index a4b454ab20..b4e6c3053f 100644 --- a/app/Models/AccountMeta.php +++ b/app/Models/AccountMeta.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -27,13 +26,10 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; /** - * Class AccountMeta - * - * @package FireflyIII\Models + * Class AccountMeta. */ class AccountMeta extends Model { - /** * The attributes that should be casted to native types. * @@ -41,16 +37,14 @@ class AccountMeta extends Model */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', ]; /** @var array */ - protected $dates = ['created_at', 'updated_at']; protected $fillable = ['account_id', 'name', 'data']; protected $table = 'account_meta'; /** - * * @return BelongsTo */ public function account(): BelongsTo @@ -58,7 +52,6 @@ class AccountMeta extends Model return $this->belongsTo('FireflyIII\Models\Account'); } - /** * @param $value * @@ -76,5 +69,4 @@ class AccountMeta extends Model { $this->attributes['data'] = json_encode($value); } - } diff --git a/app/Models/AccountType.php b/app/Models/AccountType.php index 5ec636bfbd..66eb903b65 100644 --- a/app/Models/AccountType.php +++ b/app/Models/AccountType.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -27,9 +26,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; /** - * Class AccountType - * - * @package FireflyIII\Models + * Class AccountType. */ class AccountType extends Model { @@ -41,8 +38,8 @@ class AccountType extends Model const INITIAL_BALANCE = 'Initial balance account'; const BENEFICIARY = 'Beneficiary account'; const IMPORT = 'Import account'; - - + const RECONCILIATION = 'Reconciliation account'; + const LOAN = 'Loan'; /** * The attributes that should be casted to native types. * @@ -50,14 +47,11 @@ class AccountType extends Model */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', ]; - /** @var array */ - protected $dates = ['created_at', 'updated_at']; - - // + protected $fillable = ['type']; /** * @return HasMany diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php index a26d618644..00ea1c5e89 100644 --- a/app/Models/Attachment.php +++ b/app/Models/Attachment.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -31,9 +30,7 @@ use Illuminate\Database\Eloquent\SoftDeletes; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** - * Class Attachment - * - * @package FireflyIII\Models + * Class Attachment. */ class Attachment extends Model { @@ -46,14 +43,12 @@ class Attachment extends Model */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', 'uploaded' => 'boolean', ]; /** @var array */ - protected $dates = ['created_at', 'updated_at', 'deleted_at']; - /** @var array */ protected $fillable = ['attachable_id', 'attachable_type', 'user_id', 'md5', 'filename', 'mime', 'title', 'notes', 'description', 'size', 'uploaded']; /** @@ -64,7 +59,6 @@ class Attachment extends Model public static function routeBinder(Attachment $value) { if (auth()->check()) { - if (intval($value->user_id) === auth()->user()->id) { return $value; } @@ -99,7 +93,7 @@ class Attachment extends Model */ public function getDescriptionAttribute($value) { - if (is_null($value) || strlen($value) === 0) { + if (null === $value || 0 === strlen($value)) { return null; } @@ -113,7 +107,7 @@ class Attachment extends Model */ public function getFilenameAttribute($value) { - if (is_null($value) || strlen($value) === 0) { + if (null === $value || 0 === strlen($value)) { return null; } @@ -127,7 +121,7 @@ class Attachment extends Model */ public function getMimeAttribute($value) { - if (is_null($value) || strlen($value) === 0) { + if (null === $value || 0 === strlen($value)) { return null; } @@ -135,14 +129,13 @@ class Attachment extends Model } /** - * * @param $value * * @return null|string */ public function getNotesAttribute($value) { - if (is_null($value) || strlen($value) === 0) { + if (null === $value || 0 === strlen($value)) { return null; } @@ -150,14 +143,13 @@ class Attachment extends Model } /** - * * @param $value * * @return null|string */ public function getTitleAttribute($value) { - if (is_null($value) || strlen($value) === 0) { + if (null === $value || 0 === strlen($value)) { return null; } @@ -211,5 +203,4 @@ class Attachment extends Model { return $this->belongsTo('FireflyIII\User'); } - } diff --git a/app/Models/AvailableBudget.php b/app/Models/AvailableBudget.php index 7a37df2f07..9e90b2572f 100644 --- a/app/Models/AvailableBudget.php +++ b/app/Models/AvailableBudget.php @@ -18,20 +18,16 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; - use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; /** - * Class AvailableBudget - * - * @package FireflyIII\Models + * Class AvailableBudget. */ class AvailableBudget extends Model { @@ -43,15 +39,13 @@ class AvailableBudget extends Model */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', 'start_date' => 'date', 'end_date' => 'date', ]; /** @var array */ - protected $dates = ['created_at', 'updated_at', 'deleted_at']; - /** @var array */ protected $fillable = ['user_id', 'transaction_currency_id', 'amount', 'start_date', 'end_date']; /** diff --git a/app/Models/Bill.php b/app/Models/Bill.php index 6c52a3a86b..7b9a7fd2a7 100644 --- a/app/Models/Bill.php +++ b/app/Models/Bill.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -32,13 +31,10 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Watson\Validating\ValidatingTrait; /** - * Class Bill - * - * @package FireflyIII\Models + * Class Bill. */ class Bill extends Model { - use SoftDeletes, ValidatingTrait; /** * The attributes that should be casted to native types. @@ -46,10 +42,10 @@ class Bill extends Model * @var array */ protected $casts - = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + = [ + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', 'date' => 'date', 'skip' => 'int', 'automatch' => 'boolean', @@ -57,13 +53,11 @@ class Bill extends Model 'name_encrypted' => 'boolean', 'match_encrypted' => 'boolean', ]; - /** @var array */ - protected $dates = ['created_at', 'updated_at', 'deleted_at']; 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']; - protected $rules = ['name' => 'required|between:1,200',]; + protected $rules = ['name' => 'required|between:1,200']; /** * @param Bill $value @@ -80,6 +74,14 @@ class Bill extends Model throw new NotFoundHttpException; } + /** + * @return \Illuminate\Database\Eloquent\Relations\MorphMany + */ + public function attachments() + { + return $this->morphMany('FireflyIII\Models\Attachment', 'attachable'); + } + /** * @param $value * @@ -87,8 +89,7 @@ class Bill extends Model */ public function getMatchAttribute($value) { - - if (intval($this->match_encrypted) === 1) { + if (1 === intval($this->match_encrypted)) { return Crypt::decrypt($value); } @@ -102,14 +103,21 @@ class Bill extends Model */ public function getNameAttribute($value) { - - if (intval($this->name_encrypted) === 1) { + if (1 === intval($this->name_encrypted)) { return Crypt::decrypt($value); } return $value; } + /** + * Get all of the notes. + */ + public function notes() + { + return $this->morphMany('FireflyIII\Models\Note', 'noteable'); + } + /** * @param $value */ @@ -161,6 +169,4 @@ class Bill extends Model { return $this->belongsTo('FireflyIII\User'); } - - } diff --git a/app/Models/Budget.php b/app/Models/Budget.php index 1044d66125..d319d2aa2b 100644 --- a/app/Models/Budget.php +++ b/app/Models/Budget.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -31,13 +30,10 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Watson\Validating\ValidatingTrait; /** - * Class Budget - * - * @package FireflyIII\Models + * Class Budget. */ class Budget extends Model { - use SoftDeletes, ValidatingTrait; /** @@ -47,17 +43,18 @@ class Budget extends Model */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', 'active' => 'boolean', 'encrypted' => 'boolean', ]; /** @var array */ - protected $dates = ['created_at', 'updated_at', 'deleted_at']; protected $fillable = ['user_id', 'name', 'active']; - protected $hidden = ['encrypted']; - protected $rules = ['name' => 'required|between:1,200',]; + /** @var array */ + protected $hidden = ['encrypted']; + /** @var array */ + protected $rules = ['name' => 'required|between:1,200']; /** * @param array $fields @@ -84,7 +81,6 @@ class Budget extends Model $budget = self::create($fields); return $budget; - } /** @@ -103,7 +99,6 @@ class Budget extends Model } /** - * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function budgetlimits() @@ -118,7 +113,6 @@ class Budget extends Model */ public function getNameAttribute($value) { - if ($this->encrypted) { return Crypt::decrypt($value); } @@ -159,6 +153,4 @@ class Budget extends Model { return $this->belongsTo('FireflyIII\User'); } - - } diff --git a/app/Models/BudgetLimit.php b/app/Models/BudgetLimit.php index fa0384857f..00c7271711 100644 --- a/app/Models/BudgetLimit.php +++ b/app/Models/BudgetLimit.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -27,13 +26,10 @@ use Illuminate\Database\Eloquent\Model; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** - * Class BudgetLimit - * - * @package FireflyIII\Models + * Class BudgetLimit. */ class BudgetLimit extends Model { - /** * The attributes that should be casted to native types. * @@ -41,14 +37,14 @@ class BudgetLimit extends Model */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', 'start_date' => 'date', 'end_date' => 'date', 'repeats' => 'boolean', ]; /** @var array */ - protected $dates = ['created_at', 'updated_at', 'start_date', 'end_date']; + protected $dates = ['start_date', 'end_date']; /** * @param $value @@ -85,7 +81,6 @@ class BudgetLimit extends Model return $this->hasMany('FireflyIII\Models\LimitRepetition'); } - /** * @param $value */ @@ -93,5 +88,4 @@ class BudgetLimit extends Model { $this->attributes['amount'] = strval(round($value, 12)); } - } diff --git a/app/Models/Category.php b/app/Models/Category.php index cd44b771e6..d72cd168e2 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -31,9 +30,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Watson\Validating\ValidatingTrait; /** - * Class Category - * - * @package FireflyIII\Models + * Class Category. */ class Category extends Model { @@ -46,19 +43,17 @@ class Category extends Model */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', 'encrypted' => 'boolean', ]; /** @var array */ - protected $dates = ['created_at', 'updated_at', 'deleted_at']; - /** @var array */ protected $fillable = ['user_id', 'name']; /** @var array */ protected $hidden = ['encrypted']; /** @var array */ - protected $rules = ['name' => 'required|between:1,200',]; + protected $rules = ['name' => 'required|between:1,200']; /** * @param array $fields @@ -85,7 +80,6 @@ class Category extends Model $category = self::create($fields); return $category; - } /** @@ -104,14 +98,12 @@ class Category extends Model } /** - * * @param $value * * @return string */ public function getNameAttribute($value) { - if ($this->encrypted) { return Crypt::decrypt($value); } @@ -120,7 +112,6 @@ class Category extends Model } /** - * * @param $value */ public function setNameAttribute($value) @@ -153,5 +144,4 @@ class Category extends Model { return $this->belongsTo('FireflyIII\User'); } - } diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index c9f9edbf77..028f5faf57 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -27,9 +26,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; /** - * Class Configuration - * - * @package FireflyIII\Models + * Class Configuration. */ class Configuration extends Model { @@ -41,12 +38,10 @@ class Configuration extends Model * @var array */ protected $casts - = [ - 'created_at' => 'date', - 'updated_at' => 'date', + = [ + 'created_at' => 'datetime', + 'updated_at' => 'datetime', ]; - /** @var array */ - protected $dates = ['created_at', 'updated_at', 'deleted_at']; protected $table = 'configuration'; /** @@ -66,6 +61,4 @@ class Configuration extends Model { $this->attributes['data'] = json_encode($value); } - - } diff --git a/app/Models/CurrencyExchangeRate.php b/app/Models/CurrencyExchangeRate.php index c953a8cca1..acea35d9f2 100644 --- a/app/Models/CurrencyExchangeRate.php +++ b/app/Models/CurrencyExchangeRate.php @@ -18,25 +18,21 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; - use FireflyIII\User; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; /** - * Class CurrencyExchange - * - * @package FireflyIII\Models + * Class CurrencyExchange. */ class CurrencyExchangeRate extends Model { - - protected $dates = ['created_at', 'updated_at', 'date']; + /** @var array */ + protected $dates = ['date']; /** * @return BelongsTo @@ -61,5 +57,4 @@ class CurrencyExchangeRate extends Model { return $this->belongsTo(User::class); } - } diff --git a/app/Models/ExportJob.php b/app/Models/ExportJob.php index dc14d88805..599b6bdba9 100644 --- a/app/Models/ExportJob.php +++ b/app/Models/ExportJob.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -28,34 +27,31 @@ use Illuminate\Database\Eloquent\Model; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** - * Class ExportJob + * Class ExportJob. * * @property User $user - * - * @package FireflyIII\Models */ class ExportJob extends Model { /** @var array */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', ]; - /** @var array */ - protected $dates = ['created_at', 'updated_at']; /** * @param $value * * @return mixed + * * @throws NotFoundHttpException */ public static function routeBinder($value) { if (auth()->check()) { $model = self::where('key', $value)->where('user_id', auth()->user()->id)->first(); - if (!is_null($model)) { + if (null !== $model) { return $model; } } diff --git a/app/Models/ImportJob.php b/app/Models/ImportJob.php index 6e866aefda..74c7e591f9 100644 --- a/app/Models/ImportJob.php +++ b/app/Models/ImportJob.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -30,13 +29,10 @@ use Storage; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** - * Class ImportJob - * - * @package FireflyIII\Models + * Class ImportJob. */ class ImportJob extends Model { - /** * The attributes that should be casted to native types. * @@ -44,11 +40,9 @@ class ImportJob extends Model */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', ]; - /** @var array */ - protected $dates = ['created_at', 'updated_at']; protected $validStatus = [ @@ -63,13 +57,14 @@ class ImportJob extends Model * @param $value * * @return mixed + * * @throws NotFoundHttpException */ public static function routeBinder($value) { if (auth()->check()) { $model = self::where('key', $value)->where('user_id', auth()->user()->id)->first(); - if (!is_null($model)) { + if (null !== $model) { return $model; } } @@ -100,7 +95,6 @@ class ImportJob extends Model $status['done'] += $count; $this->extended_status = $status; $this->save(); - } /** @@ -112,7 +106,6 @@ class ImportJob extends Model $status['steps'] += $count; $this->extended_status = $status; $this->save(); - } /** @@ -131,10 +124,10 @@ class ImportJob extends Model */ public function getConfigurationAttribute($value) { - if (is_null($value)) { + if (null === $value) { return []; } - if (strlen($value) === 0) { + if (0 === strlen($value)) { return []; } @@ -148,7 +141,7 @@ class ImportJob extends Model */ public function getExtendedStatusAttribute($value) { - if (strlen($value) === 0) { + if (0 === strlen($value)) { return []; } diff --git a/app/Models/LimitRepetition.php b/app/Models/LimitRepetition.php deleted file mode 100644 index dfaaebd903..0000000000 --- a/app/Models/LimitRepetition.php +++ /dev/null @@ -1,92 +0,0 @@ -. - */ - -declare(strict_types=1); - -namespace FireflyIII\Models; - -use Carbon\Carbon; -use Illuminate\Database\Eloquent\Builder; -use Illuminate\Database\Eloquent\Model; - -/** - * Class LimitRepetition - * - * @deprecated - * @package FireflyIII\Models - */ -class LimitRepetition extends Model -{ - - /** - * The attributes that should be casted to native types. - * - * @var array - */ - protected $casts - = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'startdate' => 'date', - 'enddate' => 'date', - ]; - protected $dates = ['created_at', 'updated_at', 'startdate', 'enddate']; - protected $hidden = ['amount_encrypted']; - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function budgetLimit() - { - return $this->belongsTo('FireflyIII\Models\BudgetLimit'); - } - - /** - * - * @param Builder $query - * @param Carbon $date - * - */ - public function scopeAfter(Builder $query, Carbon $date) - { - $query->where('limit_repetitions.startdate', '>=', $date->format('Y-m-d 00:00:00')); - } - - /** - * - * @param Builder $query - * @param Carbon $date - * - */ - public function scopeBefore(Builder $query, Carbon $date) - { - $query->where('limit_repetitions.enddate', '<=', $date->format('Y-m-d 00:00:00')); - } - - /** - * @param $value - */ - public function setAmountAttribute($value) - { - $this->attributes['amount'] = strval(round($value, 2)); - } - -} diff --git a/app/Models/LinkType.php b/app/Models/LinkType.php index be70f06f4c..0c0e0cfac7 100644 --- a/app/Models/LinkType.php +++ b/app/Models/LinkType.php @@ -18,20 +18,16 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; - use Illuminate\Database\Eloquent\Model; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** * @property int $journalCount * Class LinkType - * - * @package FireflyIII\Models */ class LinkType extends Model { @@ -42,9 +38,9 @@ class LinkType extends Model */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', 'editable' => 'boolean', ]; @@ -55,13 +51,14 @@ class LinkType extends Model * @param $value * * @return mixed + * * @throws NotFoundHttpException */ public static function routeBinder($value) { if (auth()->check()) { $model = self::where('id', $value)->first(); - if (!is_null($model)) { + if (null !== $model) { return $model; } } @@ -72,5 +69,4 @@ class LinkType extends Model { return $this->hasMany(TransactionJournalLink::class); } - } diff --git a/app/Models/Note.php b/app/Models/Note.php index aa1665c671..4d5d2bfafb 100644 --- a/app/Models/Note.php +++ b/app/Models/Note.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -27,9 +26,7 @@ use Illuminate\Database\Eloquent\Model; use League\CommonMark\CommonMarkConverter; /** - * Class Note - * - * @package FireflyIII\Models + * Class Note. */ class Note extends Model { @@ -39,12 +36,12 @@ class Note extends Model * @var array */ protected $casts - = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + = [ + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', ]; - protected $dates = ['created_at', 'updated_at', 'deleted_at']; + /** @var array */ protected $fillable = ['title', 'text']; /** @@ -59,11 +56,10 @@ class Note extends Model /** * Get all of the owning noteable models. Currently piggy bank and - * transaction journal + * transaction journal. */ public function noteable() { return $this->morphTo(); } - } diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php index 9a81a08118..b3a4e1fe90 100644 --- a/app/Models/PiggyBank.php +++ b/app/Models/PiggyBank.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -32,9 +31,7 @@ use Steam; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** - * Class PiggyBank - * - * @package FireflyIII\Models + * Class PiggyBank. */ class PiggyBank extends Model { @@ -46,19 +43,22 @@ class PiggyBank extends Model * @var array */ protected $casts - = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + = [ + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', 'startdate' => 'date', 'targetdate' => 'date', 'order' => 'int', 'active' => 'boolean', 'encrypted' => 'boolean', ]; - protected $dates = ['created_at', 'updated_at', 'deleted_at', 'startdate', 'targetdate']; + /** @var array */ + protected $dates = ['startdate', 'targetdate']; + /** @var array */ protected $fillable = ['name', 'account_id', 'order', 'targetamount', 'startdate', 'targetdate']; - protected $hidden = ['targetamount_encrypted', 'encrypted']; + /** @var array */ + protected $hidden = ['targetamount_encrypted', 'encrypted']; /** * @param PiggyBank $value @@ -84,19 +84,19 @@ class PiggyBank extends Model } /** - * Grabs the PiggyBankRepetition that's currently relevant / active + * Grabs the PiggyBankRepetition that's currently relevant / active. * * @returns PiggyBankRepetition */ public function currentRelevantRep(): PiggyBankRepetition { - if (!is_null($this->currentRep)) { + if (null !== $this->currentRep) { return $this->currentRep; } // repeating piggy banks are no longer supported. /** @var PiggyBankRepetition $rep */ $rep = $this->piggyBankRepetitions()->first(['piggy_bank_repetitions.*']); - if (is_null($rep)) { + if (null === $rep) { return new PiggyBankRepetition(); } $this->currentRep = $rep; @@ -105,14 +105,12 @@ class PiggyBank extends Model } /** - * * @param $value * * @return string */ public function getNameAttribute($value) { - if ($this->encrypted) { return Crypt::decrypt($value); } @@ -132,12 +130,12 @@ class PiggyBank extends Model $remainingAmount = bcsub($this->targetamount, $this->currentRelevantRep()->currentamount); // more than 1 month to go and still need money to save: - if ($diffInMonths > 0 && bccomp($remainingAmount, '0') === 1) { + if ($diffInMonths > 0 && 1 === bccomp($remainingAmount, '0')) { $savePerMonth = bcdiv($remainingAmount, strval($diffInMonths)); } // less than 1 month to go but still need money to save: - if ($diffInMonths === 0 && bccomp($remainingAmount, '0') === 1) { + if (0 === $diffInMonths && 1 === bccomp($remainingAmount, '0')) { $savePerMonth = $remainingAmount; } } @@ -146,16 +144,14 @@ class PiggyBank extends Model } /** - * * @param Carbon $date * * @return string */ public function leftOnAccount(Carbon $date): string { - $balance = Steam::balanceIgnoreVirtual($this->account, $date); - /** @var PiggyBank $p */ + // @var PiggyBank $p foreach ($this->account->piggyBanks as $piggyBank) { $currentAmount = $piggyBank->currentRelevantRep()->currentamount ?? '0'; @@ -163,7 +159,6 @@ class PiggyBank extends Model } return $balance; - } /** @@ -191,7 +186,6 @@ class PiggyBank extends Model } /** - * * @param $value */ public function setNameAttribute($value) diff --git a/app/Models/PiggyBankEvent.php b/app/Models/PiggyBankEvent.php index 41e27d4296..4ec1836c9b 100644 --- a/app/Models/PiggyBankEvent.php +++ b/app/Models/PiggyBankEvent.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -26,25 +25,23 @@ namespace FireflyIII\Models; use Illuminate\Database\Eloquent\Model; /** - * Class PiggyBankEvent - * - * @package FireflyIII\Models + * Class PiggyBankEvent. */ class PiggyBankEvent extends Model { - /** * The attributes that should be casted to native types. * * @var array */ protected $casts - = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'date' => 'date', + = [ + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'date' => 'datetime', ]; - protected $dates = ['created_at', 'updated_at', 'date']; + /** @var array */ + protected $dates = ['date']; protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'amount']; protected $hidden = ['amount_encrypted']; @@ -71,5 +68,4 @@ class PiggyBankEvent extends Model { return $this->belongsTo('FireflyIII\Models\TransactionJournal'); } - } diff --git a/app/Models/PiggyBankRepetition.php b/app/Models/PiggyBankRepetition.php index 9484e631c2..edb2f51841 100644 --- a/app/Models/PiggyBankRepetition.php +++ b/app/Models/PiggyBankRepetition.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -28,27 +27,26 @@ use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Database\Eloquent\Model; /** - * Class PiggyBankRepetition - * - * @package FireflyIII\Models + * Class PiggyBankRepetition. */ class PiggyBankRepetition extends Model { - /** * The attributes that should be casted to native types. * * @var array */ protected $casts - = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + = [ + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', 'startdate' => 'date', 'targetdate' => 'date', ]; - protected $dates = ['created_at', 'updated_at', 'startdate', 'targetdate']; + /** @var array */ + protected $dates = ['startdate', 'targetdate']; + /** @var array */ protected $fillable = ['piggy_bank_id', 'startdate', 'targetdate', 'currentamount']; /** @@ -87,7 +85,6 @@ class PiggyBankRepetition extends Model ) ->where( function (EloquentBuilder $q) use ($date) { - $q->where('targetdate', '>=', $date->format('Y-m-d 00:00:00')); $q->orWhereNull('targetdate'); } @@ -101,5 +98,4 @@ class PiggyBankRepetition extends Model { $this->attributes['currentamount'] = strval(round($value, 12)); } - } diff --git a/app/Models/Preference.php b/app/Models/Preference.php index 6c984085a3..a5296a2036 100644 --- a/app/Models/Preference.php +++ b/app/Models/Preference.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -31,30 +30,29 @@ use Illuminate\Database\Eloquent\Model; use Log; /** - * Class Preference - * - * @package FireflyIII\Models + * Class Preference. */ class Preference extends Model { - /** * The attributes that should be casted to native types. * * @var array */ protected $casts - = [ - 'created_at' => 'date', - 'updated_at' => 'date', + = [ + 'created_at' => 'datetime', + 'updated_at' => 'datetime', ]; - protected $dates = ['created_at', 'updated_at']; + + /** @var array */ protected $fillable = ['user_id', 'data', 'name', 'data']; /** * @param $value * * @return mixed + * * @throws FireflyException */ public function getDataAttribute($value) @@ -73,7 +71,7 @@ class Preference extends Model } catch (Exception $e) { // don't care, assume is false. } - if (!($unserialized === false)) { + if (!(false === $unserialized)) { return $unserialized; } @@ -95,5 +93,4 @@ class Preference extends Model { return $this->belongsTo('FireflyIII\User'); } - } diff --git a/app/Models/Role.php b/app/Models/Role.php index 1d4da87723..27a01851d5 100644 --- a/app/Models/Role.php +++ b/app/Models/Role.php @@ -18,19 +18,15 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; - use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsToMany; /** - * Class Role - * - * @package FireflyIII\Models + * Class Role. */ class Role extends Model { @@ -40,11 +36,10 @@ class Role extends Model * @var array */ protected $casts - = [ - 'created_at' => 'date', - 'updated_at' => 'date', + = [ + 'created_at' => 'datetime', + 'updated_at' => 'datetime', ]; - protected $dates = ['created_at', 'updated_at']; /** * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany @@ -53,5 +48,4 @@ class Role extends Model { return $this->belongsToMany('FireflyIII\User'); } - } diff --git a/app/Models/Rule.php b/app/Models/Rule.php index bb67df6f68..4a37c9ab3d 100644 --- a/app/Models/Rule.php +++ b/app/Models/Rule.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -28,9 +27,7 @@ use Illuminate\Database\Eloquent\SoftDeletes; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** - * Class Rule - * - * @package FireflyIII\Models + * Class Rule. */ class Rule extends Model { @@ -43,15 +40,13 @@ class Rule extends Model */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', 'active' => 'boolean', 'order' => 'int', 'stop_processing' => 'boolean', ]; - /** @var array */ - protected $dates = ['created_at', 'updated_at', 'deleted_at']; /** * @param Rule $value @@ -99,5 +94,4 @@ class Rule extends Model { return $this->belongsTo('FireflyIII\User'); } - } diff --git a/app/Models/RuleAction.php b/app/Models/RuleAction.php index 800357db85..3bfdacc406 100644 --- a/app/Models/RuleAction.php +++ b/app/Models/RuleAction.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -26,9 +25,7 @@ namespace FireflyIII\Models; use Illuminate\Database\Eloquent\Model; /** - * Class RuleAction - * - * @package FireflyIII\Models + * Class RuleAction. */ class RuleAction extends Model { @@ -39,14 +36,12 @@ class RuleAction extends Model */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', 'active' => 'boolean', 'order' => 'int', 'stop_processing' => 'boolean', ]; - /** @var array */ - protected $dates = ['created_at', 'updated_at']; /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.php index 2eabf6bb5d..33c98ed0b1 100644 --- a/app/Models/RuleGroup.php +++ b/app/Models/RuleGroup.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -28,9 +27,7 @@ use Illuminate\Database\Eloquent\SoftDeletes; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** - * Class RuleGroup - * - * @package FireflyIII\Models + * Class RuleGroup. */ class RuleGroup extends Model { @@ -42,15 +39,12 @@ class RuleGroup extends Model */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', 'active' => 'boolean', 'order' => 'int', ]; - /** @var array */ - protected $dates = ['created_at', 'updated_at', 'deleted_at']; - protected $fillable = ['user_id', 'order', 'title', 'description', 'active']; diff --git a/app/Models/RuleTrigger.php b/app/Models/RuleTrigger.php index d9af8d38ab..bf867571a6 100644 --- a/app/Models/RuleTrigger.php +++ b/app/Models/RuleTrigger.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -26,9 +25,7 @@ namespace FireflyIII\Models; use Illuminate\Database\Eloquent\Model; /** - * Class RuleTrigger - * - * @package FireflyIII\Models + * Class RuleTrigger. */ class RuleTrigger extends Model { @@ -39,14 +36,12 @@ class RuleTrigger extends Model */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', 'active' => 'boolean', 'order' => 'int', 'stop_processing' => 'boolean', ]; - /** @var array */ - protected $dates = ['created_at', 'updated_at']; /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo diff --git a/app/Models/Tag.php b/app/Models/Tag.php index a5174e594a..555284408c 100644 --- a/app/Models/Tag.php +++ b/app/Models/Tag.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -30,9 +29,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Watson\Validating\ValidatingTrait; /** - * Class Tag - * - * @package FireflyIII\Models + * Class Tag. */ class Tag extends Model { @@ -44,18 +41,19 @@ class Tag extends Model * @var array */ protected $casts - = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + = [ + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', 'date' => 'date', 'zoomLevel' => 'int', - ]; - protected $dates = ['created_at', 'updated_at', 'date', 'deleted_at']; + /** @var array */ + protected $dates = ['date']; + /** @var array */ protected $fillable = ['user_id', 'tag', 'date', 'description', 'longitude', 'latitude', 'zoomLevel', 'tagMode']; - protected $rules = ['tag' => 'required|between:1,200',]; - + /** @var array */ + protected $rules = ['tag' => 'required|between:1,200']; /** * @param array $fields @@ -86,7 +84,6 @@ class Tag extends Model $tag = self::create($fields); return $tag; - } /** @@ -109,7 +106,7 @@ class Tag extends Model * * @return string */ - public static function tagSum(Tag $tag): string + public static function tagSum(self $tag): string { $sum = '0'; /** @var TransactionJournal $journal */ @@ -121,14 +118,13 @@ class Tag extends Model } /** - * * @param $value * * @return string */ public function getDescriptionAttribute($value) { - if (is_null($value)) { + if (null === $value) { return $value; } @@ -136,14 +132,13 @@ class Tag extends Model } /** - * * @param $value * * @return string */ public function getTagAttribute($value) { - if (is_null($value)) { + if (null === $value) { return null; } @@ -153,7 +148,7 @@ class Tag extends Model /** * Save the model to the database. * - * @param array $options + * @param array $options * * @return bool */ @@ -169,7 +164,6 @@ class Tag extends Model } /** - * * @param $value */ public function setDescriptionAttribute($value) @@ -178,7 +172,6 @@ class Tag extends Model } /** - * * @param $value */ public function setTagAttribute($value) @@ -201,6 +194,4 @@ class Tag extends Model { return $this->belongsTo('FireflyIII\User'); } - - } diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php index fa0c0c5a08..ca77193672 100644 --- a/app/Models/Transaction.php +++ b/app/Models/Transaction.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -30,53 +29,43 @@ use Illuminate\Database\Eloquent\SoftDeletes; use Watson\Validating\ValidatingTrait; /** - * Class Transaction + * Class Transaction. * - * @property-read int $journal_id - * @property Carbon $date - * @property-read string $transaction_description - * @property string $transaction_amount - * @property string $transaction_foreign_amount - * @property string $transaction_type_type - * @property string $foreign_currency_symbol - * @property int $foreign_currency_dp - * - * @property int $account_id - * @property string $account_name - * @property string $account_iban - * @property string $account_number - * @property string $account_bic - * @property string $account_currency_code - * - * @property int $opposing_account_id - * @property string $opposing_account_name - * @property string $opposing_account_iban - * @property string $opposing_account_number - * @property string $opposing_account_bic - * @property string $opposing_currency_code - * - * - * @property int $transaction_budget_id - * @property string $transaction_budget_name - * @property int $transaction_journal_budget_id - * @property string $transaction_journal_budget_name - * - * @property-read int $transaction_category_id - * @property-read string $transaction_category_name - * @property-read int $transaction_journal_category_id - * @property-read string $transaction_journal_category_name - * - * @property-read int $bill_id - * @property string $bill_name - * - * @property string $notes - * @property string $tags - * - * @property string $transaction_currency_symbol - * @property int $transaction_currency_dp - * @property string $transaction_currency_code - * - * @package FireflyIII\Models + * @property int $journal_id + * @property Carbon $date + * @property string $transaction_description + * @property string $transaction_amount + * @property string $transaction_foreign_amount + * @property string $transaction_type_type + * @property string $foreign_currency_symbol + * @property int $foreign_currency_dp + * @property int $account_id + * @property string $account_name + * @property string $account_iban + * @property string $account_number + * @property string $account_bic + * @property string $account_currency_code + * @property int $opposing_account_id + * @property string $opposing_account_name + * @property string $opposing_account_iban + * @property string $opposing_account_number + * @property string $opposing_account_bic + * @property string $opposing_currency_code + * @property int $transaction_budget_id + * @property string $transaction_budget_name + * @property int $transaction_journal_budget_id + * @property string $transaction_journal_budget_name + * @property int $transaction_category_id + * @property string $transaction_category_name + * @property int $transaction_journal_category_id + * @property string $transaction_journal_category_name + * @property int $bill_id + * @property string $bill_name + * @property string $notes + * @property string $tags + * @property string $transaction_currency_symbol + * @property int $transaction_currency_dp + * @property string $transaction_currency_code */ class Transaction extends Model { @@ -87,17 +76,17 @@ class Transaction extends Model */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', 'identifier' => 'int', 'encrypted' => 'boolean', // model does not have these fields though 'bill_name_encrypted' => 'boolean', + 'reconciled' => 'boolean', ]; - protected $dates = ['created_at', 'updated_at', 'deleted_at']; protected $fillable = ['account_id', 'transaction_journal_id', 'description', 'amount', 'identifier', 'transaction_currency_id', 'foreign_currency_id', - 'foreign_amount']; + 'foreign_amount',]; protected $hidden = ['encrypted']; protected $rules = [ @@ -117,7 +106,7 @@ class Transaction extends Model public static function isJoined(Builder $query, string $table): bool { $joins = $query->getQuery()->joins; - if (is_null($joins)) { + if (null === $joins) { return false; } foreach ($joins as $join) { @@ -174,7 +163,6 @@ class Transaction extends Model } /** - * * @param Builder $query * @param Carbon $date */ @@ -187,10 +175,8 @@ class Transaction extends Model } /** - * * @param Builder $query * @param Carbon $date - * */ public function scopeBefore(Builder $query, Carbon $date) { @@ -201,7 +187,6 @@ class Transaction extends Model } /** - * * @param Builder $query * @param array $types */ diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php index 8fe217cb8d..5e8b4dfe7f 100644 --- a/app/Models/TransactionCurrency.php +++ b/app/Models/TransactionCurrency.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -26,12 +25,9 @@ namespace FireflyIII\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Watson\Validating\ValidatingTrait; /** - * Class TransactionCurrency - * - * @package FireflyIII\Models + * Class TransactionCurrency. */ class TransactionCurrency extends Model { @@ -43,13 +39,15 @@ class TransactionCurrency extends Model * @var array */ protected $casts - = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + = [ + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', 'decimal_places' => 'int', ]; - protected $dates = ['created_at', 'updated_at', 'deleted_at', 'date']; + /** @var array */ + protected $dates = ['date']; + /** @var array */ protected $fillable = ['name', 'code', 'symbol', 'decimal_places']; /** @@ -57,7 +55,7 @@ class TransactionCurrency extends Model * * @return TransactionCurrency */ - public static function routeBinder(TransactionCurrency $currency) + public static function routeBinder(self $currency) { if (auth()->check()) { return $currency; diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php index f67b25aec7..883a6ba3ab 100644 --- a/app/Models/TransactionJournal.php +++ b/app/Models/TransactionJournal.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -38,9 +37,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Watson\Validating\ValidatingTrait; /** - * Class TransactionJournal - * - * @package FireflyIII\Models + * Class TransactionJournal. */ class TransactionJournal extends Model { @@ -53,9 +50,9 @@ class TransactionJournal extends Model */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', 'date' => 'date', 'interest_date' => 'date', 'book_date' => 'date', @@ -66,12 +63,12 @@ class TransactionJournal extends Model 'completed' => 'boolean', ]; /** @var array */ - protected $dates = ['created_at', 'updated_at', 'date', 'deleted_at', 'interest_date', 'book_date', 'process_date']; + protected $dates = ['date', 'interest_date', 'book_date', 'process_date']; /** @var array */ protected $fillable = ['user_id', 'transaction_type_id', 'bill_id', 'interest_date', 'book_date', 'process_date', 'transaction_currency_id', 'description', 'completed', - 'date', 'rent_date', 'encrypted', 'tag_count']; + 'date', 'rent_date', 'encrypted', 'tag_count',]; /** @var array */ protected $hidden = ['encrypted']; /** @var array */ @@ -89,6 +86,7 @@ class TransactionJournal extends Model * @param $value * * @return mixed + * * @throws NotFoundHttpException */ public static function routeBinder($value) @@ -98,7 +96,7 @@ class TransactionJournal extends Model ->with('transactionType') ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') ->where('user_id', auth()->user()->id)->first(['transaction_journals.*']); - if (!is_null($object)) { + if (null !== $object) { return $object; } } @@ -159,7 +157,6 @@ class TransactionJournal extends Model } /** - * * @param $value * * @return string @@ -174,7 +171,6 @@ class TransactionJournal extends Model } /** - * * @param string $name * * @return string @@ -193,14 +189,14 @@ class TransactionJournal extends Model Log::debug(sprintf('Looking for journal #%d meta field "%s".', $this->id, $name)); $entry = $this->transactionJournalMeta()->where('name', $name)->first(); - if (!is_null($entry)) { + if (null !== $entry) { $value = $entry->data; // cache: $cache->store($value); } // convert to Carbon if name is _date - if (!is_null($value) && substr($name, -5) === '_date') { + if (null !== $value && '_date' === substr($name, -5)) { $value = new Carbon($value); // cache: $cache->store($value); @@ -216,7 +212,7 @@ class TransactionJournal extends Model */ public function hasMeta(string $name): bool { - return !is_null($this->getMeta($name)); + return null !== $this->getMeta($name); } /** @@ -224,47 +220,44 @@ class TransactionJournal extends Model */ public function isDeposit(): bool { - if (!is_null($this->transaction_type_type)) { - return $this->transaction_type_type === TransactionType::DEPOSIT; + if (null !== $this->transaction_type_type) { + return TransactionType::DEPOSIT === $this->transaction_type_type; } return $this->transactionType->isDeposit(); } /** - * * @return bool */ public function isOpeningBalance(): bool { - if (!is_null($this->transaction_type_type)) { - return $this->transaction_type_type === TransactionType::OPENING_BALANCE; + if (null !== $this->transaction_type_type) { + return TransactionType::OPENING_BALANCE === $this->transaction_type_type; } return $this->transactionType->isOpeningBalance(); } /** - * * @return bool */ public function isTransfer(): bool { - if (!is_null($this->transaction_type_type)) { - return $this->transaction_type_type === TransactionType::TRANSFER; + if (null !== $this->transaction_type_type) { + return TransactionType::TRANSFER === $this->transaction_type_type; } return $this->transactionType->isTransfer(); } /** - * * @return bool */ public function isWithdrawal(): bool { - if (!is_null($this->transaction_type_type)) { - return $this->transaction_type_type === TransactionType::WITHDRAWAL; + if (null !== $this->transaction_type_type) { + return TransactionType::WITHDRAWAL === $this->transaction_type_type; } return $this->transactionType->isWithdrawal(); @@ -289,7 +282,7 @@ class TransactionJournal extends Model /** * Save the model to the database. * - * @param array $options + * @param array $options * * @return bool */ @@ -302,7 +295,6 @@ class TransactionJournal extends Model } /** - * * @param EloquentBuilder $query * @param Carbon $date * @@ -314,7 +306,6 @@ class TransactionJournal extends Model } /** - * * @param EloquentBuilder $query * @param Carbon $date * @@ -333,17 +324,14 @@ class TransactionJournal extends Model $query->orderBy('transaction_journals.date', 'DESC'); $query->orderBy('transaction_journals.order', 'ASC'); $query->orderBy('transaction_journals.id', 'DESC'); - } /** - * * @param EloquentBuilder $query * @param array $types */ public function scopeTransactionTypes(EloquentBuilder $query, array $types) { - if (!self::isJoined($query, 'transaction_types')) { $query->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id'); } @@ -353,7 +341,6 @@ class TransactionJournal extends Model } /** - * * @param $value */ public function setDescriptionAttribute($value) @@ -371,12 +358,14 @@ class TransactionJournal extends Model */ public function setMeta(string $name, $value): TransactionJournalMeta { - if (is_null($value)) { + if (null === $value) { $this->deleteMeta($name); return new TransactionJournalMeta(); } - if (is_string($value) && strlen($value) === 0) { + if (is_string($value) && 0 === strlen($value)) { + $this->deleteMeta($name); + return new TransactionJournalMeta(); } @@ -386,7 +375,7 @@ class TransactionJournal extends Model Log::debug(sprintf('Going to set "%s" with value "%s"', $name, json_encode($value))); $entry = $this->transactionJournalMeta()->where('name', $name)->first(); - if (is_null($entry)) { + if (null === $entry) { $entry = new TransactionJournalMeta(); $entry->transactionJournal()->associate($this); $entry->name = $name; @@ -453,5 +442,4 @@ class TransactionJournal extends Model { return $this->belongsTo('FireflyIII\User'); } - } diff --git a/app/Models/TransactionJournalLink.php b/app/Models/TransactionJournalLink.php index 1289e82b3a..c3a001f556 100644 --- a/app/Models/TransactionJournalLink.php +++ b/app/Models/TransactionJournalLink.php @@ -18,21 +18,17 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; - use Crypt; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** - * Class TransactionJournalLink - * - * @package FireflyIII\Models + * Class TransactionJournalLink. */ class TransactionJournalLink extends Model { @@ -42,6 +38,7 @@ class TransactionJournalLink extends Model * @param $value * * @return mixed + * * @throws NotFoundHttpException */ public static function routeBinder($value) @@ -53,7 +50,7 @@ class TransactionJournalLink extends Model ->where('t_a.user_id', auth()->user()->id) ->where('t_b.user_id', auth()->user()->id) ->first(['journal_links.*']); - if (!is_null($model)) { + if (null !== $model) { return $model; } } @@ -75,7 +72,7 @@ class TransactionJournalLink extends Model */ public function getCommentAttribute($value): ?string { - if (!is_null($value)) { + if (null !== $value) { return Crypt::decrypt($value); } @@ -91,12 +88,11 @@ class TransactionJournalLink extends Model } /** - * * @param $value */ public function setCommentAttribute($value): void { - if (!is_null($value) && strlen($value) > 0) { + if (null !== $value && strlen($value) > 0) { $this->attributes['comment'] = Crypt::encrypt($value); return; @@ -111,6 +107,4 @@ class TransactionJournalLink extends Model { return $this->belongsTo(TransactionJournal::class, 'source_id'); } - - } diff --git a/app/Models/TransactionJournalMeta.php b/app/Models/TransactionJournalMeta.php index 11a23eff31..8a93df7870 100644 --- a/app/Models/TransactionJournalMeta.php +++ b/app/Models/TransactionJournalMeta.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -28,13 +27,10 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; /** - * Class TransactionJournalMeta - * - * @package FireflyIII\Models + * Class TransactionJournalMeta. */ class TransactionJournalMeta extends Model { - use SoftDeletes; /** * The attributes that should be casted to native types. @@ -42,14 +38,15 @@ class TransactionJournalMeta extends Model * @var array */ protected $casts - = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + = [ + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', ]; - protected $dates = ['created_at', 'updated_at', 'deleted_at']; + /** @var array */ protected $fillable = ['transaction_journal_id', 'name', 'data', 'hash']; - protected $table = 'journal_meta'; + /** @var string */ + protected $table = 'journal_meta'; /** * @param $value @@ -72,7 +69,6 @@ class TransactionJournalMeta extends Model } /** - * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function transactionJournal(): BelongsTo diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php index a7ebd80beb..f8c5274226 100644 --- a/app/Models/TransactionType.php +++ b/app/Models/TransactionType.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Models; @@ -28,9 +27,7 @@ use Illuminate\Database\Eloquent\SoftDeletes; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** - * Class TransactionType - * - * @package FireflyIII\Models + * Class TransactionType. */ class TransactionType extends Model { @@ -40,7 +37,7 @@ class TransactionType extends Model const DEPOSIT = 'Deposit'; const TRANSFER = 'Transfer'; const OPENING_BALANCE = 'Opening balance'; - + const RECONCILIATION = 'Reconciliation'; /** * The attributes that should be casted to native types. * @@ -48,12 +45,12 @@ class TransactionType extends Model */ protected $casts = [ - 'created_at' => 'date', - 'updated_at' => 'date', - 'deleted_at' => 'date', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', ]; - - protected $dates = ['created_at', 'updated_at', 'deleted_at']; + /** @var array */ + protected $fillable = ['type']; /** * @param string $type @@ -63,23 +60,21 @@ class TransactionType extends Model public static function routeBinder(string $type) { if (!auth()->check()) { - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } $transactionType = self::where('type', ucfirst($type))->first(); - if (!is_null($transactionType)) { + if (null !== $transactionType) { return $transactionType; } - throw new NotFoundHttpException; - + throw new NotFoundHttpException(); } - /** * @return bool */ public function isDeposit() { - return $this->type === self::DEPOSIT; + return self::DEPOSIT === $this->type; } /** @@ -87,7 +82,7 @@ class TransactionType extends Model */ public function isOpeningBalance() { - return $this->type === self::OPENING_BALANCE; + return self::OPENING_BALANCE === $this->type; } /** @@ -95,7 +90,7 @@ class TransactionType extends Model */ public function isTransfer() { - return $this->type === self::TRANSFER; + return self::TRANSFER === $this->type; } /** @@ -103,11 +98,10 @@ class TransactionType extends Model */ public function isWithdrawal() { - return $this->type === self::WITHDRAWAL; + return self::WITHDRAWAL === $this->type; } /** - * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function transactionJournals() diff --git a/app/Providers/AccountServiceProvider.php b/app/Providers/AccountServiceProvider.php index 946dc65fd3..7f041d1902 100644 --- a/app/Providers/AccountServiceProvider.php +++ b/app/Providers/AccountServiceProvider.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII\Providers; use FireflyIII\Repositories\Account\AccountRepository; @@ -32,26 +30,19 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class AccountServiceProvider - * - * @package FireflyIII\Providers + * Class AccountServiceProvider. */ class AccountServiceProvider extends ServiceProvider { /** * Bootstrap the application services. - * - * @return void */ public function boot() { - // } /** * Register the application services. - * - * @return void */ public function register() { @@ -60,7 +51,7 @@ class AccountServiceProvider extends ServiceProvider } /** - * + * Register account repository */ private function registerRepository() { @@ -80,7 +71,7 @@ class AccountServiceProvider extends ServiceProvider } /** - * + * Register the tasker. */ private function registerTasker() { diff --git a/app/Providers/AdminServiceProvider.php b/app/Providers/AdminServiceProvider.php index 8bfc96491d..81a71c9765 100644 --- a/app/Providers/AdminServiceProvider.php +++ b/app/Providers/AdminServiceProvider.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Providers; @@ -28,24 +27,20 @@ use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; - +/** + * Class AdminServiceProvider + */ class AdminServiceProvider extends ServiceProvider { /** * Bootstrap the application services. - * - * @return void */ public function boot() { - - } /** * Register the application services. - * - * @return void */ public function register() { @@ -53,7 +48,7 @@ class AdminServiceProvider extends ServiceProvider } /** - * + * Register link type repository */ private function linkType() { @@ -70,5 +65,4 @@ class AdminServiceProvider extends ServiceProvider } ); } - } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 7d8752abe6..a0af9c7ee7 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Providers; @@ -27,16 +26,12 @@ use Illuminate\Support\Facades\Schema; use Illuminate\Support\ServiceProvider; /** - * Class AppServiceProvider - * - * @package FireflyIII\Providers + * Class AppServiceProvider. */ class AppServiceProvider extends ServiceProvider { /** * Bootstrap any application services. - * - * @return void */ public function boot() { @@ -45,8 +40,6 @@ class AppServiceProvider extends ServiceProvider /** * Register any application services. - * - * @return void */ public function register() { diff --git a/app/Providers/AttachmentServiceProvider.php b/app/Providers/AttachmentServiceProvider.php index a00ae75d42..4725f7cb0d 100644 --- a/app/Providers/AttachmentServiceProvider.php +++ b/app/Providers/AttachmentServiceProvider.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII\Providers; use FireflyIII\Repositories\Attachment\AttachmentRepository; @@ -30,26 +28,19 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class AttachmentServiceProvider - * - * @package FireflyIII\Providers + * Class AttachmentServiceProvider. */ class AttachmentServiceProvider extends ServiceProvider { /** * Bootstrap the application services. - * - * @return void */ public function boot() { - // } /** * Register the application services. - * - * @return void */ public function register() { diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index d03e8bc6de..b70d194202 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - /** * AuthServiceProvider.php * Copyright (c) 2017 thegrumpydictator@gmail.com @@ -35,6 +33,9 @@ namespace FireflyIII\Providers; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; +/** + * Class AuthServiceProvider + */ class AuthServiceProvider extends ServiceProvider { /** @@ -49,13 +50,9 @@ class AuthServiceProvider extends ServiceProvider /** * Register any authentication / authorization services. - * - * @return void */ public function boot() { $this->registerPolicies(); - - // } } diff --git a/app/Providers/BillServiceProvider.php b/app/Providers/BillServiceProvider.php index dea438c324..f0377d8ca8 100644 --- a/app/Providers/BillServiceProvider.php +++ b/app/Providers/BillServiceProvider.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII\Providers; use FireflyIII\Repositories\Bill\BillRepository; @@ -30,26 +28,19 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class BillServiceProvider - * - * @package FireflyIII\Providers + * Class BillServiceProvider. */ class BillServiceProvider extends ServiceProvider { /** * Bootstrap the application services. - * - * @return void */ public function boot() { - // } /** * Register the application services. - * - * @return void */ public function register() { diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index 64725f48ae..0d6648fe02 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - /** * BroadcastServiceProvider.php * Copyright (c) 2017 thegrumpydictator@gmail.com @@ -36,12 +34,13 @@ namespace FireflyIII\Providers; use Illuminate\Support\Facades\Broadcast; use Illuminate\Support\ServiceProvider; +/** + * Class BroadcastServiceProvider + */ class BroadcastServiceProvider extends ServiceProvider { /** * Bootstrap any application services. - * - * @return void */ public function boot() { diff --git a/app/Providers/BudgetServiceProvider.php b/app/Providers/BudgetServiceProvider.php index 2818cc89e7..49fd527457 100644 --- a/app/Providers/BudgetServiceProvider.php +++ b/app/Providers/BudgetServiceProvider.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII\Providers; use FireflyIII\Repositories\Budget\BudgetRepository; @@ -30,26 +28,19 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class BudgetServiceProvider - * - * @package FireflyIII\Providers + * Class BudgetServiceProvider. */ class BudgetServiceProvider extends ServiceProvider { /** * Bootstrap the application services. - * - * @return void */ public function boot() { - // } /** * Register the application services. - * - * @return void */ public function register() { diff --git a/app/Providers/CategoryServiceProvider.php b/app/Providers/CategoryServiceProvider.php index b945f3dd56..2be853ccf0 100644 --- a/app/Providers/CategoryServiceProvider.php +++ b/app/Providers/CategoryServiceProvider.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII\Providers; use FireflyIII\Repositories\Category\CategoryRepository; @@ -30,26 +28,19 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class CategoryServiceProvider - * - * @package FireflyIII\Providers + * Class CategoryServiceProvider. */ class CategoryServiceProvider extends ServiceProvider { /** * Bootstrap the application services. - * - * @return void */ public function boot() { - // } /** * Register the application services. - * - * @return void */ public function register() { @@ -65,6 +56,5 @@ class CategoryServiceProvider extends ServiceProvider return $repository; } ); - } } diff --git a/app/Providers/CurrencyServiceProvider.php b/app/Providers/CurrencyServiceProvider.php index 2f63de16b5..76a41f6f98 100644 --- a/app/Providers/CurrencyServiceProvider.php +++ b/app/Providers/CurrencyServiceProvider.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII\Providers; use FireflyIII\Repositories\Currency\CurrencyRepository; @@ -30,26 +28,19 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class CurrencyServiceProvider - * - * @package FireflyIII\Providers + * Class CurrencyServiceProvider. */ class CurrencyServiceProvider extends ServiceProvider { /** * Bootstrap the application services. - * - * @return void */ public function boot() { - // } /** * Register the application services. - * - * @return void */ public function register() { @@ -66,5 +57,4 @@ class CurrencyServiceProvider extends ServiceProvider } ); } - } diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 110ba077af..3f415111e2 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Providers; @@ -33,9 +32,7 @@ use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvi use Log; /** - * Class EventServiceProvider - * - * @package FireflyIII\Providers + * Class EventServiceProvider. */ class EventServiceProvider extends ServiceProvider { @@ -47,11 +44,10 @@ class EventServiceProvider extends ServiceProvider protected $listen = [ // is a User related event. - 'FireflyIII\Events\RegisteredUser' => - [ - 'FireflyIII\Handlers\Events\UserEventHandler@sendRegistrationMail', - 'FireflyIII\Handlers\Events\UserEventHandler@attachUserRole', - ], + 'FireflyIII\Events\RegisteredUser' => [ + 'FireflyIII\Handlers\Events\UserEventHandler@sendRegistrationMail', + 'FireflyIII\Handlers\Events\UserEventHandler@attachUserRole', + ], // is a User related event. 'FireflyIII\Events\RequestedNewPassword' => [ 'FireflyIII\Handlers\Events\UserEventHandler@sendNewPassword', @@ -66,25 +62,20 @@ class EventServiceProvider extends ServiceProvider 'FireflyIII\Handlers\Events\AdminEventHandler@sendTestMessage', ], // is a Transaction Journal related event. - 'FireflyIII\Events\StoredTransactionJournal' => - [ - 'FireflyIII\Handlers\Events\StoredJournalEventHandler@scanBills', - 'FireflyIII\Handlers\Events\StoredJournalEventHandler@connectToPiggyBank', - 'FireflyIII\Handlers\Events\StoredJournalEventHandler@processRules', - ], + 'FireflyIII\Events\StoredTransactionJournal' => [ + 'FireflyIII\Handlers\Events\StoredJournalEventHandler@scanBills', + 'FireflyIII\Handlers\Events\StoredJournalEventHandler@connectToPiggyBank', + 'FireflyIII\Handlers\Events\StoredJournalEventHandler@processRules', + ], // is a Transaction Journal related event. - 'FireflyIII\Events\UpdatedTransactionJournal' => - [ - 'FireflyIII\Handlers\Events\UpdatedJournalEventHandler@scanBills', - 'FireflyIII\Handlers\Events\UpdatedJournalEventHandler@processRules', - ], - + 'FireflyIII\Events\UpdatedTransactionJournal' => [ + 'FireflyIII\Handlers\Events\UpdatedJournalEventHandler@scanBills', + 'FireflyIII\Handlers\Events\UpdatedJournalEventHandler@processRules', + ], ]; /** * Register any events for your application. - * - * @return void */ public function boot() { @@ -98,15 +89,14 @@ class EventServiceProvider extends ServiceProvider */ protected function registerCreateEvents() { - // move this routine to a filter // in case of repeated piggy banks and/or other problems. PiggyBank::created( function (PiggyBank $piggyBank) { $repetition = new PiggyBankRepetition; $repetition->piggyBank()->associate($piggyBank); - $repetition->startdate = is_null($piggyBank->startdate) ? null : $piggyBank->startdate; - $repetition->targetdate = is_null($piggyBank->targetdate) ? null : $piggyBank->targetdate; + $repetition->startdate = null === $piggyBank->startdate ? null : $piggyBank->startdate; + $repetition->targetdate = null === $piggyBank->targetdate ? null : $piggyBank->targetdate; $repetition->currentamount = 0; $repetition->save(); } @@ -125,7 +115,7 @@ class EventServiceProvider extends ServiceProvider foreach ($account->transactions()->get() as $transaction) { Log::debug('Now at transaction #' . $transaction->id); $journal = $transaction->transactionJournal()->first(); - if (!is_null($journal)) { + if (null !== $journal) { Log::debug('Call for deletion of journal #' . $journal->id); $journal->delete(); } @@ -152,7 +142,5 @@ class EventServiceProvider extends ServiceProvider } } ); - } - } diff --git a/app/Providers/ExportJobServiceProvider.php b/app/Providers/ExportJobServiceProvider.php index c7f6b38a6d..143d8daf07 100644 --- a/app/Providers/ExportJobServiceProvider.php +++ b/app/Providers/ExportJobServiceProvider.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII\Providers; use FireflyIII\Repositories\ExportJob\ExportJobRepository; @@ -31,29 +29,20 @@ use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; - /** - * Class ExportJobServiceProvider - * - * @package FireflyIII\Providers + * Class ExportJobServiceProvider. */ class ExportJobServiceProvider extends ServiceProvider { /** * Bootstrap the application services. - * - * @return void */ public function boot() { - - } /** * Register the application services. - * - * @return void */ public function register() { diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php index d43a129fa0..398c45bd4a 100644 --- a/app/Providers/FireflyServiceProvider.php +++ b/app/Providers/FireflyServiceProvider.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Providers; @@ -56,6 +55,8 @@ use FireflyIII\Support\Steam; use FireflyIII\Support\Twig\AmountFormat; use FireflyIII\Support\Twig\General; use FireflyIII\Support\Twig\Journal; +use FireflyIII\Support\Twig\Loader\TransactionJournalLoader; +use FireflyIII\Support\Twig\Loader\TransactionLoader; use FireflyIII\Support\Twig\PiggyBank; use FireflyIII\Support\Twig\Rule; use FireflyIII\Support\Twig\Transaction; @@ -68,9 +69,7 @@ use TwigBridge\Extension\Loader\Functions; use Validator; /** - * Class FireflyServiceProvider - * - * @package FireflyIII\Providers + * Class FireflyServiceProvider. */ class FireflyServiceProvider extends ServiceProvider { @@ -83,6 +82,8 @@ class FireflyServiceProvider extends ServiceProvider ); $config = app('config'); Twig::addExtension(new Functions($config)); + Twig::addRuntimeLoader(new TransactionLoader); + Twig::addRuntimeLoader(new TransactionJournalLoader); Twig::addExtension(new PiggyBank); Twig::addExtension(new General); Twig::addExtension(new Journal); @@ -98,36 +99,42 @@ class FireflyServiceProvider extends ServiceProvider public function register() { $this->app->bind( - 'preferences', function () { - return new Preferences; - } + 'preferences', + function () { + return new Preferences; + } ); $this->app->bind( - 'fireflyconfig', function () { - return new FireflyConfig; - } + 'fireflyconfig', + function () { + return new FireflyConfig; + } ); $this->app->bind( - 'navigation', function () { - return new Navigation; - } + 'navigation', + function () { + return new Navigation; + } ); $this->app->bind( - 'amount', function () { - return new Amount; - } + 'amount', + function () { + return new Amount; + } ); $this->app->bind( - 'steam', function () { - return new Steam; - } + 'steam', + function () { + return new Steam; + } ); $this->app->bind( - 'expandedform', function () { - return new ExpandedForm; - } + 'expandedform', + function () { + return new ExpandedForm; + } ); // chart generator: @@ -164,5 +171,4 @@ class FireflyServiceProvider extends ServiceProvider // password verifier thing $this->app->bind(Verifier::class, PwndVerifier::class); } - } diff --git a/app/Providers/FireflySessionProvider.php b/app/Providers/FireflySessionProvider.php index 4eb91f74a5..9bae19be71 100644 --- a/app/Providers/FireflySessionProvider.php +++ b/app/Providers/FireflySessionProvider.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Providers; @@ -27,12 +26,13 @@ use FireflyIII\Http\Middleware\StartFireflySession; use Illuminate\Session\SessionManager; use Illuminate\Support\ServiceProvider; +/** + * Class FireflySessionProvider + */ class FireflySessionProvider extends ServiceProvider { /** * Register the service provider. - * - * @return void */ public function register() { @@ -45,32 +45,30 @@ class FireflySessionProvider extends ServiceProvider /** * Register the session driver instance. - * - * @return void */ protected function registerSessionDriver() { $this->app->singleton( - 'session.store', function ($app) { - // First, we will create the session manager which is responsible for the - // creation of the various session drivers when they are needed by the - // application instance, and will resolve them on a lazy load basis. - return $app->make('session')->driver(); - } + 'session.store', + function ($app) { + // First, we will create the session manager which is responsible for the + // creation of the various session drivers when they are needed by the + // application instance, and will resolve them on a lazy load basis. + return $app->make('session')->driver(); + } ); } /** * Register the session manager instance. - * - * @return void */ protected function registerSessionManager() { $this->app->singleton( - 'session', function ($app) { - return new SessionManager($app); - } + 'session', + function ($app) { + return new SessionManager($app); + } ); } } diff --git a/app/Providers/JournalServiceProvider.php b/app/Providers/JournalServiceProvider.php index 262b3b56de..069b882f16 100644 --- a/app/Providers/JournalServiceProvider.php +++ b/app/Providers/JournalServiceProvider.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII\Providers; use FireflyIII\Helpers\Collector\JournalCollector; @@ -34,26 +32,19 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class JournalServiceProvider - * - * @package FireflyIII\Providers + * Class JournalServiceProvider. */ class JournalServiceProvider extends ServiceProvider { /** * Bootstrap the application services. - * - * @return void */ public function boot() { - // } /** * Register the application services. - * - * @return void */ public function register() { @@ -63,7 +54,7 @@ class JournalServiceProvider extends ServiceProvider } /** - * + * Register the collector. */ private function registerCollector() { @@ -76,14 +67,13 @@ class JournalServiceProvider extends ServiceProvider $collector->setUser(auth()->user()); } - return $collector; } ); } /** - * + * Register repository. */ private function registerRepository() { @@ -93,7 +83,6 @@ class JournalServiceProvider extends ServiceProvider /** @var JournalRepositoryInterface $repository */ $repository = app(JournalRepository::class); if ($app->auth->check()) { - $repository->setUser(auth()->user()); } @@ -103,7 +92,7 @@ class JournalServiceProvider extends ServiceProvider } /** - * + * Register the tasker. */ private function registerTasker() { @@ -121,5 +110,4 @@ class JournalServiceProvider extends ServiceProvider } ); } - } diff --git a/app/Providers/LogServiceProvider.php b/app/Providers/LogServiceProvider.php index 63243e409f..bdfb6cc6bb 100644 --- a/app/Providers/LogServiceProvider.php +++ b/app/Providers/LogServiceProvider.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Providers; @@ -27,23 +26,20 @@ use Illuminate\Log\LogServiceProvider as LaravelLogServiceProvider; use Illuminate\Log\Writer; /** - * Class LogServiceProvider - * - * @package FireflyIII\Providers + * Class LogServiceProvider. */ class LogServiceProvider extends LaravelLogServiceProvider { /** * Configure the Monolog handlers for the application. * - * @param \Illuminate\Log\Writer $log - * - * @return void + * @param \Illuminate\Log\Writer $log */ protected function configureDailyHandler(Writer $log) { $log->useDailyFiles( - $this->app->storagePath() . '/logs/firefly-iii.log', $this->maxFiles(), + $this->app->storagePath() . '/logs/firefly-iii.log', + $this->maxFiles(), $this->logLevel() ); } @@ -51,9 +47,7 @@ class LogServiceProvider extends LaravelLogServiceProvider /** * Configure the Monolog handlers for the application. * - * @param \Illuminate\Log\Writer $log - * - * @return void + * @param \Illuminate\Log\Writer $log */ protected function configureSingleHandler(Writer $log) { diff --git a/app/Providers/PiggyBankServiceProvider.php b/app/Providers/PiggyBankServiceProvider.php index 94dbe53dc8..2655f5b522 100644 --- a/app/Providers/PiggyBankServiceProvider.php +++ b/app/Providers/PiggyBankServiceProvider.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII\Providers; use FireflyIII\Repositories\PiggyBank\PiggyBankRepository; @@ -29,28 +27,20 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; - /** - * Class PiggyBankServiceProvider - * - * @package FireflyIII\Providers + * Class PiggyBankServiceProvider. */ class PiggyBankServiceProvider extends ServiceProvider { /** * Bootstrap the application services. - * - * @return void */ public function boot() { - // } /** * Register the application services. - * - * @return void */ public function register() { diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index a12f9ef45e..1be7d7c064 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - /** * RouteServiceProvider.php * Copyright (c) 2017 thegrumpydictator@gmail.com @@ -49,36 +47,26 @@ class RouteServiceProvider extends ServiceProvider /** * Define your route model bindings, pattern filters, etc. - * - * @return void */ public function boot() { - // - parent::boot(); } /** * Define the routes for the application. - * - * @return void */ public function map() { $this->mapApiRoutes(); $this->mapWebRoutes(); - - // } /** * Define the "api" routes for the application. * * These routes are typically stateless. - * - * @return void */ protected function mapApiRoutes() { @@ -92,8 +80,6 @@ class RouteServiceProvider extends ServiceProvider * Define the "web" routes for the application. * * These routes all receive session state, CSRF protection, etc. - * - * @return void */ protected function mapWebRoutes() { diff --git a/app/Providers/RuleGroupServiceProvider.php b/app/Providers/RuleGroupServiceProvider.php index 6a72412a5f..07c9ee2e0a 100644 --- a/app/Providers/RuleGroupServiceProvider.php +++ b/app/Providers/RuleGroupServiceProvider.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII\Providers; use FireflyIII\Repositories\RuleGroup\RuleGroupRepository; @@ -29,28 +27,20 @@ use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; - /** - * Class RuleGroupServiceProvider - * - * @package FireflyIII\Providers + * Class RuleGroupServiceProvider. */ class RuleGroupServiceProvider extends ServiceProvider { /** * Bootstrap the application services. - * - * @return void */ public function boot() { - // } /** * Register the application services. - * - * @return void */ public function register() { diff --git a/app/Providers/RuleServiceProvider.php b/app/Providers/RuleServiceProvider.php index 1af440b191..bf49190da9 100644 --- a/app/Providers/RuleServiceProvider.php +++ b/app/Providers/RuleServiceProvider.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII\Providers; use FireflyIII\Repositories\Rule\RuleRepository; @@ -30,26 +28,19 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class RuleServiceProvider - * - * @package FireflyIII\Providers + * Class RuleServiceProvider. */ class RuleServiceProvider extends ServiceProvider { /** * Bootstrap the application services. - * - * @return void */ public function boot() { - // } /** * Register the application services. - * - * @return void */ public function register() { diff --git a/app/Providers/SearchServiceProvider.php b/app/Providers/SearchServiceProvider.php index d7fa9c6ec6..97c5072950 100644 --- a/app/Providers/SearchServiceProvider.php +++ b/app/Providers/SearchServiceProvider.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII\Providers; use FireflyIII\Support\Search\Search; @@ -30,26 +28,19 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class SearchServiceProvider - * - * @package FireflyIII\Providers + * Class SearchServiceProvider. */ class SearchServiceProvider extends ServiceProvider { /** * Bootstrap the application services. - * - * @return void */ public function boot() { - // } /** * Register the application services. - * - * @return void */ public function register() { diff --git a/app/Providers/SessionServiceProvider.php b/app/Providers/SessionServiceProvider.php index b465661dca..7143eafff9 100644 --- a/app/Providers/SessionServiceProvider.php +++ b/app/Providers/SessionServiceProvider.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Providers; @@ -27,16 +26,12 @@ use FireflyIII\Http\Middleware\StartFireflySession; use Illuminate\Session\SessionServiceProvider as BaseSessionServiceProvider; /** - * Class SessionServiceProvider - * - * @package FireflyIII\Providers + * Class SessionServiceProvider. */ class SessionServiceProvider extends BaseSessionServiceProvider { /** * Register the service provider. - * - * @return void */ public function register() { @@ -46,4 +41,4 @@ class SessionServiceProvider extends BaseSessionServiceProvider $this->app->singleton(StartFireflySession::class); } -} \ No newline at end of file +} diff --git a/app/Providers/TagServiceProvider.php b/app/Providers/TagServiceProvider.php index aac1d9c1f8..acbf9e18cd 100644 --- a/app/Providers/TagServiceProvider.php +++ b/app/Providers/TagServiceProvider.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII\Providers; use FireflyIII\Repositories\Tag\TagRepository; @@ -30,26 +28,19 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class TagServiceProvider - * - * @package FireflyIII\Providers + * Class TagServiceProvider. */ class TagServiceProvider extends ServiceProvider { /** * Bootstrap the application services. - * - * @return void */ public function boot() { - // } /** * Register the application services. - * - * @return void */ public function register() { diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index 7926b18778..cb4b8f87fc 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII\Repositories\Account; use Carbon\Carbon; @@ -30,31 +28,31 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; use FireflyIII\Models\AccountMeta; use FireflyIII\Models\AccountType; +use FireflyIII\Models\Category; +use FireflyIII\Models\Tag; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; +use FireflyIII\Repositories\Tag\TagRepositoryInterface; use FireflyIII\User; use Log; use Validator; - /** - * - * Class AccountRepository - * - * @package FireflyIII\Repositories\Account + * Class AccountRepository. */ class AccountRepository implements AccountRepositoryInterface { - use FindAccountsTrait; /** @var User */ private $user; + + use FindAccountsTrait; /** @var array */ private $validFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType', 'accountNumber', 'currency_id', 'BIC']; /** - * Moved here from account CRUD + * Moved here from account CRUD. * * @param array $types * @@ -77,10 +75,10 @@ class AccountRepository implements AccountRepositoryInterface */ public function destroy(Account $account, Account $moveTo): bool { - if (!is_null($moveTo->id)) { + if (null !== $moveTo->id) { DB::table('transactions')->where('account_id', $account->id)->update(['account_id' => $moveTo->id]); } - if (!is_null($account)) { + if (null !== $account) { $account->delete(); } @@ -103,7 +101,7 @@ class AccountRepository implements AccountRepositoryInterface ->orderBy('transaction_journals.order', 'ASC') ->orderBy('transaction_journals.id', 'DESC') ->first(['transaction_journals.date']); - if (!is_null($date)) { + if (null !== $date) { $last = new Carbon($date->date); } @@ -126,7 +124,7 @@ class AccountRepository implements AccountRepositoryInterface ->where('transaction_journals.user_id', $this->user->id) ->orderBy('transaction_journals.id', 'ASC') ->first(['transaction_journals.id']); - if (!is_null($first)) { + if (null !== $first) { return TransactionJournal::find(intval($first->id)); } @@ -143,7 +141,7 @@ class AccountRepository implements AccountRepositoryInterface public function oldestJournalDate(Account $account): Carbon { $journal = $this->oldestJournal($account); - if (is_null($journal->id)) { + if (null === $journal->id) { return new Carbon; } @@ -176,7 +174,6 @@ class AccountRepository implements AccountRepositoryInterface $this->deleteInitialBalance($newAccount); return $newAccount; - } /** @@ -202,16 +199,52 @@ class AccountRepository implements AccountRepositoryInterface return $account; } + /** + * @param TransactionJournal $journal + * @param array $data + * + * @return TransactionJournal + */ + public function updateReconciliation(TransactionJournal $journal, array $data): TransactionJournal + { + // update journal + // update actual journal: + $data['amount'] = strval($data['amount']); + + // unlink all categories, recreate them: + $journal->categories()->detach(); + + $this->storeCategoryWithJournal($journal, strval($data['category'])); + + // update amounts + /** @var Transaction $transaction */ + foreach ($journal->transactions as $transaction) { + $transaction->amount = bcmul($data['amount'], '-1'); + if ($transaction->account->accountType->type === AccountType::ASSET) { + $transaction->amount = $data['amount']; + } + $transaction->save(); + } + + $journal->save(); + + // update tags: + if (isset($data['tags']) && is_array($data['tags'])) { + $this->updateTags($journal, $data['tags']); + } + + return $journal; + } + /** * @param Account $account */ protected function deleteInitialBalance(Account $account) { $journal = $this->openingBalanceTransaction($account); - if (!is_null($journal->id)) { + if (null !== $journal->id) { $journal->delete(); } - } /** @@ -225,7 +258,7 @@ class AccountRepository implements AccountRepositoryInterface ->where('transactions.account_id', $account->id) ->transactionTypes([TransactionType::OPENING_BALANCE]) ->first(['transaction_journals.*']); - if (is_null($journal)) { + if (null === $journal) { Log::debug('Could not find a opening balance journal, return empty one.'); return new TransactionJournal; @@ -239,6 +272,7 @@ class AccountRepository implements AccountRepositoryInterface * @param array $data * * @return Account + * * @throws FireflyException */ protected function storeAccount(array $data): Account @@ -248,13 +282,13 @@ class AccountRepository implements AccountRepositoryInterface $accountType = AccountType::whereType($type)->first(); $data['iban'] = $this->filterIban($data['iban']); // verify account type - if (is_null($accountType)) { + if (null === $accountType) { throw new FireflyException(sprintf('Account type "%s" is invalid. Cannot create account.', $data['accountType'])); } // account may exist already: $existingAccount = $this->findByName($data['name'], [$type]); - if (!is_null($existingAccount->id)) { + if (null !== $existingAccount->id) { Log::warning(sprintf('There already is an account named "%s" of type "%s".', $data['name'], $type)); return $existingAccount; @@ -267,25 +301,37 @@ class AccountRepository implements AccountRepositoryInterface 'account_type_id' => $accountType->id, 'name' => $data['name'], 'virtual_balance' => $data['virtualBalance'], - 'active' => $data['active'] === true ? true : false, + 'active' => true === $data['active'] ? true : false, 'iban' => $data['iban'], ]; $newAccount = new Account($databaseData); Log::debug('Final account creation dataset', $databaseData); $newAccount->save(); // verify its creation: - if (is_null($newAccount->id)) { + if (null === $newAccount->id) { Log::error( - sprintf('Could not create account "%s" (%d error(s))', $data['name'], $newAccount->getErrors()->count()), $newAccount->getErrors()->toArray() + sprintf('Could not create account "%s" (%d error(s))', $data['name'], $newAccount->getErrors()->count()), + $newAccount->getErrors()->toArray() ); throw new FireflyException(sprintf('Tried to create account named "%s" but failed. The logs have more details.', $data['name'])); - } Log::debug(sprintf('Created new account #%d named "%s" of type %s.', $newAccount->id, $newAccount->name, $accountType->type)); return $newAccount; } + /** + * @param TransactionJournal $journal + * @param string $category + */ + protected function storeCategoryWithJournal(TransactionJournal $journal, string $category) + { + if (strlen($category) > 0) { + $category = Category::firstOrCreateEncrypted(['name' => $category, 'user_id' => $journal->user_id]); + $journal->categories()->save($category); + } + } + /** * At this point strlen of amount > 0. * @@ -297,9 +343,9 @@ class AccountRepository implements AccountRepositoryInterface protected function storeInitialBalance(Account $account, array $data): TransactionJournal { $amount = strval($data['openingBalance']); - Log::debug(sprintf('Submitted amount is %s',$amount)); + Log::debug(sprintf('Submitted amount is %s', $amount)); - if (bccomp($amount, '0') === 0) { + if (0 === bccomp($amount, '0')) { return new TransactionJournal; } @@ -326,7 +372,7 @@ class AccountRepository implements AccountRepositoryInterface $secondAmount = bcmul($amount, '-1'); Log::debug(sprintf('First amount is %s, second amount is %s', $firstAmount, $secondAmount)); - if (bccomp($amount,'0') === -1) { + if (bccomp($amount, '0') === -1) { Log::debug(sprintf('%s is a negative number.', $amount)); $firstAccount = $opposing; $secondAccount = $account; @@ -343,7 +389,7 @@ class AccountRepository implements AccountRepositoryInterface 'transaction_currency_id' => $currencyId, ] ); - $one->save();// first transaction: from + $one->save(); // first transaction: from $two = new Transaction( [ @@ -379,7 +425,6 @@ class AccountRepository implements AccountRepositoryInterface } /** - * * @param Account $account * @param array $data * @@ -391,14 +436,14 @@ class AccountRepository implements AccountRepositoryInterface $openingBalance = $this->openingBalanceTransaction($account); // no opening balance journal? create it: - if (is_null($openingBalance->id)) { + if (null === $openingBalance->id) { Log::debug('No opening balance journal yet, create journal.'); $this->storeInitialBalance($account, $data); return true; } // opening balance data? update it! - if (!is_null($openingBalance->id)) { + if (null !== $openingBalance->id) { Log::debug('Opening balance journal found, update journal.'); $this->updateOpeningBalanceJournal($account, $openingBalance, $data); @@ -411,7 +456,6 @@ class AccountRepository implements AccountRepositoryInterface /** * @param Account $account * @param array $data - * */ protected function updateMetadata(Account $account, array $data) { @@ -420,11 +464,14 @@ class AccountRepository implements AccountRepositoryInterface $entry = $account->accountMeta()->where('name', $field)->first(); // if $data has field and $entry is null, create new one: - if (isset($data[$field]) && is_null($entry)) { + if (isset($data[$field]) && null === $entry) { Log::debug( sprintf( 'Created meta-field "%s":"%s" for account #%d ("%s") ', - $field, $data[$field], $account->id, $account->name + $field, + $data[$field], + $account->id, + $account->name ) ); AccountMeta::create( @@ -437,18 +484,20 @@ class AccountRepository implements AccountRepositoryInterface } // if $data has field and $entry is not null, update $entry: - if (isset($data[$field]) && !is_null($entry)) { + if (isset($data[$field]) && null !== $entry) { $entry->data = $data[$field]; $entry->save(); Log::debug( sprintf( 'Updated meta-field "%s":"%s" for account #%d ("%s") ', - $field, $data[$field], $account->id, $account->name + $field, + $data[$field], + $account->id, + $account->name ) ); } } - } /** @@ -466,7 +515,7 @@ class AccountRepository implements AccountRepositoryInterface Log::debug(sprintf('Submitted amount for opening balance to update is %s', $amount)); - if (bccomp($amount, '0') === 0) { + if (0 === bccomp($amount, '0')) { $journal->delete(); return true; @@ -496,9 +545,49 @@ class AccountRepository implements AccountRepositoryInterface Log::debug('Updated opening balance journal.'); return true; - } + /** + * @param TransactionJournal $journal + * @param array $array + * + * @return bool + */ + protected function updateTags(TransactionJournal $journal, array $array): bool + { + // create tag repository + /** @var TagRepositoryInterface $tagRepository */ + $tagRepository = app(TagRepositoryInterface::class); + + // find or create all tags: + $tags = []; + $ids = []; + foreach ($array as $name) { + if (strlen(trim($name)) > 0) { + $tag = Tag::firstOrCreateEncrypted(['tag' => $name, 'user_id' => $journal->user_id]); + $tags[] = $tag; + $ids[] = $tag->id; + } + } + + // delete all tags connected to journal not in this array: + if (count($ids) > 0) { + DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->whereNotIn('tag_id', $ids)->delete(); + } + // if count is zero, delete them all: + if (0 === count($ids)) { + DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->delete(); + } + + // connect each tag to journal (if not yet connected): + /** @var Tag $tag */ + foreach ($tags as $tag) { + Log::debug(sprintf('Will try to connect tag #%d to journal #%d.', $tag->id, $journal->id)); + $tagRepository->connect($journal, $tag); + } + + return true; + } /** * @param array $data @@ -508,8 +597,8 @@ class AccountRepository implements AccountRepositoryInterface protected function validOpeningBalanceData(array $data): bool { $data['openingBalance'] = strval($data['openingBalance'] ?? ''); - if (isset($data['openingBalance']) && !is_null($data['openingBalance']) && strlen($data['openingBalance']) > 0 && - isset($data['openingBalanceDate'])) { + if (isset($data['openingBalance']) && null !== $data['openingBalance'] && strlen($data['openingBalance']) > 0 + && isset($data['openingBalanceDate'])) { Log::debug('Array has valid opening balance data.'); return true; @@ -526,7 +615,7 @@ class AccountRepository implements AccountRepositoryInterface */ private function filterIban(?string $iban) { - if (is_null($iban)) { + if (null === $iban) { return null; } $data = ['iban' => $iban]; diff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.php index aaaffe11d2..c05fb8243f 100644 --- a/app/Repositories/Account/AccountRepositoryInterface.php +++ b/app/Repositories/Account/AccountRepositoryInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Account; @@ -30,9 +29,7 @@ use FireflyIII\User; use Illuminate\Support\Collection; /** - * Interface AccountRepositoryInterface - * - * @package FireflyIII\Repositories\Account + * Interface AccountRepositoryInterface. */ interface AccountRepositoryInterface { @@ -113,6 +110,15 @@ interface AccountRepositoryInterface */ public function getCashAccount(): Account; + /** + * Find or create the opposing reconciliation account. + * + * @param Account $account + * + * @return Account|null + */ + public function getReconciliation(Account $account): ?Account; + /** * Returns the date of the very last transaction in this account. * @@ -160,4 +166,11 @@ interface AccountRepositoryInterface */ public function update(Account $account, array $data): Account; + /** + * @param TransactionJournal $journal + * @param array $data + * + * @return TransactionJournal + */ + public function updateReconciliation(TransactionJournal $journal, array $data): TransactionJournal; } diff --git a/app/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.php index 292ed3f030..04b5c18f84 100644 --- a/app/Repositories/Account/AccountTasker.php +++ b/app/Repositories/Account/AccountTasker.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Account; @@ -33,9 +32,7 @@ use Log; use Steam; /** - * Class AccountTasker - * - * @package FireflyIII\Repositories\Account + * Class AccountTasker. */ class AccountTasker implements AccountTaskerInterface { @@ -83,7 +80,7 @@ class AccountTasker implements AccountTaskerInterface $entry['end_balance'] = $endSet[$account->id] ?? '0'; // first journal exists, and is on start, then this is the actual opening balance: - if (!is_null($first->id) && $first->date->isSameDay($start)) { + if (null !== $first->id && $first->date->isSameDay($start)) { Log::debug(sprintf('Date of first journal for %s is %s', $account->name, $first->date->format('Y-m-d'))); $entry['start_balance'] = $first->transactions()->where('account_id', $account->id)->first()->amount; Log::debug(sprintf('Account %s was opened on %s, so opening balance is %f', $account->name, $start->format('Y-m-d'), $entry['start_balance'])); @@ -162,7 +159,7 @@ class AccountTasker implements AccountTaskerInterface $transactions = $transactions->filter( function (Transaction $transaction) { // return positive amounts only. - if (bccomp($transaction->transaction_amount, '0') === 1) { + if (1 === bccomp($transaction->transaction_amount, '0')) { return $transaction; } @@ -213,7 +210,7 @@ class AccountTasker implements AccountTaskerInterface ]; } $expenses[$opposingId]['sum'] = bcadd($expenses[$opposingId]['sum'], $transaction->transaction_amount); - $expenses[$opposingId]['count']++; + ++$expenses[$opposingId]['count']; } // do averages: $keys = array_keys($expenses); @@ -223,7 +220,6 @@ class AccountTasker implements AccountTaskerInterface } } - return $expenses; } } diff --git a/app/Repositories/Account/AccountTaskerInterface.php b/app/Repositories/Account/AccountTaskerInterface.php index a978f1a69e..3e3f022a68 100644 --- a/app/Repositories/Account/AccountTaskerInterface.php +++ b/app/Repositories/Account/AccountTaskerInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Account; @@ -28,9 +27,7 @@ use FireflyIII\User; use Illuminate\Support\Collection; /** - * Interface AccountTaskerInterface - * - * @package FireflyIII\Repositories\Account + * Interface AccountTaskerInterface. */ interface AccountTaskerInterface { @@ -65,5 +62,4 @@ interface AccountTaskerInterface * @param User $user */ public function setUser(User $user); - } diff --git a/app/Repositories/Account/FindAccountsTrait.php b/app/Repositories/Account/FindAccountsTrait.php index a674a25a12..42ed53b3ce 100644 --- a/app/Repositories/Account/FindAccountsTrait.php +++ b/app/Repositories/Account/FindAccountsTrait.php @@ -18,11 +18,11 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Account; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; use FireflyIII\Models\AccountType; use FireflyIII\User; @@ -34,8 +34,6 @@ use Log; * @property User $user * * Trait FindAccountsTrait - * - * @package FireflyIII\Repositories\Account */ trait FindAccountsTrait { @@ -47,7 +45,7 @@ trait FindAccountsTrait public function find(int $accountId): Account { $account = $this->user->accounts()->find($accountId); - if (is_null($account)) { + if (null === $account) { return new Account; } @@ -120,7 +118,6 @@ trait FindAccountsTrait if (count($types) > 0) { $query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id'); $query->whereIn('account_types.type', $types); - } Log::debug(sprintf('Searching for account named "%s" (of user #%d) of the following type(s)', $name, $this->user->id), ['types' => $types]); @@ -226,4 +223,45 @@ trait FindAccountsTrait return $account; } + + /** + * @param Account $account + * + * @return Account|null + * + * @throws FireflyException + */ + public function getReconciliation(Account $account): ?Account + { + if (AccountType::ASSET !== $account->accountType->type) { + throw new FireflyException(sprintf('%s is not an asset account.', $account->name)); + } + $name = $account->name . ' reconciliation'; + $type = AccountType::where('type', AccountType::RECONCILIATION)->first(); + $accounts = $this->user->accounts()->where('account_type_id', $type->id)->get(); + /** @var Account $account */ + foreach ($accounts as $account) { + if ($account->name === $name) { + return $account; + } + } + // assume nothing was found. create it! + $data = [ + 'accountType' => 'reconcile', + 'name' => $name, + 'iban' => null, + 'virtualBalance' => null, + 'active' => true, + ]; + $account = $this->storeAccount($data); + + return $account; + } + + /** + * @param array $data + * + * @return Account + */ + abstract protected function storeAccount(array $data): Account; } diff --git a/app/Repositories/Attachment/AttachmentRepository.php b/app/Repositories/Attachment/AttachmentRepository.php index ee5b8dd6c0..a0e62e508e 100644 --- a/app/Repositories/Attachment/AttachmentRepository.php +++ b/app/Repositories/Attachment/AttachmentRepository.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Attachment; @@ -33,9 +32,7 @@ use Log; use Storage; /** - * Class AttachmentRepository - * - * @package FireflyIII\Repositories\Attachment + * Class AttachmentRepository. */ class AttachmentRepository implements AttachmentRepositoryInterface { @@ -80,7 +77,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface public function find(int $id): Attachment { $attachment = $this->user->attachments()->find($id); - if (is_null($attachment)) { + if (null === $attachment) { return new Attachment; } @@ -95,7 +92,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface public function findWithoutUser(int $id): Attachment { $attachment = Attachment::find($id); - if (is_null($attachment)) { + if (null === $attachment) { return new Attachment; } @@ -168,13 +165,11 @@ class AttachmentRepository implements AttachmentRepositoryInterface */ public function update(Attachment $attachment, array $data): Attachment { - $attachment->title = $data['title']; $attachment->description = $data['description']; $attachment->notes = $data['notes']; $attachment->save(); return $attachment; - } } diff --git a/app/Repositories/Attachment/AttachmentRepositoryInterface.php b/app/Repositories/Attachment/AttachmentRepositoryInterface.php index bfa0c662ad..bf15bbea35 100644 --- a/app/Repositories/Attachment/AttachmentRepositoryInterface.php +++ b/app/Repositories/Attachment/AttachmentRepositoryInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Attachment; @@ -29,13 +28,10 @@ use FireflyIII\User; use Illuminate\Support\Collection; /** - * Interface AttachmentRepositoryInterface - * - * @package FireflyIII\Repositories\Attachment + * Interface AttachmentRepositoryInterface. */ interface AttachmentRepositoryInterface { - /** * @param Attachment $attachment * @@ -97,4 +93,3 @@ interface AttachmentRepositoryInterface */ public function update(Attachment $attachment, array $attachmentData): Attachment; } - diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index 44e31d94fc..7b1491908e 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Bill; @@ -26,6 +25,7 @@ namespace FireflyIII\Repositories\Bill; use Carbon\Carbon; use DB; use FireflyIII\Models\Bill; +use FireflyIII\Models\Note; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; @@ -37,13 +37,10 @@ use Log; use Navigation; /** - * Class BillRepository - * - * @package FireflyIII\Repositories\Bill + * Class BillRepository. */ class BillRepository implements BillRepositoryInterface { - /** @var User */ private $user; @@ -69,7 +66,7 @@ class BillRepository implements BillRepositoryInterface public function find(int $billId): Bill { $bill = $this->user->bills()->find($billId); - if (is_null($bill)) { + if (null === $bill) { $bill = new Bill; } @@ -125,7 +122,6 @@ class BillRepository implements BillRepositoryInterface $set = $set->sortBy( function (Bill $bill) { - $int = $bill->active ? 0 : 1; return $int . strtolower($bill->name); @@ -157,18 +153,20 @@ class BillRepository implements BillRepositoryInterface 'bills.automatch', 'bills.active', 'bills.name_encrypted', - 'bills.match_encrypted']; + 'bills.match_encrypted',]; $ids = $accounts->pluck('id')->toArray(); $set = $this->user->bills() ->leftJoin( - 'transaction_journals', function (JoinClause $join) { - $join->on('transaction_journals.bill_id', '=', 'bills.id')->whereNull('transaction_journals.deleted_at'); - } + 'transaction_journals', + function (JoinClause $join) { + $join->on('transaction_journals.bill_id', '=', 'bills.id')->whereNull('transaction_journals.deleted_at'); + } ) ->leftJoin( - 'transactions', function (JoinClause $join) { - $join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0); - } + 'transactions', + function (JoinClause $join) { + $join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0); + } ) ->whereIn('transactions.account_id', $ids) ->whereNull('transaction_journals.deleted_at') @@ -177,8 +175,7 @@ class BillRepository implements BillRepositoryInterface $set = $set->sortBy( function (Bill $bill) { - - $int = $bill->active === 1 ? 0 : 1; + $int = 1 === $bill->active ? 0 : 1; return $int . strtolower($bill->name); } @@ -238,7 +235,6 @@ class BillRepository implements BillRepositoryInterface Log::debug(sprintf('Dates = %d, journalCount = %d, total = %d', $dates->count(), $count, $total)); if ($total > 0) { - $average = bcdiv(bcadd($bill->amount_max, $bill->amount_min), '2'); $multi = bcmul($average, strval($total)); $sum = bcadd($sum, $multi); @@ -285,7 +281,6 @@ class BillRepository implements BillRepositoryInterface $dates = $bill->transactionJournals()->before($end)->after($start)->get(['transaction_journals.date'])->pluck('date'); return $dates; - } /** @@ -302,9 +297,7 @@ class BillRepository implements BillRepositoryInterface $set = new Collection; Log::debug(sprintf('Now at bill "%s" (%s)', $bill->name, $bill->repeat_freq)); - /* - * Start at 2016-10-01, see when we expect the bill to hit: - */ + // Start at 2016-10-01, see when we expect the bill to hit: $currentStart = clone $start; Log::debug(sprintf('First currentstart is %s', $currentStart->format('Y-m-d'))); @@ -312,9 +305,7 @@ class BillRepository implements BillRepositoryInterface Log::debug(sprintf('Currentstart is now %s.', $currentStart->format('Y-m-d'))); $nextExpectedMatch = $this->nextDateMatch($bill, $currentStart); Log::debug(sprintf('Next Date match after %s is %s', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d'))); - /* - * If nextExpectedMatch is after end, we continue: - */ + // If nextExpectedMatch is after end, we continue: if ($nextExpectedMatch > $end) { Log::debug( sprintf('nextExpectedMatch %s is after %s, so we skip this bill now.', $nextExpectedMatch->format('Y-m-d'), $end->format('Y-m-d')) @@ -339,7 +330,6 @@ class BillRepository implements BillRepositoryInterface ); Log::debug(sprintf('Found dates between %s and %s:', $start->format('Y-m-d'), $end->format('Y-m-d')), $simple->toArray()); - return $set; } @@ -484,9 +474,7 @@ class BillRepository implements BillRepositoryInterface */ public function scan(Bill $bill, TransactionJournal $journal): bool { - /* - * Can only support withdrawals. - */ + // Can only support withdrawals. if (false === $journal->isWithdrawal()) { return false; } @@ -500,10 +488,7 @@ class BillRepository implements BillRepositoryInterface $wordMatch = $this->doWordMatch($matches, $description); $amountMatch = $this->doAmountMatch($journal->amountPositive(), $bill->amount_min, $bill->amount_max); - - /* - * If both, update! - */ + // when both, update! if ($wordMatch && $amountMatch) { $journal->bill()->associate($bill); $journal->save(); @@ -519,7 +504,6 @@ class BillRepository implements BillRepositoryInterface } return false; - } /** @@ -550,10 +534,14 @@ class BillRepository implements BillRepositoryInterface 'skip' => $data['skip'], 'automatch' => $data['automatch'], 'active' => $data['active'], - ] ); + // update note: + if (isset($data['notes'])) { + $this->updateNote($bill, $data['notes']); + } + return $bill; } @@ -565,8 +553,6 @@ class BillRepository implements BillRepositoryInterface */ public function update(Bill $bill, array $data): Bill { - - $bill->name = $data['name']; $bill->match = $data['match']; $bill->amount_min = $data['amount_min']; @@ -578,6 +564,11 @@ class BillRepository implements BillRepositoryInterface $bill->active = $data['active']; $bill->save(); + // update note: + if (isset($data['notes']) && null !== $data['notes']) { + $this->updateNote($bill, strval($data['notes'])); + } + return $bill; } @@ -608,8 +599,8 @@ class BillRepository implements BillRepositoryInterface $wordMatch = false; $count = 0; foreach ($matches as $word) { - if (!(strpos($description, strtolower($word)) === false)) { - $count++; + if (!(false === strpos($description, strtolower($word)))) { + ++$count; } } if ($count >= count($matches)) { @@ -618,4 +609,32 @@ class BillRepository implements BillRepositoryInterface return $wordMatch; } + + + /** + * @param Bill $bill + * @param string $note + * + * @return bool + */ + protected function updateNote(Bill $bill, string $note): bool + { + if (0 === strlen($note)) { + $dbNote = $bill->notes()->first(); + if (null !== $dbNote) { + $dbNote->delete(); + } + + return true; + } + $dbNote = $bill->notes()->first(); + if (null === $dbNote) { + $dbNote = new Note(); + $dbNote->noteable()->associate($bill); + } + $dbNote->text = trim($note); + $dbNote->save(); + + return true; + } } diff --git a/app/Repositories/Bill/BillRepositoryInterface.php b/app/Repositories/Bill/BillRepositoryInterface.php index 8097f24294..acc5b9b977 100644 --- a/app/Repositories/Bill/BillRepositoryInterface.php +++ b/app/Repositories/Bill/BillRepositoryInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Bill; @@ -30,9 +29,7 @@ use FireflyIII\User; use Illuminate\Support\Collection; /** - * Interface BillRepositoryInterface - * - * @package FireflyIII\Repositories\Bill + * Interface BillRepositoryInterface. */ interface BillRepositoryInterface { @@ -188,5 +185,4 @@ interface BillRepositoryInterface * @return Bill */ public function update(Bill $bill, array $data): Bill; - } diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index 365d14ee7e..aa60bda9a8 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Budget; @@ -38,13 +37,12 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\User; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; +use Log; use Navigation; use stdClass; /** - * Class BudgetRepository - * - * @package FireflyIII\Repositories\Budget + * Class BudgetRepository. */ class BudgetRepository implements BudgetRepositoryInterface { @@ -72,7 +70,6 @@ class BudgetRepository implements BudgetRepositoryInterface } return true; - } /** @@ -90,7 +87,8 @@ class BudgetRepository implements BudgetRepositoryInterface // get account information /** @var AccountRepositoryInterface $accountRepository */ $accountRepository = app(AccountRepositoryInterface::class); - $accounts = $accountRepository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET, AccountType::CASH]); + $accounts = $accountRepository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]); + $defaultCurrency = app('amount')->getDefaultCurrency(); $return = []; /** @var Budget $budget */ foreach ($budgets as $budget) { @@ -109,7 +107,7 @@ class BudgetRepository implements BudgetRepositoryInterface if ($limit->start_date->isSameDay($start) && $limit->end_date->isSameDay($end) ) { $return[$budgetId]['currentLimit'] = $limit; - $return[$budgetId]['budgeted'] = $limit->amount; + $return[$budgetId]['budgeted'] = round($limit->amount, $defaultCurrency->decimal_places); continue; } // otherwise it's just one of the many relevant repetitions: @@ -134,7 +132,7 @@ class BudgetRepository implements BudgetRepositoryInterface } /** - * Filters entries from the result set generated by getBudgetPeriodReport + * Filters entries from the result set generated by getBudgetPeriodReport. * * @param Collection $set * @param int $budgetId @@ -156,7 +154,7 @@ class BudgetRepository implements BudgetRepositoryInterface } ); $amount = '0'; - if (!is_null($result->first())) { + if (null !== $result->first()) { $amount = $result->first()->sum_of_period; } @@ -176,7 +174,7 @@ class BudgetRepository implements BudgetRepositoryInterface public function find(int $budgetId): Budget { $budget = $this->user->budgets()->find($budgetId); - if (is_null($budget)) { + if (null === $budget) { $budget = new Budget; } @@ -215,7 +213,7 @@ class BudgetRepository implements BudgetRepositoryInterface { $oldest = Carbon::create()->startOfYear(); $journal = $budget->transactionJournals()->orderBy('date', 'ASC')->first(); - if (!is_null($journal)) { + if (null !== $journal) { $oldest = $journal->date < $oldest ? $journal->date : $oldest; } @@ -223,13 +221,12 @@ class BudgetRepository implements BudgetRepositoryInterface ->transactions() ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.id') ->orderBy('transaction_journals.date', 'ASC')->first(['transactions.*', 'transaction_journals.date']); - if (!is_null($transaction)) { + if (null !== $transaction) { $carbon = new Carbon($transaction->date); $oldest = $carbon < $oldest ? $carbon : $oldest; } return $oldest; - } /** @@ -305,7 +302,7 @@ class BudgetRepository implements BudgetRepositoryInterface ->where('transaction_currency_id', $currency->id) ->where('start_date', $start->format('Y-m-d')) ->where('end_date', $end->format('Y-m-d'))->first(); - if (!is_null($availableBudget)) { + if (null !== $availableBudget) { $amount = strval($availableBudget->amount); } @@ -396,7 +393,6 @@ class BudgetRepository implements BudgetRepositoryInterface } return $data; - } /** @@ -481,7 +477,7 @@ class BudgetRepository implements BudgetRepositoryInterface ->where('transaction_currency_id', $currency->id) ->where('start_date', $start->format('Y-m-d')) ->where('end_date', $end->format('Y-m-d'))->first(); - if (is_null($availableBudget)) { + if (null === $availableBudget) { $availableBudget = new AvailableBudget; $availableBudget->user()->associate($this->user); $availableBudget->transactionCurrency()->associate($currency); @@ -520,7 +516,7 @@ class BudgetRepository implements BudgetRepositoryInterface if ($accounts->count() > 0) { $collector->setAccounts($accounts); } - if ($accounts->count() === 0) { + if (0 === $accounts->count()) { $collector->setAllAssetAccounts(); } @@ -547,7 +543,7 @@ class BudgetRepository implements BudgetRepositoryInterface if ($accounts->count() > 0) { $collector->setAccounts($accounts); } - if ($accounts->count() === 0) { + if (0 === $accounts->count()) { $collector->setAllAssetAccounts(); } @@ -605,17 +601,18 @@ class BudgetRepository implements BudgetRepositoryInterface * @param Budget $budget * @param Carbon $start * @param Carbon $end - * @param int $amount + * @param string $amount * * @return BudgetLimit */ - public function updateLimitAmount(Budget $budget, Carbon $start, Carbon $end, int $amount): BudgetLimit + public function updateLimitAmount(Budget $budget, Carbon $start, Carbon $end, string $amount): BudgetLimit { // count the limits: $limits = $budget->budgetlimits() ->where('budget_limits.start_date', $start->format('Y-m-d')) ->where('budget_limits.end_date', $end->format('Y-m-d')) ->get(['budget_limits.*'])->count(); + Log::debug(sprintf('Found %d budget limits.', $limits)); // there might be a budget limit for these dates: /** @var BudgetLimit $limit */ $limit = $budget->budgetlimits() @@ -624,7 +621,8 @@ class BudgetRepository implements BudgetRepositoryInterface ->first(['budget_limits.*']); // if more than 1 limit found, delete the others: - if ($limits > 1 && !is_null($limit)) { + if ($limits > 1 && null !== $limit) { + Log::debug(sprintf('Found more than 1, delete all except #%d', $limit->id)); $budget->budgetlimits() ->where('budget_limits.start_date', $start->format('Y-m-d')) ->where('budget_limits.end_date', $end->format('Y-m-d')) @@ -632,19 +630,23 @@ class BudgetRepository implements BudgetRepositoryInterface } // delete if amount is zero. - if (!is_null($limit) && $amount <= 0.0) { + // Returns 0 if the two operands are equal, + // 1 if the left_operand is larger than the right_operand, -1 otherwise. + if (null !== $limit && bccomp($amount, '0') <= 0) { + Log::debug(sprintf('%s is zero, delete budget limit #%d', $amount, $limit->id)); $limit->delete(); return new BudgetLimit; } // update if exists: - if (!is_null($limit)) { + if (null !== $limit) { + Log::debug(sprintf('Existing budget limit is #%d, update this to amount %s', $limit->id, $amount)); $limit->amount = $amount; $limit->save(); return $limit; } - + Log::debug('No existing budget limit, create a new one'); // or create one and return it. $limit = new BudgetLimit; $limit->budget()->associate($budget); @@ -652,6 +654,7 @@ class BudgetRepository implements BudgetRepositoryInterface $limit->end_date = $end; $limit->amount = $amount; $limit->save(); + Log::debug(sprintf('Created new budget limit with ID #%d and amount %s', $limit->id, $amount)); return $limit; } diff --git a/app/Repositories/Budget/BudgetRepositoryInterface.php b/app/Repositories/Budget/BudgetRepositoryInterface.php index f1d4f6bc3f..5f41cbfd23 100644 --- a/app/Repositories/Budget/BudgetRepositoryInterface.php +++ b/app/Repositories/Budget/BudgetRepositoryInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Budget; @@ -31,9 +30,7 @@ use FireflyIII\User; use Illuminate\Support\Collection; /** - * Interface BudgetRepositoryInterface - * - * @package FireflyIII\Repositories\Budget + * Interface BudgetRepositoryInterface. */ interface BudgetRepositoryInterface { @@ -62,7 +59,7 @@ interface BudgetRepositoryInterface public function destroy(Budget $budget): bool; /** - * Filters entries from the result set generated by getBudgetPeriodReport + * Filters entries from the result set generated by getBudgetPeriodReport. * * @param Collection $set * @param int $budgetId @@ -132,7 +129,6 @@ interface BudgetRepositoryInterface public function getBudgetLimits(Budget $budget, Carbon $start, Carbon $end): Collection; /** - * * @param Collection $budgets * @param Collection $accounts * @param Carbon $start @@ -214,10 +210,9 @@ interface BudgetRepositoryInterface * @param Budget $budget * @param Carbon $start * @param Carbon $end - * @param int $amount + * @param string $amount * * @return BudgetLimit */ - public function updateLimitAmount(Budget $budget, Carbon $start, Carbon $end, int $amount): BudgetLimit; - + public function updateLimitAmount(Budget $budget, Carbon $start, Carbon $end, string $amount): BudgetLimit; } diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php index 86e44b213d..659e5dde38 100644 --- a/app/Repositories/Category/CategoryRepository.php +++ b/app/Repositories/Category/CategoryRepository.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Category; @@ -34,9 +33,7 @@ use Log; use Navigation; /** - * Class CategoryRepository - * - * @package FireflyIII\Repositories\Category + * Class CategoryRepository. */ class CategoryRepository implements CategoryRepositoryInterface { @@ -76,7 +73,7 @@ class CategoryRepository implements CategoryRepositoryInterface } /** - * Find a category + * Find a category. * * @param int $categoryId * @@ -85,7 +82,7 @@ class CategoryRepository implements CategoryRepositoryInterface public function find(int $categoryId): Category { $category = $this->user->categories()->find($categoryId); - if (is_null($category)) { + if (null === $category) { $category = new Category; } @@ -93,7 +90,7 @@ class CategoryRepository implements CategoryRepositoryInterface } /** - * Find a category + * Find a category. * * @param string $name * @@ -121,13 +118,13 @@ class CategoryRepository implements CategoryRepositoryInterface $firstJournalDate = $this->getFirstJournalDate($category); $firstTransactionDate = $this->getFirstTransactionDate($category); - if (is_null($firstTransactionDate) && is_null($firstJournalDate)) { + if (null === $firstTransactionDate && null === $firstJournalDate) { return null; } - if (is_null($firstTransactionDate)) { + if (null === $firstTransactionDate) { return $firstJournalDate; } - if (is_null($firstJournalDate)) { + if (null === $firstJournalDate) { return $firstTransactionDate; } @@ -167,13 +164,13 @@ class CategoryRepository implements CategoryRepositoryInterface $lastJournalDate = $this->getLastJournalDate($category, $accounts); $lastTransactionDate = $this->getLastTransactionDate($category, $accounts); - if (is_null($lastTransactionDate) && is_null($lastJournalDate)) { + if (null === $lastTransactionDate && null === $lastJournalDate) { return null; } - if (is_null($lastTransactionDate)) { + if (null === $lastTransactionDate) { return $lastJournalDate; } - if (is_null($lastJournalDate)) { + if (null === $lastJournalDate) { return $lastTransactionDate; } @@ -218,7 +215,7 @@ class CategoryRepository implements CategoryRepositoryInterface /** @var Transaction $transaction */ foreach ($transactions as $transaction) { // if positive, skip: - if (bccomp($transaction->transaction_amount, '0') === 1) { + if (1 === bccomp($transaction->transaction_amount, '0')) { continue; } $categoryId = max(intval($transaction->transaction_journal_category_id), intval($transaction->transaction_category_id)); @@ -253,7 +250,7 @@ class CategoryRepository implements CategoryRepositoryInterface foreach ($transactions as $transaction) { // if positive, skip: - if (bccomp($transaction->transaction_amount, '0') === 1) { + if (1 === bccomp($transaction->transaction_amount, '0')) { continue; } $date = $transaction->date->format($carbonFormat); @@ -336,7 +333,6 @@ class CategoryRepository implements CategoryRepositoryInterface ]; Log::debug('Looping transactions..'); foreach ($transactions as $transaction) { - // if negative, skip: if (bccomp($transaction->transaction_amount, '0') === -1) { continue; @@ -377,15 +373,13 @@ class CategoryRepository implements CategoryRepositoryInterface $collector->setUser($this->user); $collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setCategories($categories); - if ($accounts->count() > 0) { $collector->setAccounts($accounts); } - if ($accounts->count() === 0) { + if (0 === $accounts->count()) { $collector->setAllAssetAccounts(); } - $set = $collector->getJournals(); $sum = strval($set->sum('transaction_amount')); @@ -409,7 +403,7 @@ class CategoryRepository implements CategoryRepositoryInterface if ($accounts->count() > 0) { $collector->setAccounts($accounts); } - if ($accounts->count() === 0) { + if (0 === $accounts->count()) { $collector->setAllAssetAccounts(); } @@ -472,7 +466,7 @@ class CategoryRepository implements CategoryRepositoryInterface $query = $category->transactionJournals()->orderBy('date', 'ASC'); $result = $query->first(['transaction_journals.*']); - if (!is_null($result)) { + if (null !== $result) { return $result->date; } @@ -492,7 +486,7 @@ class CategoryRepository implements CategoryRepositoryInterface ->orderBy('transaction_journals.date', 'DESC'); $lastTransaction = $query->first(['transaction_journals.*']); - if (!is_null($lastTransaction)) { + if (null !== $lastTransaction) { return new Carbon($lastTransaction->date); } @@ -516,7 +510,7 @@ class CategoryRepository implements CategoryRepositoryInterface $result = $query->first(['transaction_journals.*']); - if (!is_null($result)) { + if (null !== $result) { return $result->date; } @@ -541,11 +535,10 @@ class CategoryRepository implements CategoryRepositoryInterface } $lastTransaction = $query->first(['transaction_journals.*']); - if (!is_null($lastTransaction)) { + if (null !== $lastTransaction) { return new Carbon($lastTransaction->date); } return null; } - } diff --git a/app/Repositories/Category/CategoryRepositoryInterface.php b/app/Repositories/Category/CategoryRepositoryInterface.php index 7dc423800b..2444678ca5 100644 --- a/app/Repositories/Category/CategoryRepositoryInterface.php +++ b/app/Repositories/Category/CategoryRepositoryInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Category; @@ -29,9 +28,7 @@ use FireflyIII\User; use Illuminate\Support\Collection; /** - * Interface CategoryRepositoryInterface - * - * @package FireflyIII\Repositories\Category + * Interface CategoryRepositoryInterface. */ interface CategoryRepositoryInterface { @@ -53,7 +50,7 @@ interface CategoryRepositoryInterface public function earnedInPeriod(Collection $categories, Collection $accounts, Carbon $start, Carbon $end): string; /** - * Find a category + * Find a category. * * @param int $categoryId * @@ -62,7 +59,7 @@ interface CategoryRepositoryInterface public function find(int $categoryId): Category; /** - * Find a category + * Find a category. * * @param string $name * diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index af0e383460..7862a2fdba 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Currency; - use Carbon\Carbon; use FireflyIII\Models\CurrencyExchangeRate; use FireflyIII\Models\Preference; @@ -34,9 +32,7 @@ use Log; use Preferences; /** - * Class CurrencyRepository - * - * @package FireflyIII\Repositories\Currency + * Class CurrencyRepository. */ class CurrencyRepository implements CurrencyRepositoryInterface { @@ -55,7 +51,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } // is the only currency left - if ($this->get()->count() === 1) { + if (1 === $this->get()->count()) { return false; } @@ -100,7 +96,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } /** - * Find by ID + * Find by ID. * * @param int $currencyId * @@ -109,7 +105,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface public function find(int $currencyId): TransactionCurrency { $currency = TransactionCurrency::find($currencyId); - if (is_null($currency)) { + if (null === $currency) { $currency = new TransactionCurrency; } @@ -117,7 +113,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } /** - * Find by currency code + * Find by currency code. * * @param string $currencyCode * @@ -126,7 +122,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface public function findByCode(string $currencyCode): TransactionCurrency { $currency = TransactionCurrency::where('code', $currencyCode)->first(); - if (is_null($currency)) { + if (null === $currency) { $currency = new TransactionCurrency; } @@ -134,7 +130,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } /** - * Find by currency name + * Find by currency name. * * @param string $currencyName * @@ -143,7 +139,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface public function findByName(string $currencyName): TransactionCurrency { $preferred = TransactionCurrency::whereName($currencyName)->first(); - if (is_null($preferred)) { + if (null === $preferred) { $preferred = new TransactionCurrency; } @@ -151,7 +147,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } /** - * Find by currency symbol + * Find by currency symbol. * * @param string $currencySymbol * @@ -160,7 +156,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface public function findBySymbol(string $currencySymbol): TransactionCurrency { $currency = TransactionCurrency::whereSymbol($currencySymbol)->first(); - if (is_null($currency)) { + if (null === $currency) { $currency = new TransactionCurrency; } @@ -172,7 +168,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface */ public function get(): Collection { - return TransactionCurrency::get(); + return TransactionCurrency::orderBy('code', 'ASC')->get(); } /** @@ -182,7 +178,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface */ public function getByIds(array $ids): Collection { - return TransactionCurrency::whereIn('id', $ids)->get(); + return TransactionCurrency::orderBy('code', 'ASC')->whereIn('id', $ids)->get(); } /** @@ -193,7 +189,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface public function getCurrencyByPreference(Preference $preference): TransactionCurrency { $preferred = TransactionCurrency::where('code', $preference->data)->first(); - if (is_null($preferred)) { + if (null === $preferred) { $preferred = TransactionCurrency::first(); } @@ -221,15 +217,13 @@ class CurrencyRepository implements CurrencyRepositoryInterface ->where('from_currency_id', $fromCurrency->id) ->where('to_currency_id', $toCurrency->id) ->where('date', $date->format('Y-m-d'))->first(); - if (!is_null($rate)) { + if (null !== $rate) { Log::debug(sprintf('Found cached exchange rate in database for %s to %s on %s', $fromCurrency->code, $toCurrency->code, $date->format('Y-m-d'))); return $rate; } return new CurrencyExchangeRate; - - } /** diff --git a/app/Repositories/Currency/CurrencyRepositoryInterface.php b/app/Repositories/Currency/CurrencyRepositoryInterface.php index bea29039f8..233e59044a 100644 --- a/app/Repositories/Currency/CurrencyRepositoryInterface.php +++ b/app/Repositories/Currency/CurrencyRepositoryInterface.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Currency; - use Carbon\Carbon; use FireflyIII\Models\CurrencyExchangeRate; use FireflyIII\Models\Preference; @@ -32,9 +30,7 @@ use FireflyIII\User; use Illuminate\Support\Collection; /** - * Interface CurrencyRepositoryInterface - * - * @package FireflyIII\Repositories\Currency + * Interface CurrencyRepositoryInterface. */ interface CurrencyRepositoryInterface { @@ -60,7 +56,7 @@ interface CurrencyRepositoryInterface public function destroy(TransactionCurrency $currency): bool; /** - * Find by ID + * Find by ID. * * @param int $currencyId * @@ -69,7 +65,7 @@ interface CurrencyRepositoryInterface public function find(int $currencyId): TransactionCurrency; /** - * Find by currency code + * Find by currency code. * * @param string $currencyCode * @@ -78,7 +74,7 @@ interface CurrencyRepositoryInterface public function findByCode(string $currencyCode): TransactionCurrency; /** - * Find by currency name + * Find by currency name. * * @param string $currencyName * @@ -87,7 +83,7 @@ interface CurrencyRepositoryInterface public function findByName(string $currencyName): TransactionCurrency; /** - * Find by currency symbol + * Find by currency symbol. * * @param string $currencySymbol * @@ -142,5 +138,4 @@ interface CurrencyRepositoryInterface * @return TransactionCurrency */ public function update(TransactionCurrency $currency, array $data): TransactionCurrency; - } diff --git a/app/Repositories/ExportJob/ExportJobRepository.php b/app/Repositories/ExportJob/ExportJobRepository.php index c2a39deb9d..85fc0cb189 100644 --- a/app/Repositories/ExportJob/ExportJobRepository.php +++ b/app/Repositories/ExportJob/ExportJobRepository.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\ExportJob; @@ -31,9 +30,7 @@ use Log; use Storage; /** - * Class ExportJobRepository - * - * @package FireflyIII\Repositories\ExportJob + * Class ExportJobRepository. */ class ExportJobRepository implements ExportJobRepositoryInterface { @@ -91,7 +88,7 @@ class ExportJobRepository implements ExportJobRepositoryInterface while ($count < 30) { $key = Str::random(12); $existing = $this->findByKey($key); - if (is_null($existing->id)) { + if (null === $existing->id) { $exportJob = new ExportJob; $exportJob->user()->associate($this->user); $exportJob->key = Str::random(12); @@ -102,12 +99,10 @@ class ExportJobRepository implements ExportJobRepositoryInterface return $exportJob; } - $count++; - + ++$count; } return new ExportJob; - } /** @@ -131,7 +126,7 @@ class ExportJobRepository implements ExportJobRepositoryInterface public function findByKey(string $key): ExportJob { $result = $this->user->exportJobs()->where('key', $key)->first(['export_jobs.*']); - if (is_null($result)) { + if (null === $result) { return new ExportJob; } diff --git a/app/Repositories/ExportJob/ExportJobRepositoryInterface.php b/app/Repositories/ExportJob/ExportJobRepositoryInterface.php index cd1a1d6337..34c1eb3b29 100644 --- a/app/Repositories/ExportJob/ExportJobRepositoryInterface.php +++ b/app/Repositories/ExportJob/ExportJobRepositoryInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\ExportJob; @@ -27,9 +26,7 @@ use FireflyIII\Models\ExportJob; use FireflyIII\User; /** - * Interface ExportJobRepositoryInterface - * - * @package FireflyIII\Repositories\ExportJob + * Interface ExportJobRepositoryInterface. */ interface ExportJobRepositoryInterface { @@ -76,5 +73,4 @@ interface ExportJobRepositoryInterface * @param User $user */ public function setUser(User $user); - } diff --git a/app/Repositories/ImportJob/ImportJobRepository.php b/app/Repositories/ImportJob/ImportJobRepository.php index cb1d005e43..c3bef54aee 100644 --- a/app/Repositories/ImportJob/ImportJobRepository.php +++ b/app/Repositories/ImportJob/ImportJobRepository.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\ImportJob; @@ -35,9 +34,7 @@ use Storage; use Symfony\Component\HttpFoundation\File\UploadedFile; /** - * Class ImportJobRepository - * - * @package FireflyIII\Repositories\ImportJob + * Class ImportJobRepository. */ class ImportJobRepository implements ImportJobRepositoryInterface { @@ -48,6 +45,7 @@ class ImportJobRepository implements ImportJobRepositoryInterface * @param string $fileType * * @return ImportJob + * * @throws FireflyException */ public function create(string $fileType): ImportJob @@ -62,7 +60,7 @@ class ImportJobRepository implements ImportJobRepositoryInterface while ($count < 30) { $key = Str::random(12); $existing = $this->findByKey($key); - if (is_null($existing->id)) { + if (null === $existing->id) { $importJob = new ImportJob; $importJob->user()->associate($this->user); $importJob->file_type = $fileType; @@ -80,8 +78,7 @@ class ImportJobRepository implements ImportJobRepositoryInterface // breaks the loop: return $importJob; } - $count++; - + ++$count; } return new ImportJob; @@ -95,7 +92,7 @@ class ImportJobRepository implements ImportJobRepositoryInterface public function findByKey(string $key): ImportJob { $result = $this->user->importJobs()->where('key', $key)->first(['import_jobs.*']); - if (is_null($result)) { + if (null === $result) { return new ImportJob; } @@ -115,14 +112,15 @@ class ImportJobRepository implements ImportJobRepositoryInterface // demo user's configuration upload is ignored completely. if (!$repository->hasRole($this->user, 'demo')) { Log::debug( - 'Uploaded configuration file', ['name' => $file->getClientOriginalName(), 'size' => $file->getSize(), 'mime' => $file->getClientMimeType()] + 'Uploaded configuration file', + ['name' => $file->getClientOriginalName(), 'size' => $file->getSize(), 'mime' => $file->getClientMimeType()] ); $configFileObject = new SplFileObject($file->getRealPath()); $configRaw = $configFileObject->fread($configFileObject->getSize()); $configuration = json_decode($configRaw, true); - if (!is_null($configuration) && is_array($configuration)) { + if (null !== $configuration && is_array($configuration)) { Log::debug('Found configuration', $configuration); $this->setConfiguration($job, $configuration); } @@ -147,7 +145,6 @@ class ImportJobRepository implements ImportJobRepositoryInterface $contentEncrypted = Crypt::encrypt($content); $disk = Storage::disk('upload'); - // user is demo user, replace upload with prepared file. if ($repository->hasRole($this->user, 'demo')) { $stubsDisk = Storage::disk('stubs'); diff --git a/app/Repositories/ImportJob/ImportJobRepositoryInterface.php b/app/Repositories/ImportJob/ImportJobRepositoryInterface.php index 91d2d5449a..ad74c4e021 100644 --- a/app/Repositories/ImportJob/ImportJobRepositoryInterface.php +++ b/app/Repositories/ImportJob/ImportJobRepositoryInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\ImportJob; @@ -28,9 +27,7 @@ use FireflyIII\User; use Symfony\Component\HttpFoundation\File\UploadedFile; /** - * Interface ImportJobRepositoryInterface - * - * @package FireflyIII\Repositories\ImportJob + * Interface ImportJobRepositoryInterface. */ interface ImportJobRepositoryInterface { diff --git a/app/Repositories/Journal/CreateJournalsTrait.php b/app/Repositories/Journal/CreateJournalsTrait.php index 088ac15663..e9b9e1be87 100644 --- a/app/Repositories/Journal/CreateJournalsTrait.php +++ b/app/Repositories/Journal/CreateJournalsTrait.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Journal; - use FireflyIII\Models\Budget; use FireflyIII\Models\Category; use FireflyIII\Models\Note; @@ -40,8 +38,6 @@ use Log; * @property User $user * * Trait CreateJournalsTrait - * - * @package FireflyIII\Repositories\Journal */ trait CreateJournalsTrait { @@ -55,7 +51,6 @@ trait CreateJournalsTrait abstract public function storeAccounts(User $user, TransactionType $type, array $data): array; /** - * * * Remember: a balancingAct takes at most one expense and one transfer. * an advancePayment takes at most one expense, infinite deposits and NO transfers. * @@ -72,7 +67,7 @@ trait CreateJournalsTrait foreach ($array as $name) { if (strlen(trim($name)) > 0) { $tag = Tag::firstOrCreateEncrypted(['tag' => $name, 'user_id' => $journal->user_id]); - if (!is_null($tag)) { + if (null !== $tag) { Log::debug(sprintf('Will try to connect tag #%d to journal #%d.', $tag->id, $journal->id)); $tagRepository->connect($journal, $tag); } @@ -88,7 +83,7 @@ trait CreateJournalsTrait */ protected function storeBudgetWithTransaction(Transaction $transaction, int $budgetId) { - if (intval($budgetId) > 0 && $transaction->transactionJournal->transactionType->type !== TransactionType::TRANSFER) { + if (intval($budgetId) > 0 && TransactionType::TRANSFER !== $transaction->transactionJournal->transactionType->type) { /** @var \FireflyIII\Models\Budget $budget */ $budget = Budget::find($budgetId); $transaction->budgets()->save($budget); @@ -124,7 +119,7 @@ trait CreateJournalsTrait // store transaction one way: $amount = bcmul(strval($transaction['amount']), '-1'); - $foreignAmount = is_null($transaction['foreign_amount']) ? null : bcmul(strval($transaction['foreign_amount']), '-1'); + $foreignAmount = null === $transaction['foreign_amount'] ? null : bcmul(strval($transaction['foreign_amount']), '-1'); $one = $this->storeTransaction( [ 'journal' => $journal, @@ -144,7 +139,7 @@ trait CreateJournalsTrait // and the other way: $amount = strval($transaction['amount']); - $foreignAmount = is_null($transaction['foreign_amount']) ? null : strval($transaction['foreign_amount']); + $foreignAmount = null === $transaction['foreign_amount'] ? null : strval($transaction['foreign_amount']); $two = $this->storeTransaction( [ 'journal' => $journal, @@ -183,11 +178,10 @@ trait CreateJournalsTrait 'identifier' => $data['identifier'], ]; - - if (is_null($data['foreign_currency_id'])) { + if (null === $data['foreign_currency_id']) { unset($fields['foreign_currency_id']); } - if (is_null($data['foreign_amount'])) { + if (null === $data['foreign_amount']) { unset($fields['foreign_amount']); } @@ -196,19 +190,17 @@ trait CreateJournalsTrait Log::debug(sprintf('Transaction stored with ID: %s', $transaction->id)); - if (!is_null($data['category'])) { + if (null !== $data['category']) { $transaction->categories()->save($data['category']); } - if (!is_null($data['budget'])) { + if (null !== $data['budget']) { $transaction->categories()->save($data['budget']); } return $transaction; - } - /** * @param TransactionJournal $journal * @param string $note @@ -217,16 +209,16 @@ trait CreateJournalsTrait */ protected function updateNote(TransactionJournal $journal, string $note): bool { - if (strlen($note) === 0) { + if (0 === strlen($note)) { $dbNote = $journal->notes()->first(); - if (!is_null($dbNote)) { + if (null !== $dbNote) { $dbNote->delete(); } return true; } $dbNote = $journal->notes()->first(); - if (is_null($dbNote)) { + if (null === $dbNote) { $dbNote = new Note(); $dbNote->noteable()->associate($journal); } diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index f2688a5b68..e43bf02459 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -18,12 +18,13 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Journal; use FireflyIII\Models\Account; +use FireflyIII\Models\AccountType; +use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; use FireflyIII\User; @@ -33,9 +34,7 @@ use Log; use Preferences; /** - * Class JournalRepository - * - * @package FireflyIII\Repositories\Journal + * Class JournalRepository. */ class JournalRepository implements JournalRepositoryInterface { @@ -63,7 +62,7 @@ class JournalRepository implements JournalRepositoryInterface $messages->add('destination_account_expense', trans('firefly.invalid_convert_selection')); $messages->add('source_account_asset', trans('firefly.invalid_convert_selection')); - if ($source->id === $destination->id || is_null($source->id) || is_null($destination->id)) { + if ($source->id === $destination->id || null === $source->id || null === $destination->id) { return $messages; } @@ -77,7 +76,7 @@ class JournalRepository implements JournalRepositoryInterface $journal->save(); // if journal is a transfer now, remove budget: - if ($type->type === TransactionType::TRANSFER) { + if (TransactionType::TRANSFER === $type->type) { $journal->budgets()->detach(); } @@ -116,7 +115,7 @@ class JournalRepository implements JournalRepositoryInterface public function find(int $journalId): TransactionJournal { $journal = $this->user->transactionJournals()->where('id', $journalId)->first(); - if (is_null($journal)) { + if (null === $journal) { return new TransactionJournal; } @@ -124,7 +123,39 @@ class JournalRepository implements JournalRepositoryInterface } /** - * Get users first transaction journal + * @param Transaction $transaction + * + * @return Transaction|null + */ + public function findOpposingTransaction(Transaction $transaction): ?Transaction + { + $opposing = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->where('transaction_journals.user_id', $this->user->id) + ->where('transactions.transaction_journal_id', $transaction->transaction_journal_id) + ->where('transactions.identifier', $transaction->identifier) + ->where('amount', bcmul($transaction->amount, '-1')) + ->first(['transactions.*']); + + return $opposing; + } + + /** + * @param int $transactionid + * + * @return Transaction|null + */ + public function findTransaction(int $transactionid): ?Transaction + { + $transaction = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->where('transaction_journals.user_id', $this->user->id) + ->where('transactions.id', $transactionid) + ->first(['transactions.*']); + + return $transaction; + } + + /** + * Get users first transaction journal. * * @return TransactionJournal */ @@ -132,14 +163,30 @@ class JournalRepository implements JournalRepositoryInterface { $entry = $this->user->transactionJournals()->orderBy('date', 'ASC')->first(['transaction_journals.*']); - if (is_null($entry)) { - + if (null === $entry) { return new TransactionJournal; } return $entry; } + /** + * @param TransactionJournal $journal + * + * @return Transaction|null + */ + public function getAssetTransaction(TransactionJournal $journal): ?Transaction + { + /** @var Transaction $transaction */ + foreach ($journal->transactions as $transaction) { + if ($transaction->account->accountType->type === AccountType::ASSET) { + return $transaction; + } + } + + return null; + } + /** * @return Collection */ @@ -148,6 +195,23 @@ class JournalRepository implements JournalRepositoryInterface return TransactionType::orderBy('type', 'ASC')->get(); } + /** + * @param array $transactionIds + * + * @return Collection + */ + public function getTransactionsById(array $transactionIds): Collection + { + $set = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->whereIn('transactions.id', $transactionIds) + ->where('transaction_journals.user_id', $this->user->id) + ->whereNull('transaction_journals.deleted_at') + ->whereNull('transactions.deleted_at') + ->get(['transactions.*']); + + return $set; + } + /** * @param TransactionJournal $journal * @@ -155,7 +219,32 @@ class JournalRepository implements JournalRepositoryInterface */ public function isTransfer(TransactionJournal $journal): bool { - return $journal->transactionType->type === TransactionType::TRANSFER; + return TransactionType::TRANSFER === $journal->transactionType->type; + } + + /** + * @param Transaction $transaction + * + * @return bool + */ + public function reconcile(Transaction $transaction): bool + { + Log::debug(sprintf('Going to reconcile transaction #%d', $transaction->id)); + $opposing = $this->findOpposingTransaction($transaction); + + if (null === $opposing) { + Log::debug('Opposing transaction is NULL. Cannot reconcile.'); + + return false; + } + Log::debug(sprintf('Opposing transaction ID is #%d', $opposing->id)); + + $transaction->reconciled = true; + $opposing->reconciled = true; + $transaction->save(); + $opposing->save(); + + return true; } /** @@ -210,12 +299,13 @@ class JournalRepository implements JournalRepositoryInterface $this->storeBudgetWithJournal($journal, $data['budget_id']); // store two transactions: + $one = [ 'journal' => $journal, 'account' => $accounts['source'], 'amount' => bcmul($amount, '-1'), 'transaction_currency_id' => $data['currency_id'], - 'foreign_amount' => is_null($data['foreign_amount']) ? null : bcmul(strval($data['foreign_amount']), '-1'), + 'foreign_amount' => null === $data['foreign_amount'] ? null : bcmul(strval($data['foreign_amount']), '-1'), 'foreign_currency_id' => $data['foreign_currency_id'], 'description' => null, 'category' => null, @@ -239,7 +329,6 @@ class JournalRepository implements JournalRepositoryInterface $this->storeTransaction($two); - // store tags if (isset($data['tags']) && is_array($data['tags'])) { $this->saveTags($journal, $data['tags']); @@ -262,7 +351,6 @@ class JournalRepository implements JournalRepositoryInterface $journal->save(); return $journal; - } /** @@ -273,14 +361,13 @@ class JournalRepository implements JournalRepositoryInterface */ public function update(TransactionJournal $journal, array $data): TransactionJournal { - // update actual journal: $journal->description = $data['description']; $journal->date = $data['date']; $accounts = $this->storeAccounts($this->user, $journal->transactionType, $data); $data = $this->verifyNativeAmount($data, $accounts); $data['amount'] = strval($data['amount']); - $data['foreign_amount'] = is_null($data['foreign_amount']) ? null : strval($data['foreign_amount']); + $data['foreign_amount'] = null === $data['foreign_amount'] ? null : strval($data['foreign_amount']); // unlink all categories, recreate them: $journal->categories()->detach(); @@ -303,7 +390,7 @@ class JournalRepository implements JournalRepositoryInterface } // update note: - if (isset($data['notes']) && !is_null($data['notes']) ) { + if (isset($data['notes']) && null !== $data['notes']) { $this->updateNote($journal, strval($data['notes'])); } @@ -324,6 +411,7 @@ class JournalRepository implements JournalRepositoryInterface return $journal; } + /** * Same as above but for transaction journal with multiple transactions. * @@ -345,11 +433,10 @@ class JournalRepository implements JournalRepositoryInterface $journal->budgets()->detach(); // update note: - if (isset($data['notes']) && !is_null($data['notes']) ) { + if (isset($data['notes']) && null !== $data['notes']) { $this->updateNote($journal, strval($data['notes'])); } - // update meta fields: $result = $journal->save(); if ($result) { @@ -378,7 +465,7 @@ class JournalRepository implements JournalRepositoryInterface Log::debug(sprintf('Split journal update split transaction %d', $identifier)); $transaction = $this->appendTransactionData($transaction, $data); $this->storeSplitTransaction($journal, $transaction, $identifier); - $identifier++; + ++$identifier; } $journal->save(); diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.php index 41d2b3aed2..af54952808 100644 --- a/app/Repositories/Journal/JournalRepositoryInterface.php +++ b/app/Repositories/Journal/JournalRepositoryInterface.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Journal; use FireflyIII\Models\Account; +use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; use FireflyIII\User; @@ -31,13 +32,10 @@ use Illuminate\Support\Collection; use Illuminate\Support\MessageBag; /** - * Interface JournalRepositoryInterface - * - * @package FireflyIII\Repositories\Journal + * Interface JournalRepositoryInterface. */ interface JournalRepositoryInterface { - /** * @param TransactionJournal $journal * @param TransactionType $type @@ -65,7 +63,7 @@ interface JournalRepositoryInterface public function delete(TransactionJournal $journal): bool; /** - * Find a specific journal + * Find a specific journal. * * @param int $journalId * @@ -74,17 +72,45 @@ interface JournalRepositoryInterface public function find(int $journalId): TransactionJournal; /** - * Get users very first transaction journal + * @param Transaction $transaction + * + * @return Transaction|null + */ + public function findOpposingTransaction(Transaction $transaction): ?Transaction; + + /** + * @param int $transactionid + * + * @return Transaction|null + */ + public function findTransaction(int $transactionid): ?Transaction; + + /** + * Get users very first transaction journal. * * @return TransactionJournal */ public function first(): TransactionJournal; + /** + * @param TransactionJournal $journal + * + * @return Transaction|null + */ + public function getAssetTransaction(TransactionJournal $journal): ?Transaction; + /** * @return Collection */ public function getTransactionTypes(): Collection; + /** + * @param array $transactionIds + * + * @return Collection + */ + public function getTransactionsById(array $transactionIds): Collection; + /** * @param TransactionJournal $journal * @@ -92,6 +118,13 @@ interface JournalRepositoryInterface */ public function isTransfer(TransactionJournal $journal): bool; + /** + * @param Transaction $transaction + * + * @return bool + */ + public function reconcile(Transaction $transaction): bool; + /** * @param TransactionJournal $journal * @param int $order @@ -127,5 +160,4 @@ interface JournalRepositoryInterface * @return TransactionJournal */ public function updateSplitJournal(TransactionJournal $journal, array $data): TransactionJournal; - } diff --git a/app/Repositories/Journal/JournalTasker.php b/app/Repositories/Journal/JournalTasker.php index 0d150e8912..ae7f22e7be 100644 --- a/app/Repositories/Journal/JournalTasker.php +++ b/app/Repositories/Journal/JournalTasker.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Journal; @@ -28,6 +27,7 @@ use FireflyIII\Models\AccountType; use FireflyIII\Models\PiggyBankEvent; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; +use FireflyIII\Support\SingleCacheProperties; use FireflyIII\User; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Query\JoinClause; @@ -35,17 +35,13 @@ use Illuminate\Support\Collection; use Steam; /** - * Class JournalTasker - * - * @package FireflyIII\Repositories\Journal + * Class JournalTasker. */ class JournalTasker implements JournalTaskerInterface { - /** @var User */ private $user; - /** * @param TransactionJournal $journal * @@ -74,17 +70,25 @@ class JournalTasker implements JournalTaskerInterface */ public function getTransactionsOverview(TransactionJournal $journal): array { + $cache = new SingleCacheProperties; + $cache->addProperty('transaction-overview'); + $cache->addProperty($journal->id); + $cache->addProperty($journal->updated_at); + if ($cache->has()) { + return $cache->get(); + } // get all transaction data + the opposite site in one list. $set = $journal ->transactions()// "source" ->leftJoin( - 'transactions as destination', function (JoinClause $join) { - $join - ->on('transactions.transaction_journal_id', '=', 'destination.transaction_journal_id') - ->where('transactions.amount', '=', DB::raw('destination.amount * -1')) - ->where('transactions.identifier', '=', DB::raw('destination.identifier')) - ->whereNull('destination.deleted_at'); - } + 'transactions as destination', + function (JoinClause $join) { + $join + ->on('transactions.transaction_journal_id', '=', 'destination.transaction_journal_id') + ->where('transactions.amount', '=', DB::raw('destination.amount * -1')) + ->where('transactions.identifier', '=', DB::raw('destination.identifier')) + ->whereNull('destination.deleted_at'); + } ) ->with(['budgets', 'categories']) ->leftJoin('accounts as source_accounts', 'transactions.account_id', '=', 'source_accounts.id') @@ -119,11 +123,11 @@ class JournalTasker implements JournalTaskerInterface 'foreign_currencies.decimal_places as foreign_currency_dp', 'foreign_currencies.code as foreign_currency_code', 'foreign_currencies.symbol as foreign_currency_symbol', - ] ); - $transactions = []; + $transactions = []; + $transactionType = $journal->transactionType->type; /** @var Transaction $entry */ foreach ($set as $entry) { @@ -132,7 +136,10 @@ class JournalTasker implements JournalTaskerInterface $budget = $entry->budgets->first(); $category = $entry->categories->first(); $transaction = [ + 'journal_type' => $transactionType, + 'updated_at' => $journal->updated_at, 'source_id' => $entry->id, + 'source' => $journal->transactions()->find($entry->id), 'source_amount' => $entry->amount, 'foreign_source_amount' => $entry->foreign_amount, 'description' => $entry->description, @@ -143,14 +150,14 @@ class JournalTasker implements JournalTaskerInterface 'source_account_after' => bcadd($sourceBalance, $entry->amount), 'destination_id' => $entry->destination_id, 'destination_amount' => bcmul($entry->amount, '-1'), - 'foreign_destination_amount' => is_null($entry->foreign_amount) ? null : bcmul($entry->foreign_amount, '-1'), + 'foreign_destination_amount' => null === $entry->foreign_amount ? null : bcmul($entry->foreign_amount, '-1'), 'destination_account_id' => $entry->destination_account_id, 'destination_account_type' => $entry->destination_account_type, 'destination_account_name' => Steam::decrypt(intval($entry->destination_account_encrypted), $entry->destination_account_name), 'destination_account_before' => $destinationBalance, 'destination_account_after' => bcadd($destinationBalance, bcmul($entry->amount, '-1')), - 'budget_id' => is_null($budget) ? 0 : $budget->id, - 'category' => is_null($category) ? '' : $category->name, + 'budget_id' => null === $budget ? 0 : $budget->id, + 'category' => null === $category ? '' : $category->name, 'transaction_currency_id' => $entry->transaction_currency_id, 'transaction_currency_code' => $entry->transaction_currency_code, 'transaction_currency_symbol' => $entry->transaction_currency_symbol, @@ -160,17 +167,17 @@ class JournalTasker implements JournalTaskerInterface 'foreign_currency_symbol' => $entry->foreign_currency_symbol, 'foreign_currency_dp' => $entry->foreign_currency_dp, ]; - if ($entry->destination_account_type === AccountType::CASH) { + if (AccountType::CASH === $entry->destination_account_type) { $transaction['destination_account_name'] = ''; } - if ($entry->account_type === AccountType::CASH) { + if (AccountType::CASH === $entry->account_type) { $transaction['source_account_name'] = ''; } - $transactions[] = $transaction; } + $cache->store($transactions); return $transactions; } @@ -186,7 +193,7 @@ class JournalTasker implements JournalTaskerInterface /** * Collect the balance of an account before the given transaction has hit. This is tricky, because * the balance does not depend on the transaction itself but the journal it's part of. And of course - * the order of transactions within the journal. So the query is pretty complex: + * the order of transactions within the journal. So the query is pretty complex:. * * @param int $transactionId * diff --git a/app/Repositories/Journal/JournalTaskerInterface.php b/app/Repositories/Journal/JournalTaskerInterface.php index 81ca557fae..37899de92f 100644 --- a/app/Repositories/Journal/JournalTaskerInterface.php +++ b/app/Repositories/Journal/JournalTaskerInterface.php @@ -18,20 +18,16 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Journal; - use FireflyIII\Models\TransactionJournal; use FireflyIII\User; use Illuminate\Support\Collection; /** - * Interface JournalTaskerInterface - * - * @package FireflyIII\Repositories\Journal + * Interface JournalTaskerInterface. */ interface JournalTaskerInterface { diff --git a/app/Repositories/Journal/SupportJournalsTrait.php b/app/Repositories/Journal/SupportJournalsTrait.php index 322102d060..25a8a02d69 100644 --- a/app/Repositories/Journal/SupportJournalsTrait.php +++ b/app/Repositories/Journal/SupportJournalsTrait.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Journal; @@ -34,9 +33,7 @@ use FireflyIII\User; use Log; /** - * Trait SupportJournalsTrait - * - * @package FireflyIII\Repositories\Journal + * Trait SupportJournalsTrait. */ trait SupportJournalsTrait { @@ -46,6 +43,7 @@ trait SupportJournalsTrait * @param array $data * * @return array + * * @throws FireflyException */ protected function storeAccounts(User $user, TransactionType $type, array $data): array @@ -69,22 +67,25 @@ trait SupportJournalsTrait $accounts['source'] = Account::where('user_id', $user->id)->where('id', $data['source_account_id'])->first(); $accounts['destination'] = Account::where('user_id', $user->id)->where('id', $data['destination_account_id'])->first(); break; + case TransactionType::RECONCILIATION: + $accounts['source'] = $data['source']; + $accounts['destination'] = $data['destination']; + unset($data['source'], $data['destination']); + break; default: throw new FireflyException(sprintf('Did not recognise transaction type "%s".', $type->type)); } - if (is_null($accounts['source'])) { + if (null === $accounts['source']) { Log::error('"source"-account is null, so we cannot continue!', ['data' => $data]); throw new FireflyException('"source"-account is null, so we cannot continue!'); } - if (is_null($accounts['destination'])) { + if (null === $accounts['destination']) { Log::error('"destination"-account is null, so we cannot continue!', ['data' => $data]); throw new FireflyException('"destination"-account is null, so we cannot continue!'); - } - return $accounts; } @@ -94,7 +95,7 @@ trait SupportJournalsTrait */ protected function storeBudgetWithJournal(TransactionJournal $journal, int $budgetId) { - if (intval($budgetId) > 0 && $journal->transactionType->type === TransactionType::WITHDRAWAL) { + if (intval($budgetId) > 0 && TransactionType::WITHDRAWAL === $journal->transactionType->type) { /** @var \FireflyIII\Models\Budget $budget */ $budget = Budget::find($budgetId); $journal->budgets()->save($budget); @@ -216,6 +217,7 @@ trait SupportJournalsTrait * @param array $accounts * * @return array + * * @throws FireflyException */ protected function verifyNativeAmount(array $data, array $accounts): array @@ -228,10 +230,13 @@ trait SupportJournalsTrait // which account to check for what the native currency is? $check = 'source'; - if ($transactionType->type === TransactionType::DEPOSIT) { + if (TransactionType::DEPOSIT === $transactionType->type) { $check = 'destination'; } switch ($transactionType->type) { + case TransactionType::RECONCILIATION: + // do nothing. + break; case TransactionType::DEPOSIT: case TransactionType::WITHDRAWAL: // continue: diff --git a/app/Repositories/Journal/UpdateJournalsTrait.php b/app/Repositories/Journal/UpdateJournalsTrait.php index d077096010..0095d8bf83 100644 --- a/app/Repositories/Journal/UpdateJournalsTrait.php +++ b/app/Repositories/Journal/UpdateJournalsTrait.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Journal; - use DB; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; @@ -35,15 +33,12 @@ use FireflyIII\Repositories\Tag\TagRepositoryInterface; use Log; /** - * Trait UpdateJournalsTrait - * - * @package FireflyIII\Repositories\Journal + * Trait UpdateJournalsTrait. */ trait UpdateJournalsTrait { - /** - * When the user edits a split journal, each line is missing crucial data: + * When the user edits a split journal, each line is missing crucial data:. * * - Withdrawal lines are missing the source account ID * - Deposit lines are missing the destination account ID @@ -85,18 +80,17 @@ trait UpdateJournalsTrait protected function updateDestinationTransaction(TransactionJournal $journal, Account $account, array $data) { $set = $journal->transactions()->where('amount', '>', 0)->get(); - if ($set->count() !== 1) { + if (1 !== $set->count()) { throw new FireflyException(sprintf('Journal #%d has %d transactions with an amount more than zero.', $journal->id, $set->count())); } /** @var Transaction $transaction */ $transaction = $set->first(); $transaction->amount = app('steam')->positive($data['amount']); $transaction->transaction_currency_id = $data['currency_id']; - $transaction->foreign_amount = is_null($data['foreign_amount']) ? null : app('steam')->positive($data['foreign_amount']); + $transaction->foreign_amount = null === $data['foreign_amount'] ? null : app('steam')->positive($data['foreign_amount']); $transaction->foreign_currency_id = $data['foreign_currency_id']; $transaction->account_id = $account->id; $transaction->save(); - } /** @@ -110,14 +104,14 @@ trait UpdateJournalsTrait { // should be one: $set = $journal->transactions()->where('amount', '<', 0)->get(); - if ($set->count() !== 1) { + if (1 !== $set->count()) { throw new FireflyException(sprintf('Journal #%d has %d transactions with an amount more than zero.', $journal->id, $set->count())); } /** @var Transaction $transaction */ $transaction = $set->first(); $transaction->amount = bcmul(app('steam')->positive($data['amount']), '-1'); $transaction->transaction_currency_id = $data['currency_id']; - $transaction->foreign_amount = is_null($data['foreign_amount']) ? null : bcmul(app('steam')->positive($data['foreign_amount']), '-1'); + $transaction->foreign_amount = null === $data['foreign_amount'] ? null : bcmul(app('steam')->positive($data['foreign_amount']), '-1'); $transaction->foreign_currency_id = $data['foreign_currency_id']; $transaction->account_id = $account->id; $transaction->save(); @@ -135,7 +129,6 @@ trait UpdateJournalsTrait /** @var TagRepositoryInterface $tagRepository */ $tagRepository = app(TagRepositoryInterface::class); - // find or create all tags: $tags = []; $ids = []; @@ -152,7 +145,7 @@ trait UpdateJournalsTrait DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->whereNotIn('tag_id', $ids)->delete(); } // if count is zero, delete them all: - if (count($ids) === 0) { + if (0 === count($ids)) { DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->delete(); } diff --git a/app/Repositories/LinkType/LinkTypeRepository.php b/app/Repositories/LinkType/LinkTypeRepository.php index c46fb2d2bd..c600cc0f54 100644 --- a/app/Repositories/LinkType/LinkTypeRepository.php +++ b/app/Repositories/LinkType/LinkTypeRepository.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\LinkType; @@ -30,9 +29,7 @@ use FireflyIII\User; use Illuminate\Support\Collection; /** - * Class LinkTypeRepository - * - * @package FireflyIII\Repositories\LinkType + * Class LinkTypeRepository. */ class LinkTypeRepository implements LinkTypeRepositoryInterface { @@ -57,7 +54,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface */ public function destroy(LinkType $linkType, LinkType $moveTo): bool { - if (!is_null($moveTo->id)) { + if (null !== $moveTo->id) { TransactionJournalLink::where('link_type_id', $linkType->id)->update(['link_type_id' => $moveTo->id]); } $linkType->delete(); @@ -85,7 +82,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface public function find(int $id): LinkType { $linkType = LinkType::find($id); - if (is_null($linkType)) { + if (null === $linkType) { return new LinkType; } @@ -105,9 +102,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface $count = TransactionJournalLink::whereDestinationId($one->id)->whereSourceId($two->id)->count(); $opposingCount = TransactionJournalLink::whereDestinationId($two->id)->whereSourceId($one->id)->count(); - return ($count + $opposingCount > 0); - - + return $count + $opposingCount > 0; } /** @@ -187,6 +182,5 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface $linkType->save(); return $linkType; - } } diff --git a/app/Repositories/LinkType/LinkTypeRepositoryInterface.php b/app/Repositories/LinkType/LinkTypeRepositoryInterface.php index cfc44b4f14..b917cec351 100644 --- a/app/Repositories/LinkType/LinkTypeRepositoryInterface.php +++ b/app/Repositories/LinkType/LinkTypeRepositoryInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\LinkType; @@ -29,9 +28,7 @@ use FireflyIII\Models\TransactionJournalLink; use Illuminate\Support\Collection; /** - * Interface LinkTypeRepositoryInterface - * - * @package FireflyIII\Repositories\LinkType + * Interface LinkTypeRepositoryInterface. */ interface LinkTypeRepositoryInterface { @@ -109,5 +106,4 @@ interface LinkTypeRepositoryInterface * @return LinkType */ public function update(LinkType $linkType, array $data): LinkType; - } diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php index 8af13cbd28..49f2852217 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/PiggyBank/PiggyBankRepository.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\PiggyBank; @@ -34,13 +33,10 @@ use Illuminate\Support\Collection; use Log; /** - * Class PiggyBankRepository - * - * @package FireflyIII\Repositories\PiggyBank + * Class PiggyBankRepository. */ class PiggyBankRepository implements PiggyBankRepositoryInterface { - /** @var User */ private $user; @@ -142,6 +138,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface * @param PiggyBank $piggyBank * * @return bool + * * @throws \Exception */ public function destroy(PiggyBank $piggyBank): bool @@ -159,7 +156,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface public function find(int $piggyBankid): PiggyBank { $piggyBank = $this->user->piggyBanks()->where('piggy_banks.id', $piggyBankid)->first(['piggy_banks.*']); - if (!is_null($piggyBank)) { + if (null !== $piggyBank) { return $piggyBank; } @@ -200,9 +197,8 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface Log::debug(sprintf('Account #%d is the source, so will remove amount from piggy bank.', $piggyBank->account_id)); } - // if the amount is positive, make sure it fits in piggy bank: - if (bccomp($amount, '0') === 1 && bccomp($room, $amount) === -1) { + if (1 === bccomp($amount, '0') && bccomp($room, $amount) === -1) { // amount is positive and $room is smaller than $amount Log::debug(sprintf('Room in piggy bank for extra money is %f', $room)); Log::debug(sprintf('There is NO room to add %f to piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name)); @@ -212,7 +208,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface } // amount is negative and $currentamount is smaller than $amount - if (bccomp($amount, '0') === -1 && bccomp($compare, $amount) === 1) { + if (bccomp($amount, '0') === -1 && 1 === bccomp($compare, $amount)) { Log::debug(sprintf('Max amount to remove is %f', $repetition->currentamount)); Log::debug(sprintf('Cannot remove %f from piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name)); Log::debug(sprintf('New amount is %f', $compare)); @@ -269,7 +265,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface public function getRepetition(PiggyBank $piggyBank, Carbon $date): PiggyBankRepetition { $repetition = $piggyBank->piggyBankRepetitions()->relevantOnDate($date)->first(); - if (is_null($repetition)) { + if (null === $repetition) { return new PiggyBankRepetition; } @@ -313,7 +309,6 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface } /** - * * set id of piggy bank. * * @param int $piggyBankId @@ -365,7 +360,6 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface */ public function update(PiggyBank $piggyBank, array $data): PiggyBank { - $piggyBank->name = $data['name']; $piggyBank->account_id = intval($data['account_id']); $piggyBank->targetamount = round($data['targetamount'], 2); @@ -380,7 +374,6 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface // remove money from the rep. $repetition = $piggyBank->currentRelevantRep(); if ($repetition->currentamount > $piggyBank->targetamount) { - $diff = bcsub($piggyBank->targetamount, $repetition->currentamount); $this->createEvent($piggyBank, $diff); @@ -399,16 +392,16 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface */ private function updateNote(PiggyBank $piggyBank, string $note): bool { - if (strlen($note) === 0) { + if (0 === strlen($note)) { $dbNote = $piggyBank->notes()->first(); - if (!is_null($dbNote)) { + if (null !== $dbNote) { $dbNote->delete(); } return true; } $dbNote = $piggyBank->notes()->first(); - if (is_null($dbNote)) { + if (null === $dbNote) { $dbNote = new Note(); $dbNote->noteable()->associate($piggyBank); } diff --git a/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php b/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php index 2c6b335908..1219552227 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php +++ b/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\PiggyBank; @@ -32,9 +31,7 @@ use FireflyIII\User; use Illuminate\Support\Collection; /** - * Interface PiggyBankRepositoryInterface - * - * @package FireflyIII\Repositories\PiggyBank + * Interface PiggyBankRepositoryInterface. */ interface PiggyBankRepositoryInterface { diff --git a/app/Repositories/Rule/RuleRepository.php b/app/Repositories/Rule/RuleRepository.php index 5c5ccb4ab7..8f58c366ce 100644 --- a/app/Repositories/Rule/RuleRepository.php +++ b/app/Repositories/Rule/RuleRepository.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Rule; @@ -31,9 +30,7 @@ use FireflyIII\Models\RuleTrigger; use FireflyIII\User; /** - * Class RuleRepository - * - * @package FireflyIII\Repositories\Rule + * Class RuleRepository. */ class RuleRepository implements RuleRepositoryInterface { @@ -74,7 +71,7 @@ class RuleRepository implements RuleRepositoryInterface public function find(int $ruleId): Rule { $rule = $this->user->rules()->find($ruleId); - if (is_null($rule)) { + if (null === $rule) { return new Rule; } @@ -82,7 +79,7 @@ class RuleRepository implements RuleRepositoryInterface } /** - * FIxXME can return null + * FIxXME can return null. * * @return RuleGroup */ @@ -105,12 +102,13 @@ class RuleRepository implements RuleRepositoryInterface * @param Rule $rule * * @return string + * * @throws FireflyException */ public function getPrimaryTrigger(Rule $rule): string { $count = $rule->ruleTriggers()->count(); - if ($count === 0) { + if (0 === $count) { throw new FireflyException('Rules should have more than zero triggers, rule #' . $rule->id . ' has none!'); } @@ -133,7 +131,6 @@ class RuleRepository implements RuleRepositoryInterface $other->save(); } - $rule->order = ($rule->order + 1); $rule->save(); $this->resetRulesInGroupOrder($rule->ruleGroup); @@ -176,10 +173,10 @@ class RuleRepository implements RuleRepositoryInterface foreach ($ids as $actionId) { /** @var RuleTrigger $trigger */ $action = $rule->ruleActions()->find($actionId); - if (!is_null($action)) { + if (null !== $action) { $action->order = $order; $action->save(); - $order++; + ++$order; } } @@ -198,10 +195,10 @@ class RuleRepository implements RuleRepositoryInterface foreach ($ids as $triggerId) { /** @var RuleTrigger $trigger */ $trigger = $rule->ruleTriggers()->find($triggerId); - if (!is_null($trigger)) { + if (null !== $trigger) { $trigger->order = $order; $trigger->save(); - $order++; + ++$order; } } @@ -226,11 +223,10 @@ class RuleRepository implements RuleRepositoryInterface foreach ($set as $entry) { $entry->order = $count; $entry->save(); - $count++; + ++$count; } return true; - } /** @@ -261,7 +257,7 @@ class RuleRepository implements RuleRepositoryInterface $rule->rule_group_id = $data['rule_group_id']; $rule->order = ($order + 1); $rule->active = 1; - $rule->stop_processing = intval($data['stop_processing']) === 1; + $rule->stop_processing = 1 === intval($data['stop_processing']); $rule->title = $data['title']; $rule->description = strlen($data['description']) > 0 ? $data['description'] : null; @@ -290,10 +286,9 @@ class RuleRepository implements RuleRepositoryInterface $ruleAction->active = 1; $ruleAction->stop_processing = $values['stopProcessing']; $ruleAction->action_type = $values['action']; - $ruleAction->action_value = is_null($values['value']) ? '' : $values['value']; + $ruleAction->action_value = null === $values['value'] ? '' : $values['value']; $ruleAction->save(); - return $ruleAction; } @@ -311,7 +306,7 @@ class RuleRepository implements RuleRepositoryInterface $ruleTrigger->active = 1; $ruleTrigger->stop_processing = $values['stopProcessing']; $ruleTrigger->trigger_type = $values['action']; - $ruleTrigger->trigger_value = is_null($values['value']) ? '' : $values['value']; + $ruleTrigger->trigger_value = null === $values['value'] ? '' : $values['value']; $ruleTrigger->save(); return $ruleTrigger; @@ -345,7 +340,6 @@ class RuleRepository implements RuleRepositoryInterface // recreate actions: $this->storeActions($rule, $data); - return $rule; } @@ -373,7 +367,6 @@ class RuleRepository implements RuleRepositoryInterface } return true; - } /** @@ -407,7 +400,7 @@ class RuleRepository implements RuleRepositoryInterface ]; $this->storeTrigger($rule, $triggerValues); - $order++; + ++$order; } return true; diff --git a/app/Repositories/Rule/RuleRepositoryInterface.php b/app/Repositories/Rule/RuleRepositoryInterface.php index e2e1bc2d15..57612767d5 100644 --- a/app/Repositories/Rule/RuleRepositoryInterface.php +++ b/app/Repositories/Rule/RuleRepositoryInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Rule; @@ -30,9 +29,7 @@ use FireflyIII\Models\RuleTrigger; use FireflyIII\User; /** - * Interface RuleRepositoryInterface - * - * @package FireflyIII\Repositories\Rule + * Interface RuleRepositoryInterface. */ interface RuleRepositoryInterface { @@ -55,7 +52,6 @@ interface RuleRepositoryInterface */ public function find(int $ruleId): Rule; - /** * @return RuleGroup */ @@ -147,5 +143,4 @@ interface RuleRepositoryInterface * @return Rule */ public function update(Rule $rule, array $data): Rule; - } diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php index 77cb222201..4c45395466 100644 --- a/app/Repositories/RuleGroup/RuleGroupRepository.php +++ b/app/Repositories/RuleGroup/RuleGroupRepository.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\RuleGroup; - use FireflyIII\Models\Rule; use FireflyIII\Models\RuleGroup; use FireflyIII\User; @@ -31,9 +29,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Support\Collection; /** - * Class RuleGroupRepository - * - * @package FireflyIII\Repositories\RuleGroup + * Class RuleGroupRepository. */ class RuleGroupRepository implements RuleGroupRepositoryInterface { @@ -58,9 +54,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface { /** @var Rule $rule */ foreach ($ruleGroup->rules as $rule) { - - if (is_null($moveTo)) { - + if (null === $moveTo) { $rule->delete(); continue; } @@ -72,7 +66,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface $ruleGroup->delete(); $this->resetRuleGroupOrder(); - if (!is_null($moveTo)) { + if (null !== $moveTo) { $this->resetRulesInGroupOrder($moveTo); } @@ -87,7 +81,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface public function find(int $ruleGroupId): RuleGroup { $group = $this->user->ruleGroups()->find($ruleGroupId); - if (is_null($group)) { + if (null === $group) { return new RuleGroup; } @@ -167,7 +161,6 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface 'rules' => function (HasMany $query) { $query->orderBy('active', 'DESC'); $query->orderBy('order', 'ASC'); - }, 'rules.ruleTriggers' => function (HasMany $query) { $query->orderBy('order', 'ASC'); @@ -238,10 +231,9 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface foreach ($set as $entry) { $entry->order = $count; $entry->save(); - $count++; + ++$count; } - return true; } @@ -263,11 +255,10 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface foreach ($set as $entry) { $entry->order = $count; $entry->save(); - $count++; + ++$count; } return true; - } /** @@ -294,8 +285,6 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface 'description' => $data['description'], 'order' => ($order + 1), 'active' => 1, - - ] ); $newRuleGroup->save(); diff --git a/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php b/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php index 583f5e7508..ca9a142bc1 100644 --- a/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php +++ b/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php @@ -18,27 +18,20 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\RuleGroup; - use FireflyIII\Models\RuleGroup; use FireflyIII\User; use Illuminate\Support\Collection; /** - * Interface RuleGroupRepositoryInterface - * - * @package FireflyIII\Repositories\RuleGroup + * Interface RuleGroupRepositoryInterface. */ interface RuleGroupRepositoryInterface { - /** - * - * * @return int */ public function count(): int; @@ -141,6 +134,4 @@ interface RuleGroupRepositoryInterface * @return RuleGroup */ public function update(RuleGroup $ruleGroup, array $data): RuleGroup; - - } diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php index 8fa5f3cf4f..05f4807096 100644 --- a/app/Repositories/Tag/TagRepository.php +++ b/app/Repositories/Tag/TagRepository.php @@ -18,13 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Tag; - use Carbon\Carbon; +use DB; use FireflyIII\Helpers\Collector\JournalCollectorInterface; use FireflyIII\Helpers\Filter\InternalTransferFilter; use FireflyIII\Models\Tag; @@ -35,18 +34,14 @@ use Illuminate\Support\Collection; use Log; /** - * Class TagRepository - * - * @package FireflyIII\Repositories\Tag + * Class TagRepository. */ class TagRepository implements TagRepositoryInterface { - /** @var User */ private $user; /** - * * @param TransactionJournal $journal * @param Tag $tag * @@ -54,9 +49,7 @@ class TagRepository implements TagRepositoryInterface */ public function connect(TransactionJournal $journal, Tag $tag): bool { - /* - * Already connected: - */ + // Already connected: if ($journal->tags()->find($tag->id)) { Log::info(sprintf('Tag #%d is already connected to journal #%d.', $tag->id, $journal->id)); @@ -116,7 +109,7 @@ class TagRepository implements TagRepositoryInterface public function find(int $tagId): Tag { $tag = $this->user->tags()->find($tagId); - if (is_null($tag)) { + if (null === $tag) { $tag = new Tag; } @@ -131,7 +124,7 @@ class TagRepository implements TagRepositoryInterface public function findByTag(string $tag): Tag { $tags = $this->user->tags()->get(); - /** @var Tag $tag */ + // @var Tag $tag foreach ($tags as $databaseTag) { if ($databaseTag->tag === $tag) { return $databaseTag; @@ -149,7 +142,7 @@ class TagRepository implements TagRepositoryInterface public function firstUseDate(Tag $tag): Carbon { $journal = $tag->transactionJournals()->orderBy('date', 'ASC')->first(); - if (!is_null($journal)) { + if (null !== $journal) { return $journal->date; } @@ -190,7 +183,7 @@ class TagRepository implements TagRepositoryInterface public function lastUseDate(Tag $tag): Carbon { $journal = $tag->transactionJournals()->orderBy('date', 'DESC')->first(); - if (!is_null($journal)) { + if (null !== $journal) { return $journal->date; } @@ -251,8 +244,6 @@ class TagRepository implements TagRepositoryInterface $tag->save(); return $tag; - - } /** @@ -267,7 +258,7 @@ class TagRepository implements TagRepositoryInterface /** @var JournalCollectorInterface $collector */ $collector = app(JournalCollectorInterface::class); - if (!is_null($start) && !is_null($end)) { + if (null !== $start && null !== $end) { $collector->setRange($start, $end); } @@ -293,7 +284,7 @@ class TagRepository implements TagRepositoryInterface /** @var JournalCollectorInterface $collector */ $collector = app(JournalCollectorInterface::class); - if (!is_null($start) && !is_null($end)) { + if (null !== $start && null !== $end) { $collector->setRange($start, $end); } @@ -310,7 +301,7 @@ class TagRepository implements TagRepositoryInterface foreach ($journals as $journal) { $amount = app('steam')->positive(strval($journal->transaction_amount)); $type = $journal->transaction_type_type; - if ($type === TransactionType::WITHDRAWAL) { + if (TransactionType::WITHDRAWAL === $type) { $amount = bcmul($amount, '-1'); } $sums[$type] = bcadd($sums[$type], $amount); @@ -328,48 +319,68 @@ class TagRepository implements TagRepositoryInterface */ public function tagCloud(?int $year): array { + // Some vars $min = null; - $max = 0; - $query = $this->user->tags(); + $max = '0'; $return = []; - Log::debug('Going to build tag-cloud'); - if (!is_null($year)) { - Log::debug(sprintf('Year is not null: %d', $year)); + // get all tags + $allTags = $this->user->tags(); + // get tags with a certain amount (in this range): + $query = $this->user->tags() + ->leftJoin('tag_transaction_journal', 'tag_transaction_journal.tag_id', '=', 'tags.id') + ->leftJoin('transaction_journals', 'tag_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') + ->leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->where('transactions.amount', '>', 0) + ->groupBy(['tags.id', 'tags.tag']); + + // add date range (or not): + if (null === $year) { + $query->whereNull('tags.date'); + $allTags->whereNull('tags.date'); + } + if (null !== $year) { $start = $year . '-01-01'; $end = $year . '-12-31'; - $query->where('date', '>=', $start)->where('date', '<=', $end); + $query->where('tags.date', '>=', $start)->where('tags.date', '<=', $end); + $allTags->where('tags.date', '>=', $start)->where('tags.date', '<=', $end); } - if (is_null($year)) { - $query->whereNull('date'); - Log::debug('Year is NULL'); + $set = $query->get(['tags.id', DB::raw('SUM(transactions.amount) as amount_sum')]); + $tagsWithAmounts = []; + /** @var Tag $tag */ + foreach ($set as $tag) { + $tagsWithAmounts[$tag->id] = strval($tag->amount_sum); } - $tags = $query->orderBy('id', 'desc')->get(); + + $tags = $allTags->orderBy('tags.id', 'desc')->get(['tags.id', 'tags.tag']); $temporary = []; - Log::debug(sprintf('Found %d tags', $tags->count())); /** @var Tag $tag */ foreach ($tags as $tag) { - $amount = floatval($this->sumOfTag($tag, null, null)); - $min = $amount < $min || is_null($min) ? $amount : $min; - $max = $amount > $max ? $amount : $max; + $amount = $tagsWithAmounts[$tag->id] ?? '0'; + if (null === $min) { + $min = $amount; + } + $max = 1 === bccomp($amount, $max) ? $amount : $max; + $min = bccomp($amount, $min) === -1 ? $amount : $min; + $temporary[] = [ 'amount' => $amount, - 'tag' => $tag, + 'tag' => [ + 'id' => $tag->id, + 'tag' => $tag->tag, + ], ]; - Log::debug(sprintf('Now working on tag %s with total amount %s', $tag->tag, $amount)); - Log::debug(sprintf('Minimum is now %f, maximum is %f', $min, $max)); } + /** @var array $entry */ foreach ($temporary as $entry) { - $scale = $this->cloudScale([12, 20], $entry['amount'], $min, $max); - $tagId = $entry['tag']->id; + $scale = $this->cloudScale([12, 20], floatval($entry['amount']), floatval($min), floatval($max)); + $tagId = $entry['tag']['id']; $return[$tagId] = [ 'scale' => $scale, 'tag' => $entry['tag'], ]; } - Log::debug('DONE with tagcloud'); - return $return; } @@ -402,28 +413,23 @@ class TagRepository implements TagRepositoryInterface */ private function cloudScale(array $range, float $amount, float $min, float $max): int { - Log::debug(sprintf('Now in cloudScale with %s as amount and %f min, %f max', $amount, $min, $max)); $amountDiff = $max - $min; - Log::debug(sprintf('AmountDiff is %f', $amountDiff)); // no difference? Every tag same range: - if ($amountDiff === 0.0) { - Log::debug(sprintf('AmountDiff is zero, return %d', $range[0])); - + if (0.0 === $amountDiff) { return $range[0]; } $diff = $range[1] - $range[0]; $step = 1; - if ($diff != 0) { + if (0 != $diff) { $step = $amountDiff / $diff; } - if ($step == 0) { + if (0 == $step) { $step = 1; } $extra = round($amount / $step); - return intval($range[0] + $extra); } } diff --git a/app/Repositories/Tag/TagRepositoryInterface.php b/app/Repositories/Tag/TagRepositoryInterface.php index 610700f3be..814fb87036 100644 --- a/app/Repositories/Tag/TagRepositoryInterface.php +++ b/app/Repositories/Tag/TagRepositoryInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\Tag; @@ -29,15 +28,11 @@ use FireflyIII\Models\TransactionJournal; use FireflyIII\User; use Illuminate\Support\Collection; - /** - * Interface TagRepositoryInterface - * - * @package FireflyIII\Repositories\Tag + * Interface TagRepositoryInterface. */ interface TagRepositoryInterface { - /** * This method will connect a journal with a tag. * diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.php index ce8591e899..45c567ca2d 100644 --- a/app/Repositories/User/UserRepository.php +++ b/app/Repositories/User/UserRepository.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\User; - use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\Role; use FireflyIII\User; @@ -32,13 +30,10 @@ use Log; use Preferences; /** - * Class UserRepository - * - * @package FireflyIII\Repositories\User + * Class UserRepository. */ class UserRepository implements UserRepositoryInterface { - /** * @return Collection */ @@ -154,7 +149,7 @@ class UserRepository implements UserRepositoryInterface public function find(int $userId): User { $user = User::find($userId); - if (!is_null($user)) { + if (null !== $user) { return $user; } @@ -184,14 +179,14 @@ class UserRepository implements UserRepositoryInterface // two factor: $is2faEnabled = Preferences::getForUser($user, 'twoFactorAuthEnabled', false)->data; - $has2faSecret = !is_null(Preferences::getForUser($user, 'twoFactorAuthSecret')); + $has2faSecret = null !== Preferences::getForUser($user, 'twoFactorAuthSecret'); $return['has_2fa'] = false; if ($is2faEnabled && $has2faSecret) { $return['has_2fa'] = true; } $return['is_admin'] = $user->hasRole('owner'); - $return['blocked'] = intval($user->blocked) === 1; + $return['blocked'] = 1 === intval($user->blocked); $return['blocked_code'] = $user->blocked_code; $return['accounts'] = $user->accounts()->count(); $return['journals'] = $user->transactionJournals()->count(); diff --git a/app/Repositories/User/UserRepositoryInterface.php b/app/Repositories/User/UserRepositoryInterface.php index ac5be916af..8436eee569 100644 --- a/app/Repositories/User/UserRepositoryInterface.php +++ b/app/Repositories/User/UserRepositoryInterface.php @@ -18,23 +18,18 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Repositories\User; - use FireflyIII\User; use Illuminate\Support\Collection; /** - * Interface UserRepositoryInterface - * - * @package FireflyIII\Repositories\User + * Interface UserRepositoryInterface. */ interface UserRepositoryInterface { - /** * Returns a collection of all users. * diff --git a/app/Services/Bunq/Id/BunqId.php b/app/Services/Bunq/Id/BunqId.php index ffbb7bd591..3ba845c54e 100644 --- a/app/Services/Bunq/Id/BunqId.php +++ b/app/Services/Bunq/Id/BunqId.php @@ -19,15 +19,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Id; /** - * Class BunqId - * - * @package FireflyIII\Services\Bunq\Id + * Class BunqId. */ class BunqId { @@ -49,6 +46,4 @@ class BunqId { $this->id = $id; } - - } diff --git a/app/Services/Bunq/Id/DeviceServerId.php b/app/Services/Bunq/Id/DeviceServerId.php index d0b65cbd07..a074753b55 100644 --- a/app/Services/Bunq/Id/DeviceServerId.php +++ b/app/Services/Bunq/Id/DeviceServerId.php @@ -19,18 +19,13 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Id; - /** - * Class DeviceServerId - * - * @package Bunq\Id + * Class DeviceServerId. */ class DeviceServerId extends BunqId { - } diff --git a/app/Services/Bunq/Id/DeviceSessionId.php b/app/Services/Bunq/Id/DeviceSessionId.php index db4e7fd37c..71ce07ebcc 100644 --- a/app/Services/Bunq/Id/DeviceSessionId.php +++ b/app/Services/Bunq/Id/DeviceSessionId.php @@ -18,18 +18,13 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Id; - /** - * Class DeviceSessionId - * - * @package Bunq\Id + * Class DeviceSessionId. */ class DeviceSessionId extends BunqId { - } diff --git a/app/Services/Bunq/Id/InstallationId.php b/app/Services/Bunq/Id/InstallationId.php index 45704df8a1..48a9d73170 100644 --- a/app/Services/Bunq/Id/InstallationId.php +++ b/app/Services/Bunq/Id/InstallationId.php @@ -18,18 +18,13 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Id; - /** - * Class InstallationId - * - * @package Bunq\Id + * Class InstallationId. */ class InstallationId extends BunqId { - } diff --git a/app/Services/Bunq/Object/Alias.php b/app/Services/Bunq/Object/Alias.php index 61fead70b3..7819c6bd48 100644 --- a/app/Services/Bunq/Object/Alias.php +++ b/app/Services/Bunq/Object/Alias.php @@ -18,15 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Object; /** - * Class Alias - * - * @package FireflyIII\Services\Bunq\Object + * Class Alias. */ class Alias extends BunqObject { @@ -74,6 +71,4 @@ class Alias extends BunqObject { return $this->value; } - - } diff --git a/app/Services/Bunq/Object/Amount.php b/app/Services/Bunq/Object/Amount.php index cc28b97e2e..2504bffb26 100644 --- a/app/Services/Bunq/Object/Amount.php +++ b/app/Services/Bunq/Object/Amount.php @@ -18,15 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Object; /** - * Class Amount - * - * @package FireflyIII\Services\Bunq\Object + * Class Amount. */ class Amount extends BunqObject { @@ -63,6 +60,4 @@ class Amount extends BunqObject { return $this->value; } - - } diff --git a/app/Services/Bunq/Object/Avatar.php b/app/Services/Bunq/Object/Avatar.php index 9f294302cf..0ac804bacd 100644 --- a/app/Services/Bunq/Object/Avatar.php +++ b/app/Services/Bunq/Object/Avatar.php @@ -18,17 +18,13 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Object; /** - * Class Avatar - * - * @package FireflyIII\Services\Bunq\Object + * Class Avatar. */ class Avatar extends BunqObject { - } diff --git a/app/Services/Bunq/Object/BunqObject.php b/app/Services/Bunq/Object/BunqObject.php index 04dd2eed22..a14df09963 100644 --- a/app/Services/Bunq/Object/BunqObject.php +++ b/app/Services/Bunq/Object/BunqObject.php @@ -18,17 +18,13 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Object; /** - * Class BunqObject - * - * @package FireflyIII\Services\Bunq\Object + * Class BunqObject. */ class BunqObject { - } diff --git a/app/Services/Bunq/Object/DeviceServer.php b/app/Services/Bunq/Object/DeviceServer.php index 176532e91c..f884631c0a 100644 --- a/app/Services/Bunq/Object/DeviceServer.php +++ b/app/Services/Bunq/Object/DeviceServer.php @@ -18,28 +18,26 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Object; - use Carbon\Carbon; use FireflyIII\Services\Bunq\Id\DeviceServerId; class DeviceServer extends BunqObject { - /** @var Carbon */ + /** @var Carbon */ private $created; - /** @var string */ + /** @var string */ private $description; - /** @var DeviceServerId */ + /** @var DeviceServerId */ private $id; - /** @var string */ + /** @var string */ private $ip; - /** @var string */ + /** @var string */ private $status; - /** @var Carbon */ + /** @var Carbon */ private $updated; public function __construct(array $data) @@ -69,6 +67,4 @@ class DeviceServer extends BunqObject { return $this->ip; } - - } diff --git a/app/Services/Bunq/Object/MonetaryAccountBank.php b/app/Services/Bunq/Object/MonetaryAccountBank.php index 56e05debf8..d5b60d6652 100644 --- a/app/Services/Bunq/Object/MonetaryAccountBank.php +++ b/app/Services/Bunq/Object/MonetaryAccountBank.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Object; @@ -26,35 +25,33 @@ namespace FireflyIII\Services\Bunq\Object; use Carbon\Carbon; /** - * Class MonetaryAccountBank - * - * @package FireflyIII\Services\Bunq\Object + * Class MonetaryAccountBank. */ class MonetaryAccountBank extends BunqObject { /** @var array */ private $aliases = []; - /** @var Avatar */ + /** @var Avatar */ private $avatar; - /** @var Amount */ + /** @var Amount */ private $balance; /** @var Carbon */ private $created; /** @var string */ private $currency = ''; - /** @var Amount */ + /** @var Amount */ private $dailyLimit; - /** @var Amount */ + /** @var Amount */ private $dailySpent; /** @var string */ private $description = ''; /** @var int */ private $id = 0; - /** @var MonetaryAccountProfile */ + /** @var MonetaryAccountProfile */ private $monetaryAccountProfile; /** @var array */ private $notificationFilters = []; - /** @var Amount */ + /** @var Amount */ private $overdraftLimit; /** @var string */ private $publicUuid = ''; @@ -62,7 +59,7 @@ class MonetaryAccountBank extends BunqObject private $reason = ''; /** @var string */ private $reasonDescription = ''; - /** @var MonetaryAccountSetting */ + /** @var MonetaryAccountSetting */ private $setting; /** @var string */ private $status = ''; @@ -159,5 +156,4 @@ class MonetaryAccountBank extends BunqObject { return $this->setting; } - } diff --git a/app/Services/Bunq/Object/MonetaryAccountProfile.php b/app/Services/Bunq/Object/MonetaryAccountProfile.php index 83cfffc668..8a4f436f43 100644 --- a/app/Services/Bunq/Object/MonetaryAccountProfile.php +++ b/app/Services/Bunq/Object/MonetaryAccountProfile.php @@ -18,21 +18,18 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Object; /** - * Class MonetaryAccountProfile - * - * @package FireflyIII\Services\Bunq\Object + * Class MonetaryAccountProfile. */ class MonetaryAccountProfile extends BunqObject { /** @var string */ private $profileActionRequired = ''; - /** @var Amount */ + /** @var Amount */ private $profileAmountRequired; private $profileDrain; private $profileFill; @@ -51,5 +48,4 @@ class MonetaryAccountProfile extends BunqObject return; } - } diff --git a/app/Services/Bunq/Object/MonetaryAccountSetting.php b/app/Services/Bunq/Object/MonetaryAccountSetting.php index ebf48e9970..58f44f80b0 100644 --- a/app/Services/Bunq/Object/MonetaryAccountSetting.php +++ b/app/Services/Bunq/Object/MonetaryAccountSetting.php @@ -18,15 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Object; /** - * Class MonetaryAccountSetting - * - * @package FireflyIII\Services\Bunq\Object + * Class MonetaryAccountSetting. */ class MonetaryAccountSetting extends BunqObject { @@ -74,6 +71,4 @@ class MonetaryAccountSetting extends BunqObject { return $this->restrictionChat; } - - } diff --git a/app/Services/Bunq/Object/NotificationFilter.php b/app/Services/Bunq/Object/NotificationFilter.php index be411c7544..ffcf92362c 100644 --- a/app/Services/Bunq/Object/NotificationFilter.php +++ b/app/Services/Bunq/Object/NotificationFilter.php @@ -18,15 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Object; /** - * Class NotificationFilter - * - * @package FireflyIII\Services\Bunq\Object + * Class NotificationFilter. */ class NotificationFilter extends BunqObject { @@ -37,6 +34,6 @@ class NotificationFilter extends BunqObject */ public function __construct(array $data) { + unset($data); } - } diff --git a/app/Services/Bunq/Object/ServerPublicKey.php b/app/Services/Bunq/Object/ServerPublicKey.php index dc72bc6440..b70a6ac01e 100644 --- a/app/Services/Bunq/Object/ServerPublicKey.php +++ b/app/Services/Bunq/Object/ServerPublicKey.php @@ -18,15 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Object; /** - * Class ServerPublicKey - * - * @package Bunq\Object + * Class ServerPublicKey. */ class ServerPublicKey extends BunqObject { @@ -58,6 +55,4 @@ class ServerPublicKey extends BunqObject { $this->publicKey = $publicKey; } - - } diff --git a/app/Services/Bunq/Object/UserCompany.php b/app/Services/Bunq/Object/UserCompany.php index fab73dc3ca..36f37ce4a4 100644 --- a/app/Services/Bunq/Object/UserCompany.php +++ b/app/Services/Bunq/Object/UserCompany.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Object; @@ -26,9 +25,7 @@ namespace FireflyIII\Services\Bunq\Object; use Carbon\Carbon; /** - * Class UserCompany - * - * @package FireflyIII\Services\Bunq\Object + * Class UserCompany. */ class UserCompany extends BunqObject { @@ -69,7 +66,7 @@ class UserCompany extends BunqObject private $status = ''; /** @var string */ private $subStatus = ''; - /** @var string */ + /** @var string */ private $typeOfBusinessEntity = ''; /** @var array */ private $ubos = []; @@ -102,7 +99,6 @@ class UserCompany extends BunqObject $this->sectorOfIndustry = $data['sector_of_industry'] ?? ''; $this->counterBankIban = $data['counter_bank_iban']; $this->name = $data['name']; - } /** @@ -112,6 +108,4 @@ class UserCompany extends BunqObject { return $this->id; } - - } diff --git a/app/Services/Bunq/Object/UserLight.php b/app/Services/Bunq/Object/UserLight.php index 0f64cd8737..060a257282 100644 --- a/app/Services/Bunq/Object/UserLight.php +++ b/app/Services/Bunq/Object/UserLight.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Object; @@ -26,9 +25,7 @@ namespace FireflyIII\Services\Bunq\Object; use Carbon\Carbon; /** - * Class UserLight - * - * @package FireflyIII\Services\Bunq\Object + * Class UserLight. */ class UserLight extends BunqObject { @@ -62,7 +59,7 @@ class UserLight extends BunqObject */ public function __construct(array $data) { - if (count($data) === 0) { + if (0 === count($data)) { return; } $this->id = intval($data['id']); @@ -77,5 +74,4 @@ class UserLight extends BunqObject $this->legalName = $data['legal_name']; // aliases } - } diff --git a/app/Services/Bunq/Object/UserPerson.php b/app/Services/Bunq/Object/UserPerson.php index 73482d2f6b..223dfef779 100644 --- a/app/Services/Bunq/Object/UserPerson.php +++ b/app/Services/Bunq/Object/UserPerson.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Object; @@ -26,9 +25,7 @@ namespace FireflyIII\Services\Bunq\Object; use Carbon\Carbon; /** - * Class UserPerson - * - * @package Bunq\Object + * Class UserPerson. */ class UserPerson extends BunqObject { @@ -101,7 +98,7 @@ class UserPerson extends BunqObject */ public function __construct(array $data) { - if (count($data) === 0) { + if (0 === count($data)) { return; } $this->id = intval($data['id']); @@ -147,6 +144,4 @@ class UserPerson extends BunqObject { return $this->id; } - - } diff --git a/app/Services/Bunq/Request/BunqRequest.php b/app/Services/Bunq/Request/BunqRequest.php index 9ff87c3567..dcc4a23729 100644 --- a/app/Services/Bunq/Request/BunqRequest.php +++ b/app/Services/Bunq/Request/BunqRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Request; @@ -31,15 +30,13 @@ use Requests; use Requests_Exception; /** - * Class BunqRequest - * - * @package Bunq\Request + * Class BunqRequest. */ abstract class BunqRequest { /** @var string */ protected $secret = ''; - /** @var ServerPublicKey */ + /** @var ServerPublicKey */ protected $serverPublicKey; /** @var string */ private $privateKey = ''; @@ -111,14 +108,15 @@ abstract class BunqRequest * @param string $data * * @return string + * * @throws FireflyException */ protected function generateSignature(string $method, string $uri, array $headers, string $data): string { - if (strlen($this->privateKey) === 0) { + if (0 === strlen($this->privateKey)) { throw new FireflyException('No private key present.'); } - if (strtolower($method) === 'get' || strtolower($method) === 'delete') { + if ('get' === strtolower($method) || 'delete' === strtolower($method)) { $data = ''; } @@ -127,7 +125,7 @@ abstract class BunqRequest $headersToSign = ['Cache-Control', 'User-Agent']; ksort($headers); foreach ($headers as $name => $value) { - if (in_array($name, $headersToSign) || substr($name, 0, 7) === 'X-Bunq-') { + if (in_array($name, $headersToSign) || 'X-Bunq-' === substr($name, 0, 7)) { $toSign .= sprintf("%s: %s\n", $name, $value); } } @@ -202,11 +200,12 @@ abstract class BunqRequest * @param array $headers * * @return array + * * @throws Exception */ protected function sendSignedBunqDelete(string $uri, array $headers): array { - if (strlen($this->server) === 0) { + if (0 === strlen($this->server)) { throw new FireflyException('No bunq server defined'); } @@ -216,7 +215,7 @@ abstract class BunqRequest try { $response = Requests::delete($fullUri, $headers); } catch (Requests_Exception $e) { - return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()],]]; + return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()]]]; } $body = $response->body; @@ -235,7 +234,6 @@ abstract class BunqRequest throw new FireflyException(sprintf('Could not verify signature for request to "%s"', $uri)); } - return $array; } @@ -245,11 +243,12 @@ abstract class BunqRequest * @param array $headers * * @return array + * * @throws Exception */ protected function sendSignedBunqGet(string $uri, array $data, array $headers): array { - if (strlen($this->server) === 0) { + if (0 === strlen($this->server)) { throw new FireflyException('No bunq server defined'); } @@ -260,7 +259,7 @@ abstract class BunqRequest try { $response = Requests::get($fullUri, $headers); } catch (Requests_Exception $e) { - return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()],]]; + return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()]]]; } $body = $response->body; @@ -287,6 +286,7 @@ abstract class BunqRequest * @param array $headers * * @return array + * * @throws Exception */ protected function sendSignedBunqPost(string $uri, array $data, array $headers): array @@ -298,7 +298,7 @@ abstract class BunqRequest try { $response = Requests::post($fullUri, $headers, $body); } catch (Requests_Exception $e) { - return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()],]]; + return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()]]]; } $body = $response->body; @@ -316,7 +316,6 @@ abstract class BunqRequest throw new FireflyException(sprintf('Could not verify signature for request to "%s"', $uri)); } - return $array; } @@ -332,7 +331,7 @@ abstract class BunqRequest try { $response = Requests::delete($fullUri, $headers); } catch (Requests_Exception $e) { - return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()],]]; + return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()]]]; } $body = $response->body; $array = json_decode($body, true); @@ -362,7 +361,7 @@ abstract class BunqRequest try { $response = Requests::post($fullUri, $headers, $body); } catch (Requests_Exception $e) { - return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()],]]; + return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()]]]; } $body = $response->body; $array = json_decode($body, true); @@ -375,7 +374,6 @@ abstract class BunqRequest $this->throwResponseError($array); } - return $array; } @@ -387,7 +385,7 @@ abstract class BunqRequest private function isErrorResponse(array $response): bool { $key = key($response); - if ($key === 'Error') { + if ('Error' === $key) { return true; } @@ -431,6 +429,7 @@ abstract class BunqRequest * @param int $statusCode * * @return bool + * * @throws Exception */ private function verifyServerSignature(string $body, array $headers, int $statusCode): bool @@ -440,15 +439,14 @@ abstract class BunqRequest $verifyHeaders = []; // false when no public key is present - if (is_null($this->serverPublicKey)) { + if (null === $this->serverPublicKey) { Log::error('No public key present in class, so return FALSE.'); return false; } foreach ($headers as $header => $value) { - // skip non-bunq headers or signature - if (substr($header, 0, 7) !== 'x-bunq-' || $header === 'x-bunq-server-signature') { + if ('x-bunq-' !== substr($header, 0, 7) || 'x-bunq-server-signature' === $header) { continue; } // need to have upper case variant of header: diff --git a/app/Services/Bunq/Request/DeleteDeviceSessionRequest.php b/app/Services/Bunq/Request/DeleteDeviceSessionRequest.php index fb23e334c5..750baef294 100644 --- a/app/Services/Bunq/Request/DeleteDeviceSessionRequest.php +++ b/app/Services/Bunq/Request/DeleteDeviceSessionRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Request; @@ -27,13 +26,11 @@ use FireflyIII\Services\Bunq\Token\SessionToken; use Log; /** - * Class DeleteDeviceSessionRequest - * - * @package FireflyIII\Services\Bunq\Request + * Class DeleteDeviceSessionRequest. */ class DeleteDeviceSessionRequest extends BunqRequest { - /** @var SessionToken */ + /** @var SessionToken */ private $sessionToken; /** diff --git a/app/Services/Bunq/Request/DeviceServerRequest.php b/app/Services/Bunq/Request/DeviceServerRequest.php index a2aa6f9d7d..a6d817bf7b 100644 --- a/app/Services/Bunq/Request/DeviceServerRequest.php +++ b/app/Services/Bunq/Request/DeviceServerRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Request; @@ -27,17 +26,15 @@ use FireflyIII\Services\Bunq\Id\DeviceServerId; use FireflyIII\Services\Bunq\Token\InstallationToken; /** - * Class DeviceServerRequest - * - * @package Bunq\Request + * Class DeviceServerRequest. */ class DeviceServerRequest extends BunqRequest { /** @var string */ private $description = ''; - /** @var DeviceServerId */ + /** @var DeviceServerId */ private $deviceServerId; - /** @var InstallationToken */ + /** @var InstallationToken */ private $installationToken; /** @var array */ private $permittedIps = []; diff --git a/app/Services/Bunq/Request/DeviceSessionRequest.php b/app/Services/Bunq/Request/DeviceSessionRequest.php index 88910c26af..603b795ac6 100644 --- a/app/Services/Bunq/Request/DeviceSessionRequest.php +++ b/app/Services/Bunq/Request/DeviceSessionRequest.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Request; - use FireflyIII\Services\Bunq\Id\DeviceSessionId; use FireflyIII\Services\Bunq\Object\UserCompany; use FireflyIII\Services\Bunq\Object\UserPerson; @@ -32,21 +30,19 @@ use FireflyIII\Services\Bunq\Token\SessionToken; use Log; /** - * Class DeviceSessionRequest - * - * @package FireflyIII\Services\Bunq\Request + * Class DeviceSessionRequest. */ class DeviceSessionRequest extends BunqRequest { - /** @var DeviceSessionId */ + /** @var DeviceSessionId */ private $deviceSessionId; - /** @var InstallationToken */ + /** @var InstallationToken */ private $installationToken; - /** @var SessionToken */ + /** @var SessionToken */ private $sessionToken; - /** @var UserCompany */ + /** @var UserCompany */ private $userCompany; - /** @var UserPerson */ + /** @var UserPerson */ private $userPerson; /** @@ -60,7 +56,6 @@ class DeviceSessionRequest extends BunqRequest $headers['X-Bunq-Client-Authentication'] = $this->installationToken->getToken(); $response = $this->sendSignedBunqPost($uri, $data, $headers); - $this->deviceSessionId = $this->extractDeviceSessionId($response); $this->sessionToken = $this->extractSessionToken($response); $this->userPerson = $this->extractUserPerson($response); @@ -138,7 +133,6 @@ class DeviceSessionRequest extends BunqRequest $data = $this->getKeyFromResponse('UserCompany', $response); $userCompany = new UserCompany($data); - return $userCompany; } @@ -152,9 +146,6 @@ class DeviceSessionRequest extends BunqRequest $data = $this->getKeyFromResponse('UserPerson', $response); $userPerson = new UserPerson($data); - return $userPerson; } - - } diff --git a/app/Services/Bunq/Request/InstallationTokenRequest.php b/app/Services/Bunq/Request/InstallationTokenRequest.php index 604df78d4c..8678ebb0c3 100644 --- a/app/Services/Bunq/Request/InstallationTokenRequest.php +++ b/app/Services/Bunq/Request/InstallationTokenRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Request; @@ -29,15 +28,13 @@ use FireflyIII\Services\Bunq\Token\InstallationToken; use Log; /** - * Class InstallationTokenRequest - * - * @package FireflyIII\Services\Bunq\Request + * Class InstallationTokenRequest. */ class InstallationTokenRequest extends BunqRequest { /** @var InstallationId */ private $installationId; - /** @var InstallationToken */ + /** @var InstallationToken */ private $installationToken; /** @var string */ private $publicKey = ''; @@ -48,7 +45,7 @@ class InstallationTokenRequest extends BunqRequest public function call(): void { $uri = '/v1/installation'; - $data = ['client_public_key' => $this->publicKey,]; + $data = ['client_public_key' => $this->publicKey]; $headers = $this->getDefaultHeaders(); $response = $this->sendUnsignedBunqPost($uri, $data, $headers); Log::debug('Installation request response', $response); @@ -108,7 +105,6 @@ class InstallationTokenRequest extends BunqRequest $installationId->setId(intval($data['id'])); return $installationId; - } /** @@ -118,7 +114,6 @@ class InstallationTokenRequest extends BunqRequest */ private function extractInstallationToken(array $response): InstallationToken { - $data = $this->getKeyFromResponse('Token', $response); $installationToken = new InstallationToken($data); diff --git a/app/Services/Bunq/Request/ListDeviceServerRequest.php b/app/Services/Bunq/Request/ListDeviceServerRequest.php index 40957ea306..4c82e91c8e 100644 --- a/app/Services/Bunq/Request/ListDeviceServerRequest.php +++ b/app/Services/Bunq/Request/ListDeviceServerRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Request; @@ -28,15 +27,13 @@ use FireflyIII\Services\Bunq\Token\InstallationToken; use Illuminate\Support\Collection; /** - * Class ListDeviceServerRequest - * - * @package FireflyIII\Services\Bunq\Request + * Class ListDeviceServerRequest. */ class ListDeviceServerRequest extends BunqRequest { /** @var Collection */ private $devices; - /** @var InstallationToken */ + /** @var InstallationToken */ private $installationToken; public function __construct() diff --git a/app/Services/Bunq/Request/ListMonetaryAccountRequest.php b/app/Services/Bunq/Request/ListMonetaryAccountRequest.php index f62b3bb4b0..bfdf871f32 100644 --- a/app/Services/Bunq/Request/ListMonetaryAccountRequest.php +++ b/app/Services/Bunq/Request/ListMonetaryAccountRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Request; @@ -28,15 +27,13 @@ use FireflyIII\Services\Bunq\Token\SessionToken; use Illuminate\Support\Collection; /** - * Class ListMonetaryAccountRequest - * - * @package FireflyIII\Services\Bunq\Request + * Class ListMonetaryAccountRequest. */ class ListMonetaryAccountRequest extends BunqRequest { - /** @var Collection */ + /** @var Collection */ private $monetaryAccounts; - /** @var SessionToken */ + /** @var SessionToken */ private $sessionToken; /** @var int */ private $userId = 0; @@ -86,5 +83,4 @@ class ListMonetaryAccountRequest extends BunqRequest { $this->userId = $userId; } - } diff --git a/app/Services/Bunq/Request/ListUserRequest.php b/app/Services/Bunq/Request/ListUserRequest.php index 066f6ee785..8aa9bf2407 100644 --- a/app/Services/Bunq/Request/ListUserRequest.php +++ b/app/Services/Bunq/Request/ListUserRequest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Request; @@ -29,19 +28,17 @@ use FireflyIII\Services\Bunq\Object\UserPerson; use FireflyIII\Services\Bunq\Token\SessionToken; /** - * Class ListUserRequest - * - * @package FireflyIII\Services\Bunq\Request + * Class ListUserRequest. */ class ListUserRequest extends BunqRequest { - /** @var SessionToken */ + /** @var SessionToken */ private $sessionToken; - /** @var UserCompany */ + /** @var UserCompany */ private $userCompany; - /** @var UserLight */ + /** @var UserLight */ private $userLight; - /** @var UserPerson */ + /** @var UserPerson */ private $userPerson; /** @@ -90,7 +87,6 @@ class ListUserRequest extends BunqRequest return $this->userPerson; } - /** * @param SessionToken $sessionToken */ diff --git a/app/Services/Bunq/Token/BunqToken.php b/app/Services/Bunq/Token/BunqToken.php index 5dfc0615cf..e83537fc7a 100644 --- a/app/Services/Bunq/Token/BunqToken.php +++ b/app/Services/Bunq/Token/BunqToken.php @@ -18,28 +18,24 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Token; - use Carbon\Carbon; /** - * Class BunqToken - * - * @package Bunq\Token + * Class BunqToken. */ class BunqToken { - /** @var Carbon */ + /** @var Carbon */ private $created; /** @var int */ private $id = 0; /** @var string */ private $token = ''; - /** @var Carbon */ + /** @var Carbon */ private $updated; /** @@ -96,5 +92,4 @@ class BunqToken return; } - } diff --git a/app/Services/Bunq/Token/InstallationToken.php b/app/Services/Bunq/Token/InstallationToken.php index de3d1b59bc..4bf38c4d3c 100644 --- a/app/Services/Bunq/Token/InstallationToken.php +++ b/app/Services/Bunq/Token/InstallationToken.php @@ -18,18 +18,13 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Bunq\Token; /** - * Class InstallationToken - * - * @package FireflyIII\Services\Bunq\Token + * Class InstallationToken. */ class InstallationToken extends BunqToken { - - } diff --git a/app/Services/Bunq/Token/SessionToken.php b/app/Services/Bunq/Token/SessionToken.php index 6113949fd9..129216906c 100644 --- a/app/Services/Bunq/Token/SessionToken.php +++ b/app/Services/Bunq/Token/SessionToken.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace Bunq\Token; @@ -26,11 +25,8 @@ namespace Bunq\Token; namespace FireflyIII\Services\Bunq\Token; /** - * Class SessionToken - * - * @package FireflyIII\Services\Bunq\Token + * Class SessionToken. */ class SessionToken extends BunqToken { - } diff --git a/app/Services/Currency/ExchangeRateInterface.php b/app/Services/Currency/ExchangeRateInterface.php index 1d674059e3..5e9bdfd080 100644 --- a/app/Services/Currency/ExchangeRateInterface.php +++ b/app/Services/Currency/ExchangeRateInterface.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Currency; - use Carbon\Carbon; use FireflyIII\Models\CurrencyExchangeRate; use FireflyIII\Models\TransactionCurrency; @@ -46,5 +44,4 @@ interface ExchangeRateInterface * @return mixed */ public function setUser(User $user); - } diff --git a/app/Services/Currency/FixerIO.php b/app/Services/Currency/FixerIO.php index 09f626ad9b..20f0e4bbfe 100644 --- a/app/Services/Currency/FixerIO.php +++ b/app/Services/Currency/FixerIO.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Currency; - use Carbon\Carbon; use FireflyIII\Models\CurrencyExchangeRate; use FireflyIII\Models\TransactionCurrency; @@ -33,20 +31,17 @@ use Requests; use Requests_Exception; /** - * Class FixerIO - * - * @package FireflyIII\Services\Currency + * Class FixerIO. */ class FixerIO implements ExchangeRateInterface { - /** @var User */ + /** @var User */ protected $user; public function getRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date): CurrencyExchangeRate { $uri = sprintf('https://api.fixer.io/%s?base=%s&symbols=%s', $date->format('Y-m-d'), $fromCurrency->code, $toCurrency->code); $statusCode = -1; - $body = ''; try { $result = Requests::get($uri); $statusCode = $result->status_code; @@ -58,14 +53,14 @@ class FixerIO implements ExchangeRateInterface // Requests_Exception $rate = 1.0; $content = null; - if ($statusCode !== 200) { + if (200 !== $statusCode) { Log::error(sprintf('Something went wrong. Received error code %d and body "%s" from FixerIO.', $statusCode, $body)); } // get rate from body: - if ($statusCode === 200) { + if (200 === $statusCode) { $content = json_decode($body, true); } - if (!is_null($content)) { + if (null !== $content) { $code = $toCurrency->code; $rate = isset($content['rates'][$code]) ? $content['rates'][$code] : '1'; } diff --git a/app/Services/Password/PwndVerifier.php b/app/Services/Password/PwndVerifier.php index bf4734b0e3..61cf6947b9 100644 --- a/app/Services/Password/PwndVerifier.php +++ b/app/Services/Password/PwndVerifier.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Password; @@ -28,13 +27,10 @@ use Requests; use Requests_Exception; /** - * Class PwndVerifier - * - * @package FireflyIII\Services\Password + * Class PwndVerifier. */ class PwndVerifier implements Verifier { - /** * Verify the given password against (some) service. * @@ -54,7 +50,7 @@ class PwndVerifier implements Verifier return true; } Log::debug(sprintf('Status code returned is %d', $result->status_code)); - if ($result->status_code === 404) { + if (404 === $result->status_code) { return true; } diff --git a/app/Services/Password/Verifier.php b/app/Services/Password/Verifier.php index a8636dbc14..54b5f63eb7 100644 --- a/app/Services/Password/Verifier.php +++ b/app/Services/Password/Verifier.php @@ -18,15 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Services\Password; /** - * Interface Verifier - * - * @package FireflyIII\Services\Password + * Interface Verifier. */ interface Verifier { @@ -38,5 +35,4 @@ interface Verifier * @return bool */ public function validPassword(string $password): bool; - } diff --git a/app/Support/Amount.php b/app/Support/Amount.php index bd60a13666..16b251fdec 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -18,33 +18,26 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support; use FireflyIII\Exceptions\FireflyException; -use FireflyIII\Models\Transaction as TransactionModel; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\Models\TransactionJournal; -use FireflyIII\Models\TransactionType; use FireflyIII\User; use Illuminate\Support\Collection; use Preferences as Prefs; /** - * Class Amount - * - * @package FireflyIII\Support + * Class Amount. */ class Amount { - /** * bool $sepBySpace is $localeconv['n_sep_by_space'] * int $signPosn = $localeconv['n_sign_posn'] * string $sign = $localeconv['negative_sign'] - * bool $csPrecedes = $localeconv['n_cs_precedes'] + * bool $csPrecedes = $localeconv['n_cs_precedes']. * * @param bool $sepBySpace * @param int $signPosn @@ -77,7 +70,6 @@ class Amount // AD%v_B%sCE (amount before currency) // the _ is the optional space - // switch on how to display amount: switch ($signPosn) { default: @@ -143,8 +135,7 @@ class Amount $result = $formatted . $space . $format->symbol; } - if ($coloured === true) { - + if (true === $coloured) { if ($amount > 0) { return sprintf('%s', $result); } @@ -153,8 +144,6 @@ class Amount } return sprintf('%s', $result); - - } return $result; @@ -173,7 +162,6 @@ class Amount */ public function getCurrencyCode(): string { - $cache = new CacheProperties; $cache->addProperty('getCurrencyCode'); if ($cache->has()) { @@ -183,7 +171,6 @@ class Amount $currency = TransactionCurrency::where('code', $currencyPreference->data)->first(); if ($currency) { - $cache->store($currency->code); return $currency->code; @@ -214,6 +201,7 @@ class Amount /** * @return \FireflyIII\Models\TransactionCurrency + * * @throws FireflyException */ public function getDefaultCurrency(): TransactionCurrency @@ -227,6 +215,7 @@ class Amount * @param User $user * * @return \FireflyIII\Models\TransactionCurrency + * * @throws FireflyException */ public function getDefaultCurrencyByUser(User $user): TransactionCurrency @@ -239,7 +228,7 @@ class Amount } $currencyPreference = Prefs::getForUser($user, 'currencyPreference', config('firefly.default_currency', 'EUR')); $currency = TransactionCurrency::where('code', $currencyPreference->data)->first(); - if (is_null($currency)) { + if (null === $currency) { throw new FireflyException(sprintf('No currency found with code "%s"', $currencyPreference->data)); } $cache->store($currency); @@ -257,8 +246,8 @@ class Amount */ public function getJsConfig(array $config): array { - $negative = self::getAmountJsConfig($config['n_sep_by_space'] === 1, $config['n_sign_posn'], $config['negative_sign'], $config['n_cs_precedes'] === 1); - $positive = self::getAmountJsConfig($config['p_sep_by_space'] === 1, $config['p_sign_posn'], $config['positive_sign'], $config['p_cs_precedes'] === 1); + $negative = self::getAmountJsConfig(1 === $config['n_sep_by_space'], $config['n_sign_posn'], $config['negative_sign'], 1 === $config['n_cs_precedes']); + $positive = self::getAmountJsConfig(1 === $config['p_sep_by_space'], $config['p_sign_posn'], $config['positive_sign'], 1 === $config['p_cs_precedes']); return [ 'pos' => $positive, @@ -266,141 +255,4 @@ class Amount 'zero' => $positive, ]; } - - /** - * @param TransactionJournal $journal - * @param bool $coloured - * - * @return string - */ - public function journalAmount(TransactionJournal $journal, bool $coloured = true): string - { - $amounts = []; - $transactions = $journal->transactions()->where('amount', '>', 0)->get(); - /** @var TransactionModel $transaction */ - foreach ($transactions as $transaction) { - // model some fields to fit "transactionAmount()": - $transaction->transaction_amount = $transaction->amount; - $transaction->transaction_foreign_amount = $transaction->foreign_amount; - $transaction->transaction_type_type = $journal->transactionType->type; - $transaction->transaction_currency_symbol = $transaction->transactionCurrency->symbol; - $transaction->transaction_currency_dp = $transaction->transactionCurrency->decimal_places; - if (!is_null($transaction->foreign_currency_id)) { - $transaction->foreign_currency_symbol = $transaction->foreignCurrency->symbol; - $transaction->foreign_currency_dp = $transaction->foreignCurrency->decimal_places; - } - - $amounts[] = $this->transactionAmount($transaction, $coloured); - } - - return join(' / ', $amounts); - - } - - /** - * @param TransactionJournal $journal - * @param bool $coloured - * - * @return string - */ - public function journalTotalAmount(TransactionJournal $journal, bool $coloured = true): string - { - $transactions = $journal->transactions()->where('amount', '>', 0)->get(); - $totals = []; - $type = $journal->transactionType->type; - /** @var TransactionModel $transaction */ - foreach ($transactions as $transaction) { - // model some fields to fit "transactionAmount()": - $currencyId = $transaction->transaction_currency_id; - - if (!isset($totals[$currencyId])) { - $totals[$currencyId] = [ - 'amount' => '0', - 'symbol' => $transaction->transactionCurrency->symbol, - 'dp' => $transaction->transactionCurrency->decimal_places, - ]; - } - $totals[$currencyId]['amount'] = bcadd($transaction->amount, $totals[$currencyId]['amount']); - - if (!is_null($transaction->foreign_currency_id)) { - $foreignId = $transaction->foreign_currency_id; - if (!isset($totals[$foreignId])) { - $totals[$foreignId] = [ - 'amount' => '0', - 'symbol' => $transaction->foreignCurrency->symbol, - 'dp' => $transaction->foreignCurrency->decimal_places, - ]; - } - $totals[$foreignId]['amount'] = bcadd($transaction->foreign_amount, $totals[$foreignId]['amount']); - } - } - $array = []; - foreach ($totals as $total) { - $currency = new TransactionCurrency; - $currency->symbol = $total['symbol']; - $currency->decimal_places = $total['dp']; - if ($type === TransactionType::WITHDRAWAL) { - $total['amount'] = bcmul($total['amount'], '-1'); - } - $array[] = $this->formatAnything($currency, $total['amount']); - } - - return join(' / ', $array); - - } - - /** - * This formats a transaction, IF that transaction has been "collected" using the JournalCollector. - * - * @param TransactionModel $transaction - * @param bool $coloured - * - * @return string - */ - public function transactionAmount(TransactionModel $transaction, bool $coloured = true): string - { - $amount = bcmul(app('steam')->positive(strval($transaction->transaction_amount)), '-1'); - - $format = '%s'; - - if ($transaction->transaction_type_type === TransactionType::DEPOSIT) { - $amount = bcmul($amount, '-1'); - } - - if ($transaction->transaction_type_type === TransactionType::TRANSFER) { - $amount = app('steam')->positive($amount); - $coloured = false; - $format = '%s'; - } - if ($transaction->transaction_type_type === TransactionType::OPENING_BALANCE) { - $amount = strval($transaction->transaction_amount); - } - - $currency = new TransactionCurrency; - $currency->symbol = $transaction->transaction_currency_symbol; - $currency->decimal_places = $transaction->transaction_currency_dp; - $str = sprintf($format, $this->formatAnything($currency, $amount, $coloured)); - - - if (!is_null($transaction->transaction_foreign_amount)) { - $amount = bcmul(app('steam')->positive(strval($transaction->transaction_foreign_amount)), '-1'); - if ($transaction->transaction_type_type === TransactionType::DEPOSIT) { - $amount = bcmul($amount, '-1'); - } - - - if ($transaction->transaction_type_type === TransactionType::TRANSFER) { - $amount = app('steam')->positive($amount); - $coloured = false; - $format = '%s'; - } - - $currency = new TransactionCurrency; - $currency->symbol = $transaction->foreign_currency_symbol; - $currency->decimal_places = $transaction->foreign_currency_dp; - $str .= ' (' . sprintf($format, $this->formatAnything($currency, $amount, $coloured)) . ')'; - } - - return $str; - } } diff --git a/app/Support/Binder/AccountList.php b/app/Support/Binder/AccountList.php index 9a5e786baf..d048a0f666 100644 --- a/app/Support/Binder/AccountList.php +++ b/app/Support/Binder/AccountList.php @@ -18,24 +18,19 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Binder; - use FireflyIII\Models\Account; use Illuminate\Support\Collection; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** - * Class AccountList - * - * @package FireflyIII\Support\Binder + * Class AccountList. */ class AccountList implements BinderInterface { - /** * @param $value * @param $route @@ -44,9 +39,7 @@ class AccountList implements BinderInterface */ public static function routeBinder($value, $route): Collection { - if (auth()->check()) { - $ids = explode(',', $value); // filter ids: $ids = self::filterIds($ids); diff --git a/app/Support/Binder/BinderInterface.php b/app/Support/Binder/BinderInterface.php index 2eadbef6bd..e5887a69da 100644 --- a/app/Support/Binder/BinderInterface.php +++ b/app/Support/Binder/BinderInterface.php @@ -18,15 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Binder; /** - * Interface BinderInterface - * - * @package FireflyIII\Support\Binder + * Interface BinderInterface. */ interface BinderInterface { @@ -37,5 +34,4 @@ interface BinderInterface * @return mixed */ public static function routeBinder($value, $route); - } diff --git a/app/Support/Binder/BudgetList.php b/app/Support/Binder/BudgetList.php index 835bb13448..279c0982d7 100644 --- a/app/Support/Binder/BudgetList.php +++ b/app/Support/Binder/BudgetList.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Binder; @@ -27,15 +26,11 @@ use FireflyIII\Models\Budget; use Illuminate\Support\Collection; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; - /** - * Class BudgetList - * - * @package FireflyIII\Support\Binder + * Class BudgetList. */ class BudgetList implements BinderInterface { - /** * @param $value * @param $route diff --git a/app/Support/Binder/CategoryList.php b/app/Support/Binder/CategoryList.php index 3688972bd8..2469a5c524 100644 --- a/app/Support/Binder/CategoryList.php +++ b/app/Support/Binder/CategoryList.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Binder; @@ -28,13 +27,10 @@ use Illuminate\Support\Collection; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** - * Class CategoryList - * - * @package FireflyIII\Support\Binder + * Class CategoryList. */ class CategoryList implements BinderInterface { - /** * @param $value * @param $route diff --git a/app/Support/Binder/CurrencyCode.php b/app/Support/Binder/CurrencyCode.php index 641ec4fd72..e2f810d432 100644 --- a/app/Support/Binder/CurrencyCode.php +++ b/app/Support/Binder/CurrencyCode.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Binder; @@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionCurrency; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** - * Class CurrencyCode - * - * @package FireflyIII\Support\Binder + * Class CurrencyCode. */ class CurrencyCode implements BinderInterface { - /** * @param $value * @param $route @@ -43,7 +39,7 @@ class CurrencyCode implements BinderInterface public static function routeBinder($value, $route) { $currency = TransactionCurrency::where('code', $value)->first(); - if (!is_null($currency)) { + if (null !== $currency) { return $currency; } throw new NotFoundHttpException; diff --git a/app/Support/Binder/Date.php b/app/Support/Binder/Date.php index 0499b1c5e1..d517fd1957 100644 --- a/app/Support/Binder/Date.php +++ b/app/Support/Binder/Date.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Binder; @@ -30,14 +29,10 @@ use Log; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** - * Class Date - * - * @package FireflyIII\Support\Binder + * Class Date. */ class Date implements BinderInterface { - - /** * @param $value * @param $route @@ -70,7 +65,6 @@ class Date implements BinderInterface return $fiscalHelper->startOfFiscalYear(Carbon::now()); case 'currentFiscalYearEnd': return $fiscalHelper->endOfFiscalYear(Carbon::now()); - } } } diff --git a/app/Support/Binder/JournalList.php b/app/Support/Binder/JournalList.php index a5a605423f..cb8171b9cb 100644 --- a/app/Support/Binder/JournalList.php +++ b/app/Support/Binder/JournalList.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Binder; @@ -28,13 +27,10 @@ use Illuminate\Support\Collection; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** - * Class JournalList - * - * @package FireflyIII\Support\Binder + * Class JournalList. */ class JournalList implements BinderInterface { - /** * @param $value * @param $route @@ -48,7 +44,7 @@ class JournalList implements BinderInterface /** @var \Illuminate\Support\Collection $object */ $object = TransactionJournal::whereIn('transaction_journals.id', $ids) ->where('transaction_journals.user_id', auth()->user()->id) - ->get(['transaction_journals.*',]); + ->get(['transaction_journals.*']); if ($object->count() > 0) { return $object; diff --git a/app/Support/Binder/TagList.php b/app/Support/Binder/TagList.php index 1bd98fe722..de088a0ddf 100644 --- a/app/Support/Binder/TagList.php +++ b/app/Support/Binder/TagList.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Binder; @@ -29,13 +28,10 @@ use Illuminate\Support\Collection; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** - * Class TagList - * - * @package FireflyIII\Support\Binder + * Class TagList. */ class TagList implements BinderInterface { - /** * @param $value * @param $route diff --git a/app/Support/Binder/UnfinishedJournal.php b/app/Support/Binder/UnfinishedJournal.php index 2bb983cb45..56b9c42cf5 100644 --- a/app/Support/Binder/UnfinishedJournal.php +++ b/app/Support/Binder/UnfinishedJournal.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Binder; @@ -27,14 +26,10 @@ use FireflyIII\Models\TransactionJournal; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** - * Class Date - * - * @package FireflyIII\Support\Binder + * Class Date. */ class UnfinishedJournal implements BinderInterface { - - /** * @param $value * @param $route @@ -54,6 +49,5 @@ class UnfinishedJournal implements BinderInterface } throw new NotFoundHttpException; - } } diff --git a/app/Support/CacheProperties.php b/app/Support/CacheProperties.php index c6f08cac21..2cfd0e720c 100644 --- a/app/Support/CacheProperties.php +++ b/app/Support/CacheProperties.php @@ -18,26 +18,21 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support; - use Cache; use Illuminate\Support\Collection; use Preferences as Prefs; /** - * Class CacheProperties - * - * @package FireflyIII\Support + * Class CacheProperties. */ class CacheProperties { - - /** @var string */ - protected $md5 = ''; + /** @var string */ + protected $hash = ''; /** @var Collection */ protected $properties; @@ -66,15 +61,15 @@ class CacheProperties */ public function get() { - return Cache::get($this->md5); + return Cache::get($this->hash); } /** * @return string */ - public function getMd5(): string + public function getHash(): string { - return $this->md5; + return $this->hash; } /** @@ -82,12 +77,12 @@ class CacheProperties */ public function has(): bool { - if (getenv('APP_ENV') === 'testing') { + if ('testing' === getenv('APP_ENV')) { return false; } - $this->md5(); + $this->hash(); - return Cache::has($this->md5); + return Cache::has($this->hash); } /** @@ -95,18 +90,17 @@ class CacheProperties */ public function store($data) { - Cache::forever($this->md5, $data); + Cache::forever($this->hash, $data); } /** - * @return void */ - private function md5() + private function hash() { - $this->md5 = ''; + $content = ''; foreach ($this->properties as $property) { - $this->md5 .= json_encode($property); + $content .= json_encode($property); } - $this->md5 = md5($this->md5); + $this->hash = substr(sha1($content), 0, 16); } } diff --git a/app/Support/ChartColour.php b/app/Support/ChartColour.php index f53e5c412b..3f2eb21488 100644 --- a/app/Support/ChartColour.php +++ b/app/Support/ChartColour.php @@ -18,15 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support; /** - * Class ChartColour - * - * @package FireflyIII\Support + * Class ChartColour. */ class ChartColour { diff --git a/app/Support/Domain.php b/app/Support/Domain.php index 97f0a882e6..c94e1e80b5 100644 --- a/app/Support/Domain.php +++ b/app/Support/Domain.php @@ -18,15 +18,12 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support; /** - * Class Domain - * - * @package FireflyIII\Support + * Class Domain. */ class Domain { @@ -36,7 +33,6 @@ class Domain public static function getBindables(): array { return config('firefly.bindables'); - } /** diff --git a/app/Support/Events/BillScanner.php b/app/Support/Events/BillScanner.php index 23341b0f09..21315f668a 100644 --- a/app/Support/Events/BillScanner.php +++ b/app/Support/Events/BillScanner.php @@ -18,19 +18,15 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Events; - use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Bill\BillRepositoryInterface; /** - * Class BillScanner - * - * @package FireflyIII\Support\Events + * Class BillScanner. */ class BillScanner { @@ -48,5 +44,4 @@ class BillScanner $repository->scan($bill, $journal); } } - } diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php index 9b5f04986f..0c3b5b5e1f 100644 --- a/app/Support/ExpandedForm.php +++ b/app/Support/ExpandedForm.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support; @@ -28,19 +27,14 @@ use Carbon\Carbon; use Eloquent; use Illuminate\Support\Collection; use Illuminate\Support\MessageBag; -use Input; use RuntimeException; use Session; /** - * Class ExpandedForm - * - * @package FireflyIII\Support - * + * Class ExpandedForm. */ class ExpandedForm { - /** * @param $name * @param null $value @@ -87,7 +81,7 @@ class ExpandedForm */ public function checkbox(string $name, $value = 1, $checked = null, $options = []): string { - $options['checked'] = $checked === true ? true : null; + $options['checked'] = true === $checked ? true : null; $label = $this->label($name, $options); $options = $this->expandOptionArray($name, $label, $options); $classes = $this->getHolderClasses($name); @@ -133,7 +127,6 @@ class ExpandedForm $html = view('form.file', compact('classes', 'name', 'label', 'options'))->render(); return $html; - } /** @@ -153,7 +146,6 @@ class ExpandedForm $html = view('form.integer', compact('classes', 'name', 'label', 'value', 'options'))->render(); return $html; - } /** @@ -172,11 +164,9 @@ class ExpandedForm $html = view('form.location', compact('classes', 'name', 'label', 'value', 'options'))->render(); return $html; - } /** - * * Takes any collection and tries to make a sensible select list compatible array of it. * * @param \Illuminate\Support\Collection $set @@ -193,7 +183,7 @@ class ExpandedForm $title = null; foreach ($fields as $field) { - if (isset($entry->$field) && is_null($title)) { + if (isset($entry->$field) && null === $title) { $title = $entry->$field; } } @@ -219,7 +209,7 @@ class ExpandedForm $title = null; foreach ($fields as $field) { - if (isset($entry->$field) && is_null($title)) { + if (isset($entry->$field) && null === $title) { $title = $entry->$field; } } @@ -290,11 +280,10 @@ class ExpandedForm unset($options['placeholder']); // make sure value is formatted nicely: - if (!is_null($value) && $value !== '') { + if (null !== $value && '' !== $value) { $value = round($value, $selectedCurrency->decimal_places); } - $html = view('form.non-selectable-amount', compact('selectedCurrency', 'classes', 'name', 'label', 'value', 'options'))->render(); return $html; @@ -319,12 +308,11 @@ class ExpandedForm unset($options['placeholder']); // make sure value is formatted nicely: - if (!is_null($value) && $value !== '') { + if (null !== $value && '' !== $value) { $decimals = $selectedCurrency->decimal_places ?? 2; $value = round($value, $decimals); } - $html = view('form.non-selectable-amount', compact('selectedCurrency', 'classes', 'name', 'label', 'value', 'options'))->render(); return $html; @@ -346,7 +334,7 @@ class ExpandedForm $options['step'] = 'any'; unset($options['placeholder']); - $html = view('form.number', compact( 'classes', 'name', 'label', 'value', 'options'))->render(); + $html = view('form.number', compact('classes', 'name', 'label', 'value', 'options'))->render(); return $html; } @@ -367,7 +355,7 @@ class ExpandedForm // don't care } - $previousValue = is_null($previousValue) ? 'store' : $previousValue; + $previousValue = null === $previousValue ? 'store' : $previousValue; $html = view('form.options', compact('type', 'name', 'previousValue'))->render(); return $html; @@ -387,7 +375,6 @@ class ExpandedForm $html = view('form.password', compact('classes', 'name', 'label', 'value', 'options'))->render(); return $html; - } /** @@ -426,7 +413,6 @@ class ExpandedForm $html = view('form.static', compact('classes', 'name', 'label', 'value', 'options'))->render(); return $html; - } /** @@ -464,7 +450,6 @@ class ExpandedForm $html = view('form.text', compact('classes', 'name', 'label', 'value', 'options'))->render(); return $html; - } /** @@ -484,7 +469,6 @@ class ExpandedForm $html = view('form.textarea', compact('classes', 'name', 'label', 'value', 'options'))->render(); return $html; - } /** @@ -515,10 +499,10 @@ class ExpandedForm { if (Session::has('preFilled')) { $preFilled = session('preFilled'); - $value = isset($preFilled[$name]) && is_null($value) ? $preFilled[$name] : $value; + $value = isset($preFilled[$name]) && null === $value ? $preFilled[$name] : $value; } try { - if (!is_null(request()->old($name))) { + if (null !== request()->old($name)) { $value = request()->old($name); } } catch (RuntimeException $e) { @@ -528,7 +512,6 @@ class ExpandedForm $value = $value->format('Y-m-d'); } - return $value; } @@ -539,14 +522,12 @@ class ExpandedForm */ protected function getHolderClasses(string $name): string { - /* - * Get errors from session: - */ + // Get errors from session: /** @var MessageBag $errors */ $errors = session('errors'); $classes = 'form-group'; - if (!is_null($errors) && $errors->has($name)) { + if (null !== $errors && $errors->has($name)) { $classes = 'form-group has-error has-feedback'; } @@ -567,7 +548,6 @@ class ExpandedForm $name = str_replace('[]', '', $name); return strval(trans('form.' . $name)); - } /** @@ -586,7 +566,7 @@ class ExpandedForm $value = $this->fillFieldValue($name, $value); $options['step'] = 'any'; $defaultCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency(); - $currencies = Amt::getAllCurrencies(); + $currencies = app('amount')->getAllCurrencies(); unset($options['currency']); unset($options['placeholder']); @@ -604,11 +584,10 @@ class ExpandedForm } // make sure value is formatted nicely: - if (!is_null($value) && $value !== '') { + if (null !== $value && '' !== $value) { $value = round($value, $defaultCurrency->decimal_places); } - $html = view('form.' . $view, compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render(); return $html; diff --git a/app/Support/Facades/Amount.php b/app/Support/Facades/Amount.php index 561a01375a..d60471705d 100644 --- a/app/Support/Facades/Amount.php +++ b/app/Support/Facades/Amount.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Facades; @@ -26,9 +25,7 @@ namespace FireflyIII\Support\Facades; use Illuminate\Support\Facades\Facade; /** - * Class Amount - * - * @package FireflyIII\Support\Facades + * Class Amount. */ class Amount extends Facade { @@ -41,5 +38,4 @@ class Amount extends Facade { return 'amount'; } - } diff --git a/app/Support/Facades/ExpandedForm.php b/app/Support/Facades/ExpandedForm.php index 7b382a97f3..9334a4212c 100644 --- a/app/Support/Facades/ExpandedForm.php +++ b/app/Support/Facades/ExpandedForm.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Facades; @@ -26,9 +25,7 @@ namespace FireflyIII\Support\Facades; use Illuminate\Support\Facades\Facade; /** - * Class Amount - * - * @package FireflyIII\Support\Facades + * Class Amount. */ class ExpandedForm extends Facade { @@ -41,5 +38,4 @@ class ExpandedForm extends Facade { return 'expandedform'; } - } diff --git a/app/Support/Facades/FireflyConfig.php b/app/Support/Facades/FireflyConfig.php index 6fa222424f..d8da789f1f 100644 --- a/app/Support/Facades/FireflyConfig.php +++ b/app/Support/Facades/FireflyConfig.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Facades; @@ -26,9 +25,7 @@ namespace FireflyIII\Support\Facades; use Illuminate\Support\Facades\Facade; /** - * Class FireflyConfig - * - * @package FireflyIII\Support\Facades + * Class FireflyConfig. */ class FireflyConfig extends Facade { @@ -41,5 +38,4 @@ class FireflyConfig extends Facade { return 'fireflyconfig'; } - } diff --git a/app/Support/Facades/Navigation.php b/app/Support/Facades/Navigation.php index e98f22518d..cd5ef864f3 100644 --- a/app/Support/Facades/Navigation.php +++ b/app/Support/Facades/Navigation.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Facades; @@ -26,9 +25,7 @@ namespace FireflyIII\Support\Facades; use Illuminate\Support\Facades\Facade; /** - * Class Navigation - * - * @package FireflyIII\Support\Facades + * Class Navigation. */ class Navigation extends Facade { @@ -41,5 +38,4 @@ class Navigation extends Facade { return 'navigation'; } - } diff --git a/app/Support/Facades/Preferences.php b/app/Support/Facades/Preferences.php index 2d036df025..1cb13a12d6 100644 --- a/app/Support/Facades/Preferences.php +++ b/app/Support/Facades/Preferences.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Facades; @@ -26,9 +25,7 @@ namespace FireflyIII\Support\Facades; use Illuminate\Support\Facades\Facade; /** - * Class Preferences - * - * @package FireflyIII\Support\Facades + * Class Preferences. */ class Preferences extends Facade { @@ -41,5 +38,4 @@ class Preferences extends Facade { return 'preferences'; } - } diff --git a/app/Support/Facades/Steam.php b/app/Support/Facades/Steam.php index 42eb0a82ec..cc523bff9d 100644 --- a/app/Support/Facades/Steam.php +++ b/app/Support/Facades/Steam.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Facades; @@ -26,9 +25,7 @@ namespace FireflyIII\Support\Facades; use Illuminate\Support\Facades\Facade; /** - * Class Steam - * - * @package FireflyIII\Support\Facades + * Class Steam. */ class Steam extends Facade { @@ -41,5 +38,4 @@ class Steam extends Facade { return 'steam'; } - } diff --git a/app/Support/FireflyConfig.php b/app/Support/FireflyConfig.php index 4fefbb9de1..6842300967 100644 --- a/app/Support/FireflyConfig.php +++ b/app/Support/FireflyConfig.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support; @@ -28,9 +27,7 @@ use FireflyIII\Models\Configuration; use Log; /** - * Class FireflyConfig - * - * @package FireflyIII\Support + * Class FireflyConfig. */ class FireflyConfig { @@ -38,6 +35,7 @@ class FireflyConfig * @param $name * * @return bool + * * @throws \Exception */ public function delete($name): bool @@ -72,7 +70,7 @@ class FireflyConfig return $config; } // no preference found and default is null: - if (is_null($default)) { + if (null === $default) { return null; } @@ -100,7 +98,7 @@ class FireflyConfig { Log::debug('Set new value for ', ['name' => $name]); $config = Configuration::whereName($name)->first(); - if (is_null($config)) { + if (null === $config) { Log::debug('Does not exist yet ', ['name' => $name]); $item = new Configuration; $item->name = $name; @@ -117,7 +115,5 @@ class FireflyConfig Cache::forget('ff-config-' . $name); return $config; - } - } diff --git a/app/Support/Import/Configuration/ConfigurationInterface.php b/app/Support/Import/Configuration/ConfigurationInterface.php index 66e784e6b7..14a2ecb4ae 100644 --- a/app/Support/Import/Configuration/ConfigurationInterface.php +++ b/app/Support/Import/Configuration/ConfigurationInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Import\Configuration; @@ -26,9 +25,7 @@ namespace FireflyIII\Support\Import\Configuration; use FireflyIII\Models\ImportJob; /** - * Class ConfigurationInterface - * - * @package FireflyIII\Support\Import\Configuration + * Class ConfigurationInterface. */ interface ConfigurationInterface { @@ -61,5 +58,4 @@ interface ConfigurationInterface * @return bool */ public function storeConfiguration(array $data): bool; - } diff --git a/app/Support/Import/Configuration/Csv/Initial.php b/app/Support/Import/Configuration/Csv/Initial.php index c6f770e777..dff977be5c 100644 --- a/app/Support/Import/Configuration/Csv/Initial.php +++ b/app/Support/Import/Configuration/Csv/Initial.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Import\Configuration\Csv; @@ -31,9 +30,7 @@ use FireflyIII\Support\Import\Configuration\ConfigurationInterface; use Log; /** - * Class CsvInitial - * - * @package FireflyIII\Support\Import\Configuration + * Class CsvInitial. */ class Initial implements ConfigurationInterface { @@ -109,23 +106,22 @@ class Initial implements ConfigurationInterface $importId = $data['csv_import_account'] ?? 0; $account = $repository->find(intval($importId)); - $hasHeaders = isset($data['has_headers']) && intval($data['has_headers']) === 1 ? true : false; + $hasHeaders = isset($data['has_headers']) && 1 === intval($data['has_headers']) ? true : false; $config = $this->job->configuration; $config['initial-config-complete'] = true; $config['has-headers'] = $hasHeaders; $config['date-format'] = $data['date_format']; $config['delimiter'] = $data['csv_delimiter']; - $config['delimiter'] = $config['delimiter'] === 'tab' ? "\t" : $config['delimiter']; + $config['delimiter'] = 'tab' === $config['delimiter'] ? "\t" : $config['delimiter']; Log::debug('Entered import account.', ['id' => $importId]); - - if (!is_null($account->id)) { + if (null !== $account->id) { Log::debug('Found account.', ['id' => $account->id, 'name' => $account->name]); $config['import-account'] = $account->id; } - if (is_null($account->id)) { + if (null === $account->id) { Log::error('Could not find anything for csv_import_account.', ['id' => $importId]); } diff --git a/app/Support/Import/Configuration/Csv/Map.php b/app/Support/Import/Configuration/Csv/Map.php index f877fb525f..7aa35f62b0 100644 --- a/app/Support/Import/Configuration/Csv/Map.php +++ b/app/Support/Import/Configuration/Csv/Map.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Import\Configuration\Csv; - use FireflyIII\Exceptions\FireflyException; use FireflyIII\Import\Mapper\MapperInterface; use FireflyIII\Import\MapperPreProcess\PreProcessorInterface; @@ -34,9 +32,7 @@ use League\Csv\Reader; use Log; /** - * Class Mapping - * - * @package FireflyIII\Support\Import\Configuration\Csv + * Class Mapping. */ class Map implements ConfigurationInterface { @@ -44,13 +40,14 @@ class Map implements ConfigurationInterface private $configuration = []; /** @var array that holds each column to be mapped by the user */ private $data = []; - /** @var ImportJob */ + /** @var ImportJob */ private $job; /** @var array */ private $validSpecifics = []; /** * @return array + * * @throws FireflyException */ public function getData(): array @@ -69,7 +66,6 @@ class Map implements ConfigurationInterface $indexes = array_keys($this->data); $rowIndex = 0; foreach ($results as $rowIndex => $row) { - $row = $this->runSpecifics($row); //do something here @@ -81,10 +77,9 @@ class Map implements ConfigurationInterface } $value = $row[$index]; if (strlen($value) > 0) { - // we can do some preprocessing here, // which is exclusively to fix the tags: - if (!is_null($this->data[$index]['preProcessMap']) && strlen($this->data[$index]['preProcessMap']) > 0) { + if (null !== $this->data[$index]['preProcessMap'] && strlen($this->data[$index]['preProcessMap']) > 0) { /** @var PreProcessorInterface $preProcessor */ $preProcessor = app($this->data[$index]['preProcessMap']); $result = $preProcessor->run($value); @@ -94,7 +89,6 @@ class Map implements ConfigurationInterface Log::debug($rowIndex . ':' . $index . 'Value after preprocessor', ['value-new' => $result]); Log::debug($rowIndex . ':' . $index . 'Value after joining', ['value-complete' => $this->data[$index]['values']]); - continue; } @@ -117,7 +111,6 @@ class Map implements ConfigurationInterface $this->job->save(); return $this->data; - } /** @@ -157,7 +150,7 @@ class Map implements ConfigurationInterface $config['column-mapping-config'][$index] = []; foreach ($data as $value => $mapId) { $mapId = intval($mapId); - if ($mapId !== 0) { + if (0 !== $mapId) { $config['column-mapping-config'][$index][$value] = intval($mapId); } } @@ -195,15 +188,13 @@ class Map implements ConfigurationInterface $config = $this->job->configuration; /** - * @var int $index + * @var int * @var bool $mustBeMapped */ foreach ($config['column-do-mapping'] as $index => $mustBeMapped) { $column = $this->validateColumnName($config['column-roles'][$index] ?? '_ignore'); $shouldMap = $this->shouldMapColumn($column, $mustBeMapped); if ($shouldMap) { - - // create configuration entry for this specific column and add column to $this->data array for later processing. $this->data[$index] = [ 'name' => $column, @@ -216,7 +207,6 @@ class Map implements ConfigurationInterface } return true; - } /** @@ -230,7 +220,7 @@ class Map implements ConfigurationInterface $hasPreProcess = config('csv.import_roles.' . $column . '.pre-process-map'); $preProcessClass = config('csv.import_roles.' . $column . '.pre-process-mapper'); - if (!is_null($hasPreProcess) && $hasPreProcess === true && !is_null($preProcessClass)) { + if (null !== $hasPreProcess && true === $hasPreProcess && null !== $preProcessClass) { $name = sprintf('\\FireflyIII\\Import\\MapperPreProcess\\%s', $preProcessClass); } @@ -241,6 +231,7 @@ class Map implements ConfigurationInterface * @param array $row * * @return array + * * @throws FireflyException */ private function runSpecifics(array $row): array @@ -273,13 +264,14 @@ class Map implements ConfigurationInterface { $canBeMapped = config('csv.import_roles.' . $column . '.mappable'); - return ($canBeMapped && $mustBeMapped); + return $canBeMapped && $mustBeMapped; } /** * @param string $column * * @return string + * * @throws FireflyException */ private function validateColumnName(string $column): string diff --git a/app/Support/Import/Configuration/Csv/Roles.php b/app/Support/Import/Configuration/Csv/Roles.php index 02c0701f06..97160b430e 100644 --- a/app/Support/Import/Configuration/Csv/Roles.php +++ b/app/Support/Import/Configuration/Csv/Roles.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Import\Configuration\Csv; - use FireflyIII\Import\Specifics\SpecificInterface; use FireflyIII\Models\ImportJob; use FireflyIII\Support\Import\Configuration\ConfigurationInterface; @@ -31,14 +29,12 @@ use League\Csv\Reader; use Log; /** - * Class Roles - * - * @package FireflyIII\Support\Import\Configuration\Csv + * Class Roles. */ class Roles implements ConfigurationInterface { private $data = []; - /** @var ImportJob */ + /** @var ImportJob */ private $job; /** @var string */ @@ -76,7 +72,7 @@ class Roles implements ConfigurationInterface $count = count($row); $this->data['total'] = $count > $this->data['total'] ? $count : $this->data['total']; $this->processRow($row); - $start++; + ++$start; } $this->updateColumCount(); @@ -119,7 +115,7 @@ class Roles implements ConfigurationInterface Log::debug('Now in storeConfiguration of Roles.'); $config = $this->job->configuration; $count = $config['column-count']; - for ($i = 0; $i < $count; $i++) { + for ($i = 0; $i < $count; ++$i) { $role = $data['role'][$i] ?? '_ignore'; $mapping = isset($data['map'][$i]) && $data['map'][$i] === '1' ? true : false; $config['column-roles'][$i] = $role; @@ -127,7 +123,6 @@ class Roles implements ConfigurationInterface Log::debug(sprintf('Column %d has been given role %s', $i, $role)); } - $this->job->configuration = $config; $this->job->save(); @@ -135,7 +130,6 @@ class Roles implements ConfigurationInterface $this->setRolesComplete(); $this->isMappingNecessary(); - return true; } @@ -150,7 +144,6 @@ class Roles implements ConfigurationInterface } return $roles; - } /** @@ -160,11 +153,11 @@ class Roles implements ConfigurationInterface { $config = $this->job->configuration; $count = $config['column-count']; - for ($i = 0; $i < $count; $i++) { + for ($i = 0; $i < $count; ++$i) { $role = $config['column-roles'][$i] ?? '_ignore'; $mapping = $config['column-do-mapping'][$i] ?? false; - if ($role === '_ignore' && $mapping === true) { + if ('_ignore' === $role && true === $mapping) { $mapping = false; Log::debug(sprintf('Column %d has type %s so it cannot be mapped.', $i, $role)); } @@ -175,7 +168,6 @@ class Roles implements ConfigurationInterface $this->job->save(); return true; - } /** @@ -186,14 +178,14 @@ class Roles implements ConfigurationInterface $config = $this->job->configuration; $count = $config['column-count']; $toBeMapped = 0; - for ($i = 0; $i < $count; $i++) { + for ($i = 0; $i < $count; ++$i) { $mapping = $config['column-do-mapping'][$i] ?? false; - if ($mapping === true) { - $toBeMapped++; + if (true === $mapping) { + ++$toBeMapped; } } Log::debug(sprintf('Found %d columns that need mapping.', $toBeMapped)); - if ($toBeMapped === 0) { + if (0 === $toBeMapped) { // skip setting of map, because none need to be mapped: $config['column-mapping-complete'] = true; $this->job->configuration = $config; @@ -204,7 +196,7 @@ class Roles implements ConfigurationInterface } /** - * make unique example data + * make unique example data. */ private function makeExamplesUnique(): bool { @@ -261,12 +253,12 @@ class Roles implements ConfigurationInterface $count = $config['column-count']; $assigned = 0; $hasAmount = false; - for ($i = 0; $i < $count; $i++) { + for ($i = 0; $i < $count; ++$i) { $role = $config['column-roles'][$i] ?? '_ignore'; - if ($role !== '_ignore') { - $assigned++; + if ('_ignore' !== $role) { + ++$assigned; } - if ($role === 'amount') { + if (in_array($role, ['amount', 'amount_credit', 'amount_debet'])) { $hasAmount = true; } } @@ -276,7 +268,7 @@ class Roles implements ConfigurationInterface $this->job->save(); $this->warning = ''; } - if ($assigned === 0 || !$hasAmount) { + if (0 === $assigned || !$hasAmount) { $this->warning = strval(trans('csv.roles_warning')); } diff --git a/app/Support/Import/Information/BunqInformation.php b/app/Support/Import/Information/BunqInformation.php index d3de5bcd2a..3c76d63558 100644 --- a/app/Support/Import/Information/BunqInformation.php +++ b/app/Support/Import/Information/BunqInformation.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Import\Information; @@ -38,14 +37,11 @@ use Log; use Preferences; /** - * Class BunqInformation - * - * @package FireflyIII\Support\Import\Information + * Class BunqInformation. */ class BunqInformation implements InformationInterface { - - /** @var User */ + /** @var User */ private $user; /** @@ -83,7 +79,6 @@ class BunqInformation implements InformationInterface $return = []; /** @var MonetaryAccountBank $account */ foreach ($accounts as $account) { - $current = [ 'id' => $account->getId(), 'name' => $account->getDescription(), @@ -93,7 +88,7 @@ class BunqInformation implements InformationInterface ]; /** @var Alias $alias */ foreach ($account->getAliases() as $alias) { - if ($alias->getType() === 'IBAN') { + if ('IBAN' === $alias->getType()) { $current['number'] = $alias->getValue(); } } @@ -156,13 +151,13 @@ class BunqInformation implements InformationInterface $request->call(); return $request->getMonetaryAccounts(); - } /** * @param SessionToken $sessionToken * * @return int + * * @throws FireflyException */ private function getUserInformation(SessionToken $sessionToken): int diff --git a/app/Support/Import/Information/InformationInterface.php b/app/Support/Import/Information/InformationInterface.php index 068889f2fe..7de8e527d4 100644 --- a/app/Support/Import/Information/InformationInterface.php +++ b/app/Support/Import/Information/InformationInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Import\Information; @@ -26,13 +25,10 @@ namespace FireflyIII\Support\Import\Information; use FireflyIII\User; /** - * Interface InformationInterface - * - * @package FireflyIII\Support\Import\Information + * Interface InformationInterface. */ interface InformationInterface { - /** * Returns a collection of accounts. Preferrably, these follow a uniform Firefly III format so they can be managed over banks. * diff --git a/app/Support/Import/Prerequisites/BunqPrerequisites.php b/app/Support/Import/Prerequisites/BunqPrerequisites.php index a7b53f2f00..75614b3762 100644 --- a/app/Support/Import/Prerequisites/BunqPrerequisites.php +++ b/app/Support/Import/Prerequisites/BunqPrerequisites.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Import\Prerequisites; @@ -41,12 +40,10 @@ use Requests_Exception; /** * This class contains all the routines necessary to connect to Bunq. - * - * @package FireflyIII\Support\Import\Prerequisites */ class BunqPrerequisites implements PrerequisitesInterface { - /** @var User */ + /** @var User */ private $user; /** @@ -80,7 +77,7 @@ class BunqPrerequisites implements PrerequisitesInterface { $apiKey = Preferences::getForUser($this->user, 'bunq_api_key', false); - return ($apiKey->data === false || is_null($apiKey->data)); + return false === $apiKey->data || null === $apiKey->data; } /** @@ -149,7 +146,6 @@ class BunqPrerequisites implements PrerequisitesInterface Log::debug('Created key pair'); return; - } /** @@ -157,6 +153,7 @@ class BunqPrerequisites implements PrerequisitesInterface * to try and detect the server ID for this firefly instance. * * @return DeviceServerId + * * @throws FireflyException */ private function getExistingDevice(): DeviceServerId @@ -188,7 +185,7 @@ class BunqPrerequisites implements PrerequisitesInterface { Log::debug('Get installation token.'); $token = Preferences::getForUser($this->user, 'bunq_installation_token', null); - if (!is_null($token)) { + if (null !== $token) { return $token->data; } Log::debug('Have no token, request one.'); @@ -220,7 +217,7 @@ class BunqPrerequisites implements PrerequisitesInterface { Log::debug('get private key'); $preference = Preferences::getForUser($this->user, 'bunq_private_key', null); - if (is_null($preference)) { + if (null === $preference) { Log::debug('private key is null'); // create key pair $this->createKeyPair(); @@ -240,7 +237,7 @@ class BunqPrerequisites implements PrerequisitesInterface { Log::debug('get public key'); $preference = Preferences::getForUser($this->user, 'bunq_public_key', null); - if (is_null($preference)) { + if (null === $preference) { Log::debug('public key is null'); // create key pair $this->createKeyPair(); @@ -255,18 +252,19 @@ class BunqPrerequisites implements PrerequisitesInterface * Request users server remote IP. Let's assume this value will not change any time soon. * * @return string + * * @throws FireflyException */ private function getRemoteIp(): string { $preference = Preferences::getForUser($this->user, 'external_ip', null); - if (is_null($preference)) { + if (null === $preference) { try { $response = Requests::get('https://api.ipify.org'); } catch (Requests_Exception $e) { throw new FireflyException(sprintf('Could not retrieve external IP: %s', $e->getMessage())); } - if ($response->status_code !== 200) { + if (200 !== $response->status_code) { throw new FireflyException(sprintf('Could not retrieve external IP: %d %s', $response->status_code, $response->body)); } $serverIp = $response->body; @@ -300,7 +298,7 @@ class BunqPrerequisites implements PrerequisitesInterface Log::debug('Now in registerDevice'); $deviceServerId = Preferences::getForUser($this->user, 'bunq_device_server_id', null); $serverIp = $this->getRemoteIp(); - if (!is_null($deviceServerId)) { + if (null !== $deviceServerId) { Log::debug('Have device server ID.'); return $deviceServerId->data; @@ -324,7 +322,7 @@ class BunqPrerequisites implements PrerequisitesInterface } catch (FireflyException $e) { Log::error($e->getMessage()); } - if (is_null($deviceServerId)) { + if (null === $deviceServerId) { // try get the current from a list: $deviceServerId = $this->getExistingDevice(); } @@ -334,5 +332,4 @@ class BunqPrerequisites implements PrerequisitesInterface return $deviceServerId; } - } diff --git a/app/Support/Import/Prerequisites/PrerequisitesInterface.php b/app/Support/Import/Prerequisites/PrerequisitesInterface.php index cbbc633154..e52fad7d61 100644 --- a/app/Support/Import/Prerequisites/PrerequisitesInterface.php +++ b/app/Support/Import/Prerequisites/PrerequisitesInterface.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Import\Prerequisites; - use FireflyIII\User; use Illuminate\Http\Request; use Illuminate\Support\MessageBag; diff --git a/app/Support/Models/TransactionJournalTrait.php b/app/Support/Models/TransactionJournalTrait.php index 4bd4739672..928fa95e79 100644 --- a/app/Support/Models/TransactionJournalTrait.php +++ b/app/Support/Models/TransactionJournalTrait.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Models; - use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Transaction; @@ -36,19 +34,18 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Support\Collection; /** - * Class TransactionJournalTrait + * Class TransactionJournalTrait. * * @property int $id * @property Carbon $date * @property string $transaction_type_type * @property TransactionType $transactionType - * - * @package FireflyIII\Support\Models */ trait TransactionJournalTrait { /** * @return string + * * @throws FireflyException */ public function amount(): string @@ -101,7 +98,7 @@ trait TransactionJournalTrait public function budgetId(): int { $budget = $this->budgets()->first(); - if (!is_null($budget)) { + if (null !== $budget) { return $budget->id; } @@ -124,7 +121,7 @@ trait TransactionJournalTrait public function categoryAsString(): string { $category = $this->categories()->first(); - if (!is_null($category)) { + if (null !== $category) { return $category->name; } @@ -138,10 +135,10 @@ trait TransactionJournalTrait */ public function dateAsString(string $dateField = ''): string { - if ($dateField === '') { + if ('' === $dateField) { return $this->date->format('Y-m-d'); } - if (!is_null($this->$dateField) && $this->$dateField instanceof Carbon) { + if (null !== $this->$dateField && $this->$dateField instanceof Carbon) { // make field NULL $carbon = clone $this->$dateField; $this->$dateField = null; @@ -154,15 +151,13 @@ trait TransactionJournalTrait return $carbon->format('Y-m-d'); } $metaField = $this->getMeta($dateField); - if (!is_null($metaField)) { + if (null !== $metaField) { $carbon = new Carbon($metaField); return $carbon->format('Y-m-d'); } return ''; - - } /** @@ -208,7 +203,6 @@ trait TransactionJournalTrait } /** - * * @param string $name * * @return string @@ -229,7 +223,7 @@ trait TransactionJournalTrait public function isJoined(Builder $query, string $table): bool { $joins = $query->getQuery()->joins; - if (is_null($joins)) { + if (null === $joins) { return false; } foreach ($joins as $join) { @@ -242,19 +236,16 @@ trait TransactionJournalTrait } /** - * * @return bool */ abstract public function isOpeningBalance(): bool; /** - * * @return bool */ abstract public function isTransfer(): bool; /** - * * @return bool */ abstract public function isWithdrawal(): bool; @@ -287,7 +278,7 @@ trait TransactionJournalTrait /** * Save the model to the database. * - * @param array $options + * @param array $options * * @return bool */ diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php index 3df169a12b..158cdc16ab 100644 --- a/app/Support/Navigation.php +++ b/app/Support/Navigation.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support; @@ -27,19 +26,17 @@ use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; /** - * Class Navigation - * - * @package FireflyIII\Support + * Class Navigation. */ class Navigation { - /** * @param \Carbon\Carbon $theDate * @param $repeatFreq * @param $skip * * @return \Carbon\Carbon + * * @throws FireflyException */ public function addPeriod(Carbon $theDate, string $repeatFreq, int $skip): Carbon @@ -75,7 +72,7 @@ class Navigation // if period is 1M and diff in month is 2 and new DOM = 1, sub a day: $months = ['1M', 'month', 'monthly']; $difference = $date->month - $theDate->month; - if (in_array($repeatFreq, $months) && $difference === 2 && $date->day === 1) { + if (in_array($repeatFreq, $months) && 2 === $difference && 1 === $date->day) { $date->subDay(); } @@ -87,6 +84,7 @@ class Navigation * @param $repeatFreq * * @return \Carbon\Carbon + * * @throws FireflyException */ public function endOfPeriod(\Carbon\Carbon $end, string $repeatFreq): Carbon @@ -113,7 +111,7 @@ class Navigation // if the range is custom, the end of the period // is another X days (x is the difference between start) // and end added to $theCurrentEnd - if ($repeatFreq === 'custom') { + if ('custom' === $repeatFreq) { /** @var Carbon $tStart */ $tStart = session('start', Carbon::now()->startOfMonth()); /** @var Carbon $tEnd */ @@ -176,10 +174,9 @@ class Navigation if (isset($functionMap[$repeatFreq])) { $function = $functionMap[$repeatFreq]; $currentEnd->$function(); - } - if (!is_null($maxDate) && $currentEnd > $maxDate) { + if (null !== $maxDate && $currentEnd > $maxDate) { return clone $maxDate; } @@ -221,7 +218,6 @@ class Navigation } return $entries; - } /** @@ -229,6 +225,7 @@ class Navigation * @param $repeatFrequency * * @return string + * * @throws FireflyException */ public function periodShow(Carbon $theDate, string $repeatFrequency): string @@ -241,8 +238,6 @@ class Navigation '1W' => trans('config.week_in_year'), 'week' => trans('config.week_in_year'), 'weekly' => trans('config.week_in_year'), - //'3M' => trans('config.quarter_of_year'), - //'quarter' => trans('config.quarter_of_year'), '1M' => trans('config.month'), 'month' => trans('config.month'), 'monthly' => trans('config.month'), @@ -250,13 +245,12 @@ class Navigation 'year' => trans('config.year'), 'yearly' => trans('config.year'), '6M' => trans('config.half_year'), - ]; if (isset($formatMap[$repeatFrequency])) { return $date->formatLocalized(strval($formatMap[$repeatFrequency])); } - if ($repeatFrequency === '3M' || $repeatFrequency === 'quarter') { + if ('3M' === $repeatFrequency || 'quarter' === $repeatFrequency) { $quarter = ceil($theDate->month / 3); return sprintf('Q%d %d', $quarter, $theDate->year); @@ -310,7 +304,6 @@ class Navigation } return $format; - } /** @@ -357,7 +350,6 @@ class Navigation } return $format; - } /** @@ -381,7 +373,6 @@ class Navigation } return $format; - } /** @@ -389,6 +380,7 @@ class Navigation * @param $repeatFreq * * @return \Carbon\Carbon + * * @throws FireflyException */ public function startOfPeriod(Carbon $theDate, string $repeatFreq): Carbon @@ -417,7 +409,7 @@ class Navigation return $date; } - if ($repeatFreq === 'half-year' || $repeatFreq === '6M') { + if ('half-year' === $repeatFreq || '6M' === $repeatFreq) { $month = $date->month; $date->startOfYear(); if ($month >= 7) { @@ -426,11 +418,10 @@ class Navigation return $date; } - if ($repeatFreq === 'custom') { + if ('custom' === $repeatFreq) { return $date; // the date is already at the start. } - throw new FireflyException(sprintf('Cannot do startOfPeriod for $repeat_freq "%s"', $repeatFreq)); } @@ -440,6 +431,7 @@ class Navigation * @param int $subtract * * @return \Carbon\Carbon + * * @throws FireflyException */ public function subtractPeriod(Carbon $theDate, string $repeatFreq, int $subtract = 1): Carbon @@ -481,7 +473,7 @@ class Navigation // a custom range requires the session start // and session end to calculate the difference in days. // this is then subtracted from $theDate (* $subtract). - if ($repeatFreq === 'custom') { + if ('custom' === $repeatFreq) { /** @var Carbon $tStart */ $tStart = session('start', Carbon::now()->startOfMonth()); /** @var Carbon $tEnd */ @@ -500,6 +492,7 @@ class Navigation * @param \Carbon\Carbon $start * * @return \Carbon\Carbon + * * @throws FireflyException */ public function updateEndDate(string $range, Carbon $start): Carbon @@ -520,7 +513,7 @@ class Navigation return $end; } - if ($range === '6M') { + if ('6M' === $range) { if ($start->month >= 7) { $end->endOfYear(); @@ -538,6 +531,7 @@ class Navigation * @param \Carbon\Carbon $start * * @return \Carbon\Carbon + * * @throws FireflyException */ public function updateStartDate(string $range, Carbon $start): Carbon @@ -556,7 +550,7 @@ class Navigation return $start; } - if ($range === '6M') { + if ('6M' === $range) { if ($start->month >= 7) { $start->startOfYear()->addMonths(6); @@ -565,11 +559,7 @@ class Navigation $start->startOfYear(); return $start; - - } throw new FireflyException(sprintf('updateStartDate cannot handle range "%s"', $range)); } - - } diff --git a/app/Support/Preferences.php b/app/Support/Preferences.php index 74d59ad23e..d7aeec3970 100644 --- a/app/Support/Preferences.php +++ b/app/Support/Preferences.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support; @@ -30,9 +29,7 @@ use Illuminate\Support\Collection; use Session; /** - * Class Preferences - * - * @package FireflyIII\Support + * Class Preferences. */ class Preferences { @@ -53,6 +50,7 @@ class Preferences * @param $name * * @return bool + * * @throws \Exception */ public function delete(string $name): bool @@ -86,12 +84,13 @@ class Preferences */ public function get($name, $default = null) { + /** @var User $user */ $user = auth()->user(); - if (is_null($user)) { + if (null === $user) { return $default; } - return $this->getForUser(auth()->user(), $name, $default); + return $this->getForUser($user, $name, $default); } /** @@ -115,12 +114,11 @@ class Preferences } return $result; - } /** * @param \FireflyIII\User $user - * @param string $name + * @param string $name * @param null|string $default * * @return \FireflyIII\Models\Preference|null @@ -140,13 +138,12 @@ class Preferences return $preference; } // no preference found and default is null: - if (is_null($default)) { + if (null === $default) { // return NULL return null; } return $this->setForUser($user, $name, $default); - } /** @@ -156,7 +153,7 @@ class Preferences { $lastActivity = microtime(); $preference = $this->get('lastActivity', microtime()); - if (!is_null($preference)) { + if (null !== $preference) { $lastActivity = $preference->data; } @@ -175,15 +172,15 @@ class Preferences } /** - * @param $name - * @param $value + * @param $name + * @param $value * * @return Preference */ public function set($name, $value): Preference { $user = auth()->user(); - if (is_null($user)) { + if (null === $user) { // make new preference, return it: $pref = new Preference; $pref->name = $name; @@ -208,7 +205,7 @@ class Preferences Cache::forget($fullName); $pref = Preference::where('user_id', $user->id)->where('name', $name)->first(['id', 'name', 'data']); - if (!is_null($pref)) { + if (null !== $pref) { $pref->data = $value; $pref->save(); @@ -227,6 +224,5 @@ class Preferences Cache::forever($fullName, $pref); return $pref; - } } diff --git a/app/Support/Search/Modifier.php b/app/Support/Search/Modifier.php index fddddb9d8d..4d2271a729 100644 --- a/app/Support/Search/Modifier.php +++ b/app/Support/Search/Modifier.php @@ -18,17 +18,14 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Search; - use Carbon\Carbon; use Exception; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Transaction; -use Illuminate\Support\Str; use Log; use Steam; @@ -58,6 +55,7 @@ class Modifier * @SuppressWarnings(PHPMD.CyclomaticComplexity) * * @return bool + * * @throws FireflyException */ public static function apply(array $modifier, Transaction $transaction): bool @@ -75,16 +73,16 @@ class Modifier Log::debug(sprintf('Destination is %s? %s', $modifier['value'], var_export($res, true))); break; case 'category': - $res = self::category($transaction, $modifier['value']); + $res = self::category($transaction, $modifier['value']); Log::debug(sprintf('Category is %s? %s', $modifier['value'], var_export($res, true))); break; case 'budget': - $res = self::budget($transaction, $modifier['value']); + $res = self::budget($transaction, $modifier['value']); Log::debug(sprintf('Budget is %s? %s', $modifier['value'], var_export($res, true))); break; case 'bill': $name = Steam::tryDecrypt($transaction->bill_name); - $res = self::stringCompare($name, $modifier['value']); + $res = self::stringCompare($name, $modifier['value']); Log::debug(sprintf('Bill is %s? %s', $modifier['value'], var_export($res, true))); break; } @@ -151,11 +149,10 @@ class Modifier */ public static function stringCompare(string $haystack, string $needle): bool { - $res = !(strpos(strtolower($haystack), strtolower($needle)) === false); + $res = !(false === strpos(strtolower($haystack), strtolower($needle))); Log::debug(sprintf('"%s" is in "%s"? %s', $needle, $haystack, var_export($res, true))); return $res; - } /** @@ -167,11 +164,11 @@ class Modifier private static function budget(Transaction $transaction, string $search): bool { $journalBudget = ''; - if (!is_null($transaction->transaction_journal_budget_name)) { + if (null !== $transaction->transaction_journal_budget_name) { $journalBudget = Steam::decrypt(intval($transaction->transaction_journal_budget_encrypted), $transaction->transaction_journal_budget_name); } $transactionBudget = ''; - if (!is_null($transaction->transaction_budget_name)) { + if (null !== $transaction->transaction_budget_name) { $journalBudget = Steam::decrypt(intval($transaction->transaction_budget_encrypted), $transaction->transaction_budget_name); } @@ -187,11 +184,11 @@ class Modifier private static function category(Transaction $transaction, string $search): bool { $journalCategory = ''; - if (!is_null($transaction->transaction_journal_category_name)) { + if (null !== $transaction->transaction_journal_category_name) { $journalCategory = Steam::decrypt(intval($transaction->transaction_journal_category_encrypted), $transaction->transaction_journal_category_name); } $transactionCategory = ''; - if (!is_null($transaction->transaction_category_name)) { + if (null !== $transaction->transaction_category_name) { $journalCategory = Steam::decrypt(intval($transaction->transaction_category_encrypted), $transaction->transaction_category_name); } diff --git a/app/Support/Search/Search.php b/app/Support/Search/Search.php index 6016c7d1e4..e5aa93b4cb 100644 --- a/app/Support/Search/Search.php +++ b/app/Support/Search/Search.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Search; - use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\JournalCollectorInterface; @@ -34,9 +32,7 @@ use Illuminate\Support\Collection; use Log; /** - * Class Search - * - * @package FireflyIII\Search + * Class Search. */ class Search implements SearchInterface { @@ -44,13 +40,13 @@ class Search implements SearchInterface private $limit = 100; /** @var Collection */ private $modifiers; - /** @var string */ + /** @var string */ private $originalQuery = ''; /** @var User */ private $user; /** @var array */ private $validModifiers = []; - /** @var array */ + /** @var array */ private $words = []; /** @@ -68,7 +64,7 @@ class Search implements SearchInterface public function getWordsAsString(): string { $string = join(' ', $this->words); - if (strlen($string) === 0) { + if (0 === strlen($string)) { return is_string($this->originalQuery) ? $this->originalQuery : ''; } @@ -134,7 +130,6 @@ class Search implements SearchInterface // Filter transactions that match the given triggers. $filtered = $set->filter( function (Transaction $transaction) { - if ($this->matchModifiers($transaction)) { return $transaction; } @@ -152,7 +147,7 @@ class Search implements SearchInterface Log::debug(sprintf('Total count is now %d', $result->count())); // Update counters - $page++; + ++$page; $processed += count($set); Log::debug(sprintf('Page is now %d, processed is %d', $page, $processed)); @@ -167,7 +162,6 @@ class Search implements SearchInterface // break at some point so the script does not crash: $currentTime = microtime(true) - $startTime; Log::debug(sprintf('Have been running for %f seconds.', $currentTime)); - } while (!$reachedEndOfList && !$foundEnough && $currentTime <= 30); $result = $result->slice(0, $this->limit); @@ -238,7 +232,6 @@ class Search implements SearchInterface } } - return $collector; } @@ -248,12 +241,12 @@ class Search implements SearchInterface private function extractModifier(string $string) { $parts = explode(':', $string); - if (count($parts) === 2 && strlen(trim(strval($parts[0]))) > 0 && strlen(trim(strval($parts[1])))) { + if (2 === count($parts) && strlen(trim(strval($parts[0]))) > 0 && strlen(trim(strval($parts[1])))) { $type = trim(strval($parts[0])); $value = trim(strval($parts[1])); if (in_array($type, $this->validModifiers)) { // filter for valid type - $this->modifiers->push(['type' => $type, 'value' => $value,]); + $this->modifiers->push(['type' => $type, 'value' => $value]); } } } @@ -262,6 +255,7 @@ class Search implements SearchInterface * @param Transaction $transaction * * @return bool + * * @throws FireflyException */ private function matchModifiers(Transaction $transaction): bool @@ -281,13 +275,12 @@ class Search implements SearchInterface // then a for-each and a switch for every possible other thingie. foreach ($this->modifiers as $modifier) { $res = Modifier::apply($modifier, $transaction); - if ($res === false) { + if (false === $res) { return $res; } } return true; - } /** @@ -298,11 +291,11 @@ class Search implements SearchInterface */ private function strposArray(string $haystack, array $needle) { - if (strlen($haystack) === 0) { + if (0 === strlen($haystack)) { return false; } foreach ($needle as $what) { - if (stripos($haystack, $what) !== false) { + if (false !== stripos($haystack, $what)) { return true; } } diff --git a/app/Support/Search/SearchInterface.php b/app/Support/Search/SearchInterface.php index d87d07dbe7..f24c26cfc3 100644 --- a/app/Support/Search/SearchInterface.php +++ b/app/Support/Search/SearchInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Search; @@ -27,9 +26,7 @@ use FireflyIII\User; use Illuminate\Support\Collection; /** - * Interface SearchInterface - * - * @package FireflyIII\Support\Search + * Interface SearchInterface. */ interface SearchInterface { @@ -48,7 +45,6 @@ interface SearchInterface */ public function parseQuery(string $query); - /** * @return Collection */ diff --git a/app/Support/SingleCacheProperties.php b/app/Support/SingleCacheProperties.php new file mode 100644 index 0000000000..f0b88d108d --- /dev/null +++ b/app/Support/SingleCacheProperties.php @@ -0,0 +1,43 @@ +. + */ +declare(strict_types=1); + +namespace FireflyIII\Support; + +use Illuminate\Support\Collection; + +/** + * Class CacheProperties. + */ +class SingleCacheProperties extends CacheProperties +{ + /** + * + */ + public function __construct() + { + parent::__construct(); + $this->properties = new Collection; + if (auth()->check()) { + $this->addProperty(auth()->user()->id); + } + } +} diff --git a/app/Support/Steam.php b/app/Support/Steam.php index 4f3a55c32d..70a95bdb01 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support; @@ -32,15 +31,11 @@ use Illuminate\Contracts\Encryption\DecryptException; use Illuminate\Support\Collection; /** - * Class Steam - * - * @package FireflyIII\Support + * Class Steam. */ class Steam { - /** - * * @param \FireflyIII\Models\Account $account * @param \Carbon\Carbon $date * @@ -48,7 +43,6 @@ class Steam */ public function balance(Account $account, Carbon $date): string { - // abuse chart properties: $cache = new CacheProperties; $cache->addProperty($account->id); @@ -59,7 +53,7 @@ class Steam } $currencyId = intval($account->getMeta('currency_id')); // use system default currency: - if ($currencyId === 0) { + if (0 === $currencyId) { $currency = app('amount')->getDefaultCurrency(); $currencyId = $currency->id; } @@ -81,7 +75,7 @@ class Steam ->sum('transactions.foreign_amount') ); $balance = bcadd($nativeBalance, $foreignBalance); - $virtual = is_null($account->virtual_balance) ? '0' : strval($account->virtual_balance); + $virtual = null === $account->virtual_balance ? '0' : strval($account->virtual_balance); $balance = bcadd($balance, $virtual); $cache->store($balance); @@ -89,7 +83,6 @@ class Steam } /** - * * @param \FireflyIII\Models\Account $account * @param \Carbon\Carbon $date * @@ -97,7 +90,6 @@ class Steam */ public function balanceIgnoreVirtual(Account $account, Carbon $date): string { - // abuse chart properties: $cache = new CacheProperties; $cache->addProperty($account->id); @@ -132,7 +124,7 @@ class Steam } /** - * Gets the balance for the given account during the whole range, using this format: + * Gets the balance for the given account during the whole range, using this format:. * * [yyyy-mm-dd] => 123,2 * @@ -187,10 +179,10 @@ class Steam /** @var Transaction $entry */ foreach ($set as $entry) { // normal amount and foreign amount - $modified = is_null($entry->modified) ? '0' : strval($entry->modified); - $foreignModified = is_null($entry->modified_foreign) ? '0' : strval($entry->modified_foreign); + $modified = null === $entry->modified ? '0' : strval($entry->modified); + $foreignModified = null === $entry->modified_foreign ? '0' : strval($entry->modified_foreign); $amount = '0'; - if ($currencyId === $entry->transaction_currency_id || $currencyId === 0) { + if ($currencyId === $entry->transaction_currency_id || 0 === $currencyId) { // use normal amount: $amount = $modified; } @@ -208,8 +200,6 @@ class Steam $cache->store($balances); return $balances; - - } /** @@ -252,7 +242,7 @@ class Steam */ public function decrypt(int $isEncrypted, string $value) { - if ($isEncrypted === 1) { + if (1 === $isEncrypted) { return Crypt::decrypt($value); } @@ -287,7 +277,7 @@ class Steam */ public function negative(string $amount): string { - if (bccomp($amount, '0') === 1) { + if (1 === bccomp($amount, '0')) { $amount = bcmul($amount, '-1'); } @@ -315,21 +305,21 @@ class Steam { $string = strtolower($string); - if (!(stripos($string, 'k') === false)) { + if (!(false === stripos($string, 'k'))) { // has a K in it, remove the K and multiply by 1024. $bytes = bcmul(rtrim($string, 'kK'), '1024'); return intval($bytes); } - if (!(stripos($string, 'm') === false)) { + if (!(false === stripos($string, 'm'))) { // has a M in it, remove the M and multiply by 1048576. $bytes = bcmul(rtrim($string, 'mM'), '1048576'); return intval($bytes); } - if (!(stripos($string, 'g') === false)) { + if (!(false === stripos($string, 'g'))) { // has a G in it, remove the G and multiply by (1024)^3. $bytes = bcmul(rtrim($string, 'gG'), '1073741824'); @@ -337,8 +327,6 @@ class Steam } return intval($string); - - } /** @@ -370,5 +358,4 @@ class Steam return $value; } - } diff --git a/app/Support/Twig/AmountFormat.php b/app/Support/Twig/AmountFormat.php index d87c6bf119..98ff3509b7 100644 --- a/app/Support/Twig/AmountFormat.php +++ b/app/Support/Twig/AmountFormat.php @@ -18,29 +18,23 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Twig; - use FireflyIII\Models\Account as AccountModel; -use FireflyIII\Models\Transaction as TransactionModel; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\Models\TransactionJournal; use Twig_Extension; use Twig_SimpleFilter; use Twig_SimpleFunction; /** * Contains all amount formatting routines. - * - * @package FireflyIII\Support\Twig */ class AmountFormat extends Twig_Extension { /** - * {@inheritDoc} + * {@inheritdoc} */ public function getFilters(): array { @@ -48,27 +42,22 @@ class AmountFormat extends Twig_Extension $this->formatAmount(), $this->formatAmountPlain(), ]; - } /** - * {@inheritDoc} + * {@inheritdoc} */ public function getFunctions(): array { return [ $this->formatAmountByAccount(), $this->formatAmountBySymbol(), - $this->transactionAmount(), - $this->journalAmount(), - $this->journalTotalAmount(), $this->formatDestinationAfter(), $this->formatDestinationBefore(), $this->formatSourceAfter(), $this->formatSourceBefore(), $this->formatAmountByCurrency(), ]; - } /** @@ -82,18 +71,18 @@ class AmountFormat extends Twig_Extension } /** - * * @return Twig_SimpleFilter */ protected function formatAmount(): Twig_SimpleFilter { return new Twig_SimpleFilter( - 'formatAmount', function (string $string): string { + 'formatAmount', + function (string $string): string { + $currency = app('amount')->getDefaultCurrency(); - $currency = app('amount')->getDefaultCurrency(); - - return app('amount')->formatAnything($currency, $string, true); - }, ['is_safe' => ['html']] + return app('amount')->formatAnything($currency, $string, true); + }, + ['is_safe' => ['html']] ); } @@ -105,20 +94,20 @@ class AmountFormat extends Twig_Extension protected function formatAmountByAccount(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'formatAmountByAccount', function (AccountModel $account, string $amount, bool $coloured = true): string { - $currencyId = intval($account->getMeta('currency_id')); + 'formatAmountByAccount', + function (AccountModel $account, string $amount, bool $coloured = true): string { + $currencyId = intval($account->getMeta('currency_id')); - if ($currencyId !== 0) { - $currency = TransactionCurrency::find($currencyId); + if (0 !== $currencyId) { + $currency = TransactionCurrency::find($currencyId); + + return app('amount')->formatAnything($currency, $amount, $coloured); + } + $currency = app('amount')->getDefaultCurrency(); return app('amount')->formatAnything($currency, $amount, $coloured); - } - $currency = app('amount')->getDefaultCurrency(); - - return app('amount')->formatAnything($currency, $amount, $coloured); - - - }, ['is_safe' => ['html']] + }, + ['is_safe' => ['html']] ); } @@ -130,12 +119,11 @@ class AmountFormat extends Twig_Extension protected function formatAmountByCurrency(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'formatAmountByCurrency', function (TransactionCurrency $currency, string $amount, bool $coloured = true): string { - - return app('amount')->formatAnything($currency, $amount, $coloured); - - - }, ['is_safe' => ['html']] + 'formatAmountByCurrency', + function (TransactionCurrency $currency, string $amount, bool $coloured = true): string { + return app('amount')->formatAnything($currency, $amount, $coloured); + }, + ['is_safe' => ['html']] ); } @@ -147,16 +135,15 @@ class AmountFormat extends Twig_Extension protected function formatAmountBySymbol(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'formatAmountBySymbol', function (string $amount, string $symbol, int $decimalPlaces = 2, bool $coloured = true): string { + 'formatAmountBySymbol', + function (string $amount, string $symbol, int $decimalPlaces = 2, bool $coloured = true): string { + $currency = new TransactionCurrency; + $currency->symbol = $symbol; + $currency->decimal_places = $decimalPlaces; - $currency = new TransactionCurrency; - $currency->symbol = $symbol; - $currency->decimal_places = $decimalPlaces; - - return app('amount')->formatAnything($currency, $amount, $coloured); - - - }, ['is_safe' => ['html']] + return app('amount')->formatAnything($currency, $amount, $coloured); + }, + ['is_safe' => ['html']] ); } @@ -166,12 +153,13 @@ class AmountFormat extends Twig_Extension protected function formatAmountPlain(): Twig_SimpleFilter { return new Twig_SimpleFilter( - 'formatAmountPlain', function (string $string): string { + 'formatAmountPlain', + function (string $string): string { + $currency = app('amount')->getDefaultCurrency(); - $currency = app('amount')->getDefaultCurrency(); - - return app('amount')->formatAnything($currency, $string, false); - }, ['is_safe' => ['html']] + return app('amount')->formatAnything($currency, $string, false); + }, + ['is_safe' => ['html']] ); } @@ -181,27 +169,26 @@ class AmountFormat extends Twig_Extension protected function formatDestinationAfter(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'formatDestinationAfter', function (array $transaction): string { - - // build fake currency for main amount. - $format = new TransactionCurrency; - $format->decimal_places = $transaction['transaction_currency_dp']; - $format->symbol = $transaction['transaction_currency_symbol']; - $string = app('amount')->formatAnything($format, $transaction['destination_account_after'], true); - - // also append foreign amount for clarity: - if (!is_null($transaction['foreign_destination_amount'])) { - // build fake currency for foreign amount + 'formatDestinationAfter', + function (array $transaction): string { + // build fake currency for main amount. $format = new TransactionCurrency; - $format->decimal_places = $transaction['foreign_currency_dp']; - $format->symbol = $transaction['foreign_currency_symbol']; - $string .= ' (' . app('amount')->formatAnything($format, $transaction['foreign_destination_amount'], true) . ')'; - } + $format->decimal_places = $transaction['transaction_currency_dp']; + $format->symbol = $transaction['transaction_currency_symbol']; + $string = app('amount')->formatAnything($format, $transaction['destination_account_after'], true); + // also append foreign amount for clarity: + if (null !== $transaction['foreign_destination_amount']) { + // build fake currency for foreign amount + $format = new TransactionCurrency; + $format->decimal_places = $transaction['foreign_currency_dp']; + $format->symbol = $transaction['foreign_currency_symbol']; + $string .= ' (' . app('amount')->formatAnything($format, $transaction['foreign_destination_amount'], true) . ')'; + } - return $string; - - }, ['is_safe' => ['html']] + return $string; + }, + ['is_safe' => ['html']] ); } @@ -211,16 +198,16 @@ class AmountFormat extends Twig_Extension protected function formatDestinationBefore(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'formatDestinationBefore', function (array $transaction): string { + 'formatDestinationBefore', + function (array $transaction): string { + // build fake currency for main amount. + $format = new TransactionCurrency; + $format->decimal_places = $transaction['transaction_currency_dp']; + $format->symbol = $transaction['transaction_currency_symbol']; - // build fake currency for main amount. - $format = new TransactionCurrency; - $format->decimal_places = $transaction['transaction_currency_dp']; - $format->symbol = $transaction['transaction_currency_symbol']; - - return app('amount')->formatAnything($format, $transaction['destination_account_before'], true); - - }, ['is_safe' => ['html']] + return app('amount')->formatAnything($format, $transaction['destination_account_before'], true); + }, + ['is_safe' => ['html']] ); } @@ -230,28 +217,26 @@ class AmountFormat extends Twig_Extension protected function formatSourceAfter(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'formatSourceAfter', function (array $transaction): string { - - // build fake currency for main amount. - $format = new TransactionCurrency; - $format->decimal_places = $transaction['transaction_currency_dp']; - $format->symbol = $transaction['transaction_currency_symbol']; - $string = app('amount')->formatAnything($format, $transaction['source_account_after'], true); - - // also append foreign amount for clarity: - if (!is_null($transaction['foreign_source_amount'])) { - // build fake currency for foreign amount + 'formatSourceAfter', + function (array $transaction): string { + // build fake currency for main amount. $format = new TransactionCurrency; - $format->decimal_places = $transaction['foreign_currency_dp']; - $format->symbol = $transaction['foreign_currency_symbol']; - $string .= ' (' . app('amount')->formatAnything($format, $transaction['foreign_source_amount'], true) . ')'; - } + $format->decimal_places = $transaction['transaction_currency_dp']; + $format->symbol = $transaction['transaction_currency_symbol']; + $string = app('amount')->formatAnything($format, $transaction['source_account_after'], true); + // also append foreign amount for clarity: + if (null !== $transaction['foreign_source_amount']) { + // build fake currency for foreign amount + $format = new TransactionCurrency; + $format->decimal_places = $transaction['foreign_currency_dp']; + $format->symbol = $transaction['foreign_currency_symbol']; + $string .= ' (' . app('amount')->formatAnything($format, $transaction['foreign_source_amount'], true) . ')'; + } - return $string; - - - }, ['is_safe' => ['html']] + return $string; + }, + ['is_safe' => ['html']] ); } @@ -261,56 +246,16 @@ class AmountFormat extends Twig_Extension protected function formatSourceBefore(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'formatSourceBefore', function (array $transaction): string { + 'formatSourceBefore', + function (array $transaction): string { + // build fake currency for main amount. + $format = new TransactionCurrency; + $format->decimal_places = $transaction['transaction_currency_dp']; + $format->symbol = $transaction['transaction_currency_symbol']; - // build fake currency for main amount. - $format = new TransactionCurrency; - $format->decimal_places = $transaction['transaction_currency_dp']; - $format->symbol = $transaction['transaction_currency_symbol']; - - return app('amount')->formatAnything($format, $transaction['source_account_before'], true); - - }, ['is_safe' => ['html']] + return app('amount')->formatAnything($format, $transaction['source_account_before'], true); + }, + ['is_safe' => ['html']] ); } - - /** - * @return Twig_SimpleFunction - */ - protected function journalAmount(): Twig_SimpleFunction - { - return new Twig_SimpleFunction( - 'journalAmount', function (TransactionJournal $journal): string { - - return app('amount')->journalAmount($journal, true); - }, ['is_safe' => ['html']] - ); - } - - /** - * @return Twig_SimpleFunction - */ - protected function journalTotalAmount(): Twig_SimpleFunction - { - return new Twig_SimpleFunction( - 'journalTotalAmount', function (TransactionJournal $journal): string { - - return app('amount')->journalTotalAmount($journal, true); - }, ['is_safe' => ['html']] - ); - } - - /** - * @return Twig_SimpleFunction - */ - protected function transactionAmount(): Twig_SimpleFunction - { - return new Twig_SimpleFunction( - 'transactionAmount', function (TransactionModel $transaction): string { - - return app('amount')->transactionAmount($transaction, true); - }, ['is_safe' => ['html']] - ); - } - } diff --git a/app/Support/Twig/Extension/Transaction.php b/app/Support/Twig/Extension/Transaction.php new file mode 100644 index 0000000000..ef8e443d78 --- /dev/null +++ b/app/Support/Twig/Extension/Transaction.php @@ -0,0 +1,523 @@ +. + */ +declare(strict_types=1); + +namespace FireflyIII\Support\Twig\Extension; + +use FireflyIII\Models\AccountType; +use FireflyIII\Models\Attachment; +use FireflyIII\Models\Transaction as TransactionModel; +use FireflyIII\Models\TransactionCurrency; +use FireflyIII\Models\TransactionType; +use FireflyIII\Support\SingleCacheProperties; +use Lang; +use Twig_Extension; + +/** + * Class Transaction. + */ +class Transaction extends Twig_Extension +{ + /** + * Can show the amount of a transaction, if that transaction has been collected by the journal collector. + * + * @param TransactionModel $transaction + * + * @return string + */ + public function amount(TransactionModel $transaction): string + { + $cache = new SingleCacheProperties; + $cache->addProperty('transaction-amount'); + $cache->addProperty($transaction->id); + $cache->addProperty($transaction->updated_at); + if ($cache->has()) { + return $cache->get(); + } + + $amount = bcmul(app('steam')->positive(strval($transaction->transaction_amount)), '-1'); + $format = '%s'; + $coloured = true; + + // at this point amount is always negative. + if (TransactionType::RECONCILIATION === $transaction->transaction_type_type && 1 === bccomp(strval($transaction->transaction_amount), '0')) { + $amount = bcmul($amount, '-1'); + } + + if (TransactionType::DEPOSIT === $transaction->transaction_type_type) { + $amount = bcmul($amount, '-1'); + } + + if (TransactionType::TRANSFER === $transaction->transaction_type_type) { + $amount = app('steam')->positive($amount); + $coloured = false; + $format = '%s'; + } + if (TransactionType::OPENING_BALANCE === $transaction->transaction_type_type) { + $amount = strval($transaction->transaction_amount); + } + + $currency = new TransactionCurrency; + $currency->symbol = $transaction->transaction_currency_symbol; + $currency->decimal_places = $transaction->transaction_currency_dp; + $str = sprintf($format, app('amount')->formatAnything($currency, $amount, $coloured)); + + if (null !== $transaction->transaction_foreign_amount) { + $amount = bcmul(app('steam')->positive(strval($transaction->transaction_foreign_amount)), '-1'); + if (TransactionType::DEPOSIT === $transaction->transaction_type_type) { + $amount = bcmul($amount, '-1'); + } + + if (TransactionType::TRANSFER === $transaction->transaction_type_type) { + $amount = app('steam')->positive($amount); + $coloured = false; + $format = '%s'; + } + + $currency = new TransactionCurrency; + $currency->symbol = $transaction->foreign_currency_symbol; + $currency->decimal_places = $transaction->foreign_currency_dp; + $str .= ' (' . sprintf($format, app('amount')->formatAnything($currency, $amount, $coloured)) . ')'; + } + $cache->store($str); + + return $str; + } + + /** + * @param array $transaction + * + * @return string + */ + public function amountArray(array $transaction): string + { + $cache = new SingleCacheProperties; + $cache->addProperty('transaction-array-amount'); + $cache->addProperty($transaction['source_id']); + $cache->addProperty($transaction['destination_id']); + $cache->addProperty($transaction['updated_at']); + if ($cache->has()) { + return $cache->get(); + } + + // first display amount: + $amount = TransactionType::WITHDRAWAL === $transaction['journal_type'] ? $transaction['source_amount'] + : $transaction['destination_amount']; + $fakeCurrency = new TransactionCurrency; + $fakeCurrency->decimal_places = $transaction['transaction_currency_dp']; + $fakeCurrency->symbol = $transaction['transaction_currency_symbol']; + $string = app('amount')->formatAnything($fakeCurrency, $amount, true); + + // then display (if present) the foreign amount: + if (null !== $transaction['foreign_source_amount']) { + $amount = TransactionType::WITHDRAWAL === $transaction['journal_type'] ? $transaction['foreign_source_amount'] + : $transaction['foreign_destination_amount']; + $fakeCurrency = new TransactionCurrency; + $fakeCurrency->decimal_places = $transaction['foreign_currency_dp']; + $fakeCurrency->symbol = $transaction['foreign_currency_symbol']; + $string .= ' (' . app('amount')->formatAnything($fakeCurrency, $amount, true) . ')'; + } + $cache->store($string); + + return $string; + } + + /** + * @param TransactionModel $transaction + * + * @return string + */ + public function budgets(TransactionModel $transaction): string + { + $cache = new SingleCacheProperties; + $cache->addProperty('transaction-budgets'); + $cache->addProperty($transaction->id); + $cache->addProperty($transaction->updated_at); + if ($cache->has()) { + return $cache->get(); + } + + // journal has a budget: + if (isset($transaction->transaction_journal_budget_id)) { + $name = app('steam')->tryDecrypt($transaction->transaction_journal_budget_name); + $txt = sprintf('%s', route('budgets.show', [$transaction->transaction_journal_budget_id]), $name, $name); + $cache->store($txt); + + return $txt; + } + + // transaction has a budget + if (isset($transaction->transaction_budget_id)) { + $name = app('steam')->tryDecrypt($transaction->transaction_budget_name); + $txt = sprintf('%s', route('budgets.show', [$transaction->transaction_budget_id]), $name, $name); + $cache->store($txt); + + return $txt; + } + + // see if the transaction has a budget: + $budgets = $transaction->budgets()->get(); + if (0 === $budgets->count()) { + $budgets = $transaction->transactionJournal()->first()->budgets()->get(); + } + if ($budgets->count() > 0) { + $str = []; + foreach ($budgets as $budget) { + $str[] = sprintf('%s', route('budgets.show', [$budget->id]), $budget->name, $budget->name); + } + + $txt = join(', ', $str); + $cache->store($txt); + + return $txt; + } + $txt = ''; + $cache->store($txt); + + return $txt; + } + + /** + * @param TransactionModel $transaction + * + * @return string + */ + public function categories(TransactionModel $transaction): string + { + $cache = new SingleCacheProperties; + $cache->addProperty('transaction-categories'); + $cache->addProperty($transaction->id); + $cache->addProperty($transaction->updated_at); + if ($cache->has()) { + return $cache->get(); + } + + // journal has a category: + if (isset($transaction->transaction_journal_category_id)) { + $name = app('steam')->tryDecrypt($transaction->transaction_journal_category_name); + $txt = sprintf('%s', route('categories.show', [$transaction->transaction_journal_category_id]), $name, $name); + $cache->store($txt); + + return $txt; + } + + // transaction has a category: + if (isset($transaction->transaction_category_id)) { + $name = app('steam')->tryDecrypt($transaction->transaction_category_name); + $txt = sprintf('%s', route('categories.show', [$transaction->transaction_category_id]), $name, $name); + $cache->store($txt); + + return $txt; + } + + // see if the transaction has a category: + $categories = $transaction->categories()->get(); + if (0 === $categories->count()) { + $categories = $transaction->transactionJournal()->first()->categories()->get(); + } + if ($categories->count() > 0) { + $str = []; + foreach ($categories as $category) { + $str[] = sprintf('%s', route('categories.show', [$category->id]), $category->name, $category->name); + } + + $txt = join(', ', $str); + $cache->store($txt); + + return $txt; + } + + $txt = ''; + $cache->store($txt); + + return $txt; + } + + /** + * @param TransactionModel $transaction + * + * @return string + */ + public function description(TransactionModel $transaction): string + { + $cache = new SingleCacheProperties; + $cache->addProperty('description'); + $cache->addProperty($transaction->id); + $cache->addProperty($transaction->updated_at); + if ($cache->has()) { + return $cache->get(); + } + $description = $transaction->description; + if (strlen(strval($transaction->transaction_description)) > 0) { + $description = $transaction->transaction_description . '(' . $transaction->description . ')'; + } + + $cache->store($description); + + return $description; + } + + /** + * @param TransactionModel $transaction + * + * @return string + */ + public function destinationAccount(TransactionModel $transaction): string + { + $cache = new SingleCacheProperties; + $cache->addProperty('transaction-destination'); + $cache->addProperty($transaction->id); + $cache->addProperty($transaction->updated_at); + if ($cache->has()) { + return $cache->get(); + } + + if (TransactionType::RECONCILIATION === $transaction->transaction_type_type) { + return '—'; + } + + $name = app('steam')->tryDecrypt($transaction->account_name); + $transactionId = intval($transaction->account_id); + $type = $transaction->account_type; + + // name is present in object, use that one: + if (bccomp($transaction->transaction_amount, '0') === -1 && null !== $transaction->opposing_account_id) { + $name = $transaction->opposing_account_name; + $transactionId = intval($transaction->opposing_account_id); + $type = $transaction->opposing_account_type; + } + + // Find the opposing account and use that one: + if (bccomp($transaction->transaction_amount, '0') === -1 && null === $transaction->opposing_account_id) { + // if the amount is negative, find the opposing account and use that one: + $journalId = $transaction->journal_id; + /** @var TransactionModel $other */ + $other = TransactionModel::where('transaction_journal_id', $journalId)->where('transactions.id', '!=', $transaction->id) + ->where('amount', '=', bcmul($transaction->transaction_amount, '-1'))->where( + 'identifier', + $transaction->identifier + ) + ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') + ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') + ->first(['transactions.account_id', 'accounts.encrypted', 'accounts.name', 'account_types.type']); + $name = app('steam')->tryDecrypt($other->name); + $transactionId = $other->account_id; + $type = $other->type; + } + + if (AccountType::CASH === $type) { + $txt = '(' . trans('firefly.cash') . ')'; + $cache->store($txt); + + return $txt; + } + + $txt = sprintf('%1$s', e($name), route('accounts.show', [$transactionId])); + $cache->store($txt); + + return $txt; + } + + /** + * @param TransactionModel $transaction + * + * @return string + */ + public function hasAttachments(TransactionModel $transaction): string + { + $cache = new SingleCacheProperties; + $cache->addProperty('attachments'); + $cache->addProperty($transaction->id); + $cache->addProperty($transaction->updated_at); + if ($cache->has()) { + return $cache->get(); + } + $journalId = intval($transaction->journal_id); + $count = Attachment::whereNull('deleted_at') + ->where('attachable_type', 'FireflyIII\Models\TransactionJournal') + ->where('attachable_id', $journalId) + ->count(); + if ($count > 0) { + $res = sprintf('', Lang::choice('firefly.nr_of_attachments', $count, ['count' => $count])); + $cache->store($res); + + return $res; + } + + $res = ''; + $cache->store($res); + + return $res; + } + + /** + * @param TransactionModel $transaction + * + * @return string + */ + public function icon(TransactionModel $transaction): string + { + $cache = new SingleCacheProperties; + $cache->addProperty('icon'); + $cache->addProperty($transaction->id); + $cache->addProperty($transaction->updated_at); + if ($cache->has()) { + return $cache->get(); + } + + switch ($transaction->transaction_type_type) { + case TransactionType::WITHDRAWAL: + $txt = sprintf('', trans('firefly.withdrawal')); + break; + case TransactionType::DEPOSIT: + $txt = sprintf('', trans('firefly.deposit')); + break; + case TransactionType::TRANSFER: + $txt = sprintf('', trans('firefly.transfer')); + break; + case TransactionType::OPENING_BALANCE: + $txt = sprintf('', trans('firefly.openingBalance')); + break; + case TransactionType::RECONCILIATION: + $txt = sprintf('', trans('firefly.reconciliation_transaction')); + break; + default: + $txt = ''; + break; + } + $cache->store($txt); + + return $txt; + } + + /** + * @param TransactionModel $transaction + * + * @return string + */ + public function isReconciled(TransactionModel $transaction): string + { + $cache = new SingleCacheProperties; + $cache->addProperty('transaction-reconciled'); + $cache->addProperty($transaction->id); + $cache->addProperty($transaction->updated_at); + $cache->addProperty($transaction->reconciled); + if ($cache->has()) { + return $cache->get(); + } + $icon = ''; + if (1 === intval($transaction->reconciled)) { + $icon = ''; + } + + $cache->store($icon); + + return $icon; + } + + /** + * @param TransactionModel $transaction + * + * @return string + */ + public function isSplit(TransactionModel $transaction): string + { + $cache = new SingleCacheProperties; + $cache->addProperty('split'); + $cache->addProperty($transaction->id); + $cache->addProperty($transaction->updated_at); + if ($cache->has()) { + return $cache->get(); + } + $journalId = intval($transaction->journal_id); + $count = TransactionModel::where('transaction_journal_id', $journalId)->whereNull('deleted_at')->count(); + if ($count > 2) { + $res = ''; + $cache->store($res); + + return $res; + } + + $res = ''; + $cache->store($res); + + return $res; + } + + /** + * @param TransactionModel $transaction + * + * @return string + */ + public function sourceAccount(TransactionModel $transaction): string + { + $cache = new SingleCacheProperties; + $cache->addProperty('transaction-source'); + $cache->addProperty($transaction->id); + $cache->addProperty($transaction->updated_at); + if ($cache->has()) { + return $cache->get(); + } + if (TransactionType::RECONCILIATION === $transaction->transaction_type_type) { + return '—'; + } + + // if the amount is negative, assume that the current account (the one in $transaction) is indeed the source account. + $name = app('steam')->tryDecrypt($transaction->account_name); + $transactionId = intval($transaction->account_id); + $type = $transaction->account_type; + + // name is present in object, use that one: + if (1 === bccomp($transaction->transaction_amount, '0') && null !== $transaction->opposing_account_id) { + $name = $transaction->opposing_account_name; + $transactionId = intval($transaction->opposing_account_id); + $type = $transaction->opposing_account_type; + } + // Find the opposing account and use that one: + if (1 === bccomp($transaction->transaction_amount, '0') && null === $transaction->opposing_account_id) { + $journalId = $transaction->journal_id; + /** @var TransactionModel $other */ + $other = TransactionModel::where('transaction_journal_id', $journalId)->where('transactions.id', '!=', $transaction->id) + ->where('amount', '=', bcmul($transaction->transaction_amount, '-1'))->where( + 'identifier', + $transaction->identifier + ) + ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') + ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') + ->first(['transactions.account_id', 'accounts.encrypted', 'accounts.name', 'account_types.type']); + $name = app('steam')->tryDecrypt($other->name); + $transactionId = $other->account_id; + $type = $other->type; + } + + if (AccountType::CASH === $type) { + $txt = '(' . trans('firefly.cash') . ')'; + $cache->store($txt); + + return $txt; + } + + $txt = sprintf('%1$s', e($name), route('accounts.show', [$transactionId])); + $cache->store($txt); + + return $txt; + } +} diff --git a/app/Support/Twig/Extension/TransactionJournal.php b/app/Support/Twig/Extension/TransactionJournal.php new file mode 100644 index 0000000000..66affea81b --- /dev/null +++ b/app/Support/Twig/Extension/TransactionJournal.php @@ -0,0 +1,88 @@ +. + */ +declare(strict_types=1); + +namespace FireflyIII\Support\Twig\Extension; + +use FireflyIII\Models\Transaction as TransactionModel; +use FireflyIII\Models\TransactionJournal as JournalModel; +use FireflyIII\Models\TransactionType; +use FireflyIII\Support\SingleCacheProperties; +use Twig_Extension; + +class TransactionJournal extends Twig_Extension +{ + /** + * @param JournalModel $journal + * + * @return string + */ + public function totalAmount(JournalModel $journal): string + { + $cache = new SingleCacheProperties; + $cache->addProperty('total-amount'); + $cache->addProperty($journal->id); + $cache->addProperty($journal->updated_at); + if ($cache->has()) { + return $cache->get(); + } + + $transactions = $journal->transactions()->where('amount', '>', 0)->get(); + $totals = []; + $type = $journal->transactionType->type; + /** @var TransactionModel $transaction */ + foreach ($transactions as $transaction) { + $currencyId = $transaction->transaction_currency_id; + $currency = $transaction->transactionCurrency; + + if (!isset($totals[$currencyId])) { + $totals[$currencyId] = [ + 'amount' => '0', + 'currency' => $currency, + ]; + } + $totals[$currencyId]['amount'] = bcadd($transaction->amount, $totals[$currencyId]['amount']); + + if (null !== $transaction->foreign_currency_id) { + $foreignId = $transaction->foreign_currency_id; + $foreign = $transaction->foreignCurrency; + if (!isset($totals[$foreignId])) { + $totals[$foreignId] = [ + 'amount' => '0', + 'currency' => $foreign, + ]; + } + $totals[$foreignId]['amount'] = bcadd($transaction->foreign_amount, $totals[$foreignId]['amount']); + } + } + $array = []; + foreach ($totals as $total) { + if (TransactionType::WITHDRAWAL === $type) { + $total['amount'] = bcmul($total['amount'], '-1'); + } + $array[] = app('amount')->formatAnything($total['currency'], $total['amount']); + } + $txt = join(' / ', $array); + $cache->store($txt); + + return $txt; + } +} diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php index 6e3b303bab..754972cd4a 100644 --- a/app/Support/Twig/General.php +++ b/app/Support/Twig/General.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Twig; @@ -26,6 +25,7 @@ namespace FireflyIII\Support\Twig; use Carbon\Carbon; use FireflyIII\Models\Account; use FireflyIII\Models\TransactionJournal; +use League\CommonMark\CommonMarkConverter; use Route; use Steam; use Twig_Extension; @@ -33,15 +33,10 @@ use Twig_SimpleFilter; use Twig_SimpleFunction; /** - * - * Class TwigSupport - * - * @package FireflyIII\Support + * Class TwigSupport. */ class General extends Twig_Extension { - - /** * @return array */ @@ -51,13 +46,12 @@ class General extends Twig_Extension $this->balance(), $this->formatFilesize(), $this->mimeIcon(), - + $this->markdown(), ]; - } /** - * {@inheritDoc} + * {@inheritdoc} */ public function getFunctions(): array { @@ -71,13 +65,11 @@ class General extends Twig_Extension $this->steamPositive(), $this->activeRoutePartial(), $this->activeRoutePartialWhat(), - ]; - } /** - * {@inheritDoc} + * {@inheritdoc} */ public function getName(): string { @@ -93,16 +85,17 @@ class General extends Twig_Extension protected function activeRoutePartial(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'activeRoutePartial', function (): string { - $args = func_get_args(); - $route = $args[0]; // name of the route. - $name = Route::getCurrentRoute()->getName() ?? ''; - if (!(strpos($name, $route) === false)) { - return 'active'; - } + 'activeRoutePartial', + function (): string { + $args = func_get_args(); + $route = $args[0]; // name of the route. + $name = Route::getCurrentRoute()->getName() ?? ''; + if (!(false === strpos($name, $route))) { + return 'active'; + } - return ''; - } + return ''; + } ); } @@ -115,18 +108,20 @@ class General extends Twig_Extension protected function activeRoutePartialWhat(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'activeRoutePartialWhat', function ($context): string { - $args = func_get_args(); - $route = $args[1]; // name of the route. - $what = $args[2]; // name of the route. - $activeWhat = $context['what'] ?? false; + 'activeRoutePartialWhat', + function ($context): string { + $args = func_get_args(); + $route = $args[1]; // name of the route. + $what = $args[2]; // name of the route. + $activeWhat = $context['what'] ?? false; - if ($what === $activeWhat && !(strpos(Route::getCurrentRoute()->getName(), $route) === false)) { - return 'active'; - } + if ($what === $activeWhat && !(false === strpos(Route::getCurrentRoute()->getName(), $route))) { + return 'active'; + } - return ''; - }, ['needs_context' => true] + return ''; + }, + ['needs_context' => true] ); } @@ -139,16 +134,17 @@ class General extends Twig_Extension protected function activeRouteStrict(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'activeRouteStrict', function (): string { - $args = func_get_args(); - $route = $args[0]; // name of the route. + 'activeRouteStrict', + function (): string { + $args = func_get_args(); + $route = $args[0]; // name of the route. - if (Route::getCurrentRoute()->getName() === $route) { - return 'active'; + if (Route::getCurrentRoute()->getName() === $route) { + return 'active'; + } + + return ''; } - - return ''; - } ); } @@ -158,14 +154,15 @@ class General extends Twig_Extension protected function balance(): Twig_SimpleFilter { return new Twig_SimpleFilter( - 'balance', function (?Account $account): string { - if (is_null($account)) { - return 'NULL'; - } - $date = session('end', Carbon::now()->endOfMonth()); + 'balance', + function (?Account $account): string { + if (null === $account) { + return 'NULL'; + } + $date = session('end', Carbon::now()->endOfMonth()); - return app('steam')->balance($account, $date); - } + return app('steam')->balance($account, $date); + } ); } @@ -175,9 +172,10 @@ class General extends Twig_Extension protected function env(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'env', function (string $name, string $default): string { - return env($name, $default); - } + 'env', + function (string $name, string $default): string { + return env($name, $default); + } ); } @@ -187,33 +185,33 @@ class General extends Twig_Extension protected function formatFilesize(): Twig_SimpleFilter { return new Twig_SimpleFilter( - 'filesize', function (int $size): string { + 'filesize', + function (int $size): string { + // less than one GB, more than one MB + if ($size < (1024 * 1024 * 2014) && $size >= (1024 * 1024)) { + return round($size / (1024 * 1024), 2) . ' MB'; + } - // less than one GB, more than one MB - if ($size < (1024 * 1024 * 2014) && $size >= (1024 * 1024)) { - return round($size / (1024 * 1024), 2) . ' MB'; + // less than one MB + if ($size < (1024 * 1024)) { + return round($size / 1024, 2) . ' KB'; + } + + return $size . ' bytes'; } - - // less than one MB - if ($size < (1024 * 1024)) { - return round($size / 1024, 2) . ' KB'; - } - - return $size . ' bytes'; - } ); } - /** * @return Twig_SimpleFunction */ protected function getCurrencyCode(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'getCurrencyCode', function (): string { - return app('amount')->getCurrencyCode(); - } + 'getCurrencyCode', + function (): string { + return app('amount')->getCurrencyCode(); + } ); } @@ -223,9 +221,25 @@ class General extends Twig_Extension protected function getCurrencySymbol(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'getCurrencySymbol', function (): string { - return app('amount')->getCurrencySymbol(); - } + 'getCurrencySymbol', + function (): string { + return app('amount')->getCurrencySymbol(); + } + ); + } + + /** + * @return Twig_SimpleFilter + */ + protected function markdown(): Twig_SimpleFilter + { + return new Twig_SimpleFilter( + 'markdown', + function (string $text): string { + $converter = new CommonMarkConverter; + + return $converter->convertToHtml($text); + }, ['is_safe' => ['html']] ); } @@ -235,17 +249,19 @@ class General extends Twig_Extension protected function mimeIcon(): Twig_SimpleFilter { return new Twig_SimpleFilter( - 'mimeIcon', function (string $string): string { - switch ($string) { - default: - return 'fa-file-o'; - case 'application/pdf': - return 'fa-file-pdf-o'; - case 'image/png': - case 'image/jpeg': - return 'fa-file-image-o'; - } - }, ['is_safe' => ['html']] + 'mimeIcon', + function (string $string): string { + switch ($string) { + default: + return 'fa-file-o'; + case 'application/pdf': + return 'fa-file-pdf-o'; + case 'image/png': + case 'image/jpeg': + return 'fa-file-image-o'; + } + }, + ['is_safe' => ['html']] ); } @@ -255,9 +271,10 @@ class General extends Twig_Extension protected function phpdate() { return new Twig_SimpleFunction( - 'phpdate', function (string $str): string { - return date($str); - } + 'phpdate', + function (string $str): string { + return date($str); + } ); } @@ -267,9 +284,10 @@ class General extends Twig_Extension protected function steamPositive() { return new Twig_SimpleFunction( - 'steam_positive', function (string $str): string { - return Steam::positive($str); - } + 'steam_positive', + function (string $str): string { + return Steam::positive($str); + } ); } @@ -279,10 +297,10 @@ class General extends Twig_Extension private function getAmountFromJournal() { return new Twig_SimpleFunction( - 'getAmount', function (TransactionJournal $journal): string { - return $journal->amount(); - } + 'getAmount', + function (TransactionJournal $journal): string { + return $journal->amount(); + } ); } - } diff --git a/app/Support/Twig/Journal.php b/app/Support/Twig/Journal.php index df404affd6..1f32719ab3 100644 --- a/app/Support/Twig/Journal.php +++ b/app/Support/Twig/Journal.php @@ -18,61 +18,57 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Twig; - use FireflyIII\Models\Account; use FireflyIII\Models\AccountType; use FireflyIII\Models\Category; use FireflyIII\Models\TransactionJournal; use FireflyIII\Support\CacheProperties; +use FireflyIII\Support\Twig\Extension\TransactionJournal as TransactionJournalExtension; use Twig_Extension; use Twig_SimpleFilter; use Twig_SimpleFunction; /** - * Class Journal - * - * @package FireflyIII\Support\Twig + * Class Journal. */ class Journal extends Twig_Extension { - - /** * @return Twig_SimpleFunction */ public function getDestinationAccount(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'destinationAccount', function (TransactionJournal $journal) { - $cache = new CacheProperties; - $cache->addProperty($journal->id); - $cache->addProperty('transaction-journal'); - $cache->addProperty('destination-account-string'); - if ($cache->has()) { - return $cache->get(); // @codeCoverageIgnore - } - - $list = $journal->destinationAccountList(); - $array = []; - /** @var Account $entry */ - foreach ($list as $entry) { - if ($entry->accountType->type === AccountType::CASH) { - $array[] = '(cash)'; - continue; + 'destinationAccount', + function (TransactionJournal $journal) { + $cache = new CacheProperties; + $cache->addProperty($journal->id); + $cache->addProperty('transaction-journal'); + $cache->addProperty('destination-account-string'); + if ($cache->has()) { + return $cache->get(); // @codeCoverageIgnore } - $array[] = sprintf('%1$s', e($entry->name), route('accounts.show', $entry->id)); - } - $array = array_unique($array); - $result = join(', ', $array); - $cache->store($result); - return $result; - } + $list = $journal->destinationAccountList(); + $array = []; + /** @var Account $entry */ + foreach ($list as $entry) { + if (AccountType::CASH === $entry->accountType->type) { + $array[] = '(cash)'; + continue; + } + $array[] = sprintf('%1$s', e($entry->name), route('accounts.show', $entry->id)); + } + $array = array_unique($array); + $result = join(', ', $array); + $cache->store($result); + + return $result; + } ); } @@ -82,7 +78,7 @@ class Journal extends Twig_Extension public function getFilters(): array { $filters = [ - $this->typeIcon(), + new Twig_SimpleFilter('journalTotalAmount', [TransactionJournalExtension::class, 'totalAmount'], ['is_safe' => ['html']]), ]; return $filters; @@ -119,34 +115,32 @@ class Journal extends Twig_Extension public function getSourceAccount(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'sourceAccount', function (TransactionJournal $journal): string { - - $cache = new CacheProperties; - $cache->addProperty($journal->id); - $cache->addProperty('transaction-journal'); - $cache->addProperty('source-account-string'); - if ($cache->has()) { - return $cache->get(); // @codeCoverageIgnore - } - - $list = $journal->sourceAccountList(); - $array = []; - /** @var Account $entry */ - foreach ($list as $entry) { - if ($entry->accountType->type === AccountType::CASH) { - $array[] = '(cash)'; - continue; + 'sourceAccount', + function (TransactionJournal $journal): string { + $cache = new CacheProperties; + $cache->addProperty($journal->id); + $cache->addProperty('transaction-journal'); + $cache->addProperty('source-account-string'); + if ($cache->has()) { + return $cache->get(); // @codeCoverageIgnore } - $array[] = sprintf('%1$s', e($entry->name), route('accounts.show', $entry->id)); + + $list = $journal->sourceAccountList(); + $array = []; + /** @var Account $entry */ + foreach ($list as $entry) { + if (AccountType::CASH === $entry->accountType->type) { + $array[] = '(cash)'; + continue; + } + $array[] = sprintf('%1$s', e($entry->name), route('accounts.show', $entry->id)); + } + $array = array_unique($array); + $result = join(', ', $array); + $cache->store($result); + + return $result; } - $array = array_unique($array); - $result = join(', ', $array); - $cache->store($result); - - return $result; - - - } ); } @@ -156,34 +150,32 @@ class Journal extends Twig_Extension public function journalBudgets(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'journalBudgets', function (TransactionJournal $journal): string { - $cache = new CacheProperties; - $cache->addProperty($journal->id); - $cache->addProperty('transaction-journal'); - $cache->addProperty('budget-string'); - if ($cache->has()) { - return $cache->get(); // @codeCoverageIgnore - } + 'journalBudgets', + function (TransactionJournal $journal): string { + $cache = new CacheProperties; + $cache->addProperty($journal->id); + $cache->addProperty('transaction-journal'); + $cache->addProperty('budget-string'); + if ($cache->has()) { + return $cache->get(); // @codeCoverageIgnore + } - - $budgets = []; - // get all budgets: - foreach ($journal->budgets as $budget) { - $budgets[] = sprintf('%1$s', e($budget->name), route('budgets.show', $budget->id)); - } - // and more! - foreach ($journal->transactions as $transaction) { - foreach ($transaction->budgets as $budget) { + $budgets = []; + // get all budgets: + foreach ($journal->budgets as $budget) { $budgets[] = sprintf('%1$s', e($budget->name), route('budgets.show', $budget->id)); } + // and more! + foreach ($journal->transactions as $transaction) { + foreach ($transaction->budgets as $budget) { + $budgets[] = sprintf('%1$s', e($budget->name), route('budgets.show', $budget->id)); + } + } + $string = join(', ', array_unique($budgets)); + $cache->store($string); + + return $string; } - $string = join(', ', array_unique($budgets)); - $cache->store($string); - - return $string; - - - } ); } @@ -193,71 +185,38 @@ class Journal extends Twig_Extension public function journalCategories(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'journalCategories', function (TransactionJournal $journal): string { - $cache = new CacheProperties; - $cache->addProperty($journal->id); - $cache->addProperty('transaction-journal'); - $cache->addProperty('category-string'); - if ($cache->has()) { - return $cache->get(); // @codeCoverageIgnore - } - $categories = []; - // get all categories for the journal itself (easy): - foreach ($journal->categories as $category) { - $categories[] = sprintf('%1$s', e($category->name), route('categories.show', $category->id)); - } - if (count($categories) === 0) { - $set = Category::distinct()->leftJoin('category_transaction', 'categories.id', '=', 'category_transaction.category_id') - ->leftJoin('transactions', 'category_transaction.transaction_id', '=', 'transactions.id') - ->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('categories.user_id', $journal->user_id) - ->where('transaction_journals.id', $journal->id) - ->get(['categories.*']); - /** @var Category $category */ - foreach ($set as $category) { + 'journalCategories', + function (TransactionJournal $journal): string { + $cache = new CacheProperties; + $cache->addProperty($journal->id); + $cache->addProperty('transaction-journal'); + $cache->addProperty('category-string'); + if ($cache->has()) { + return $cache->get(); // @codeCoverageIgnore + } + $categories = []; + // get all categories for the journal itself (easy): + foreach ($journal->categories as $category) { $categories[] = sprintf('%1$s', e($category->name), route('categories.show', $category->id)); } + if (0 === count($categories)) { + $set = Category::distinct()->leftJoin('category_transaction', 'categories.id', '=', 'category_transaction.category_id') + ->leftJoin('transactions', 'category_transaction.transaction_id', '=', 'transactions.id') + ->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') + ->where('categories.user_id', $journal->user_id) + ->where('transaction_journals.id', $journal->id) + ->get(['categories.*']); + /** @var Category $category */ + foreach ($set as $category) { + $categories[] = sprintf('%1$s', e($category->name), route('categories.show', $category->id)); + } + } + + $string = join(', ', array_unique($categories)); + $cache->store($string); + + return $string; } - - $string = join(', ', array_unique($categories)); - $cache->store($string); - - return $string; - } ); } - - /** - * @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's 5. - * - * @return Twig_SimpleFilter - */ - protected function typeIcon(): Twig_SimpleFilter - { - return new Twig_SimpleFilter( - 'typeIcon', function (TransactionJournal $journal): string { - - switch (true) { - case $journal->isWithdrawal(): - $txt = sprintf('', trans('firefly.withdrawal')); - break; - case $journal->isDeposit(): - $txt = sprintf('', trans('firefly.deposit')); - break; - case $journal->isTransfer(): - $txt = sprintf('', trans('firefly.transfer')); - break; - case $journal->isOpeningBalance(): - $txt = sprintf('', trans('firefly.openingBalance')); - break; - default: - $txt = ''; - break; - } - - return $txt; - }, ['is_safe' => ['html']] - ); - } - } diff --git a/app/Support/Twig/Loader/TransactionJournalLoader.php b/app/Support/Twig/Loader/TransactionJournalLoader.php new file mode 100644 index 0000000000..f0a3de2895 --- /dev/null +++ b/app/Support/Twig/Loader/TransactionJournalLoader.php @@ -0,0 +1,52 @@ +. + */ +declare(strict_types=1); + +namespace FireflyIII\Support\Twig\Loader; + +use FireflyIII\Support\Twig\Extension\TransactionJournal; +use Twig_RuntimeLoaderInterface; + +/** + * Class TransactionJournalLoader. + */ +class TransactionJournalLoader implements Twig_RuntimeLoaderInterface +{ + /** + * Creates the runtime implementation of a Twig element (filter/function/test). + * + * @param string $class A runtime class + * + * @return object|null The runtime instance or null if the loader does not know how to create the runtime for this class + */ + public function load($class) + { + // implement the logic to create an instance of $class + // and inject its dependencies + // most of the time, it means using your dependency injection container + + if (TransactionJournal::class === $class) { + return app(TransactionJournal::class); + } + + return null; + } +} diff --git a/app/Support/Twig/Loader/TransactionLoader.php b/app/Support/Twig/Loader/TransactionLoader.php new file mode 100644 index 0000000000..a32ee03d43 --- /dev/null +++ b/app/Support/Twig/Loader/TransactionLoader.php @@ -0,0 +1,52 @@ +. + */ +declare(strict_types=1); + +namespace FireflyIII\Support\Twig\Loader; + +use FireflyIII\Support\Twig\Extension\Transaction; +use Twig_RuntimeLoaderInterface; + +/** + * Class TransactionLoader. + */ +class TransactionLoader implements Twig_RuntimeLoaderInterface +{ + /** + * Creates the runtime implementation of a Twig element (filter/function/test). + * + * @param string $class A runtime class + * + * @return object|null The runtime instance or null if the loader does not know how to create the runtime for this class + */ + public function load($class) + { + // implement the logic to create an instance of $class + // and inject its dependencies + // most of the time, it means using your dependency injection container + + if (Transaction::class === $class) { + return app(Transaction::class); + } + + return null; + } +} diff --git a/app/Support/Twig/PiggyBank.php b/app/Support/Twig/PiggyBank.php index a47da054ea..05d91a04be 100644 --- a/app/Support/Twig/PiggyBank.php +++ b/app/Support/Twig/PiggyBank.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Twig; @@ -28,14 +27,10 @@ use Twig_Extension; use Twig_SimpleFunction; /** - * - * Class PiggyBank - * - * @package FireflyIII\Support\Twig + * Class PiggyBank. */ class PiggyBank extends Twig_Extension { - /** * */ @@ -44,15 +39,17 @@ class PiggyBank extends Twig_Extension $functions = []; $functions[] = new Twig_SimpleFunction( - 'currentRelevantRepAmount', function (PB $piggyBank) { - return $piggyBank->currentRelevantRep()->currentamount; - } + 'currentRelevantRepAmount', + function (PB $piggyBank) { + return $piggyBank->currentRelevantRep()->currentamount; + } ); $functions[] = new Twig_SimpleFunction( - 'suggestedMonthlyAmount', function (PB $piggyBank) { - return $piggyBank->getSuggestedMonthlyAmount(); - } + 'suggestedMonthlyAmount', + function (PB $piggyBank) { + return $piggyBank->getSuggestedMonthlyAmount(); + } ); return $functions; diff --git a/app/Support/Twig/Rule.php b/app/Support/Twig/Rule.php index 7c36b5b8ff..9a9350de10 100644 --- a/app/Support/Twig/Rule.php +++ b/app/Support/Twig/Rule.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Twig; @@ -28,31 +27,29 @@ use Twig_Extension; use Twig_SimpleFunction; /** - * Class Rule - * - * @package FireflyIII\Support\Twig + * Class Rule. */ class Rule extends Twig_Extension { - /** * @return Twig_SimpleFunction */ public function allActionTriggers(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'allRuleActions', function () { - // array of valid values for actions - $ruleActions = array_keys(Config::get('firefly.rule-actions')); - $possibleActions = []; - foreach ($ruleActions as $key) { - $possibleActions[$key] = trans('firefly.rule_action_' . $key . '_choice'); - } - unset($key, $ruleActions); - asort($possibleActions); + 'allRuleActions', + function () { + // array of valid values for actions + $ruleActions = array_keys(Config::get('firefly.rule-actions')); + $possibleActions = []; + foreach ($ruleActions as $key) { + $possibleActions[$key] = trans('firefly.rule_action_' . $key . '_choice'); + } + unset($key, $ruleActions); + asort($possibleActions); - return $possibleActions; - } + return $possibleActions; + } ); } @@ -62,12 +59,13 @@ class Rule extends Twig_Extension public function allJournalTriggers(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'allJournalTriggers', function () { - return [ - 'store-journal' => trans('firefly.rule_trigger_store_journal'), - 'update-journal' => trans('firefly.rule_trigger_update_journal'), - ]; - } + 'allJournalTriggers', + function () { + return [ + 'store-journal' => trans('firefly.rule_trigger_store_journal'), + 'update-journal' => trans('firefly.rule_trigger_update_journal'), + ]; + } ); } @@ -77,22 +75,21 @@ class Rule extends Twig_Extension public function allRuleTriggers(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'allRuleTriggers', function () { - $ruleTriggers = array_keys(Config::get('firefly.rule-triggers')); - $possibleTriggers = []; - foreach ($ruleTriggers as $key) { - if ($key !== 'user_action') { - $possibleTriggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice'); + 'allRuleTriggers', + function () { + $ruleTriggers = array_keys(Config::get('firefly.rule-triggers')); + $possibleTriggers = []; + foreach ($ruleTriggers as $key) { + if ('user_action' !== $key) { + $possibleTriggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice'); + } } + unset($key, $ruleTriggers); + asort($possibleTriggers); + + return $possibleTriggers; } - unset($key, $ruleTriggers); - asort($possibleTriggers); - - return $possibleTriggers; - } - ); - } /** @@ -105,7 +102,6 @@ class Rule extends Twig_Extension $this->allRuleTriggers(), $this->allActionTriggers(), ]; - } /** diff --git a/app/Support/Twig/Transaction.php b/app/Support/Twig/Transaction.php index 9c5bb8406e..c9095e78cd 100644 --- a/app/Support/Twig/Transaction.php +++ b/app/Support/Twig/Transaction.php @@ -18,95 +18,41 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Twig; -use FireflyIII\Models\AccountType; -use FireflyIII\Models\Attachment; -use FireflyIII\Models\Transaction as TransactionModel; -use FireflyIII\Models\TransactionType; -use FireflyIII\Support\CacheProperties; -use Lang; -use Steam; +use FireflyIII\Support\Twig\Extension\Transaction as TransactionExtension; use Twig_Extension; use Twig_SimpleFilter; -use Twig_SimpleFunction; /** - * Class Transaction - * - * @package FireflyIII\Support\Twig + * Class Transaction. */ class Transaction extends Twig_Extension { - /** - * @return Twig_SimpleFunction - */ - public function attachmentIndicator(): Twig_SimpleFunction - { - return new Twig_SimpleFunction( - 'attachmentIndicator', function (int $journalId) { - - $cache = new CacheProperties; - $cache->addProperty('attachments_journal'); - $cache->addProperty($journalId); - if ($cache->has()) { - return $cache->get(); - } - $count = Attachment::whereNull('deleted_at') - ->where('attachable_type', 'FireflyIII\Models\TransactionJournal') - ->where('attachable_id', $journalId) - ->count(); - if ($count > 0) { - $res = sprintf('', Lang::choice('firefly.nr_of_attachments', $count, ['count' => $count])); - $cache->store($res); - - return $res; - } - - $res = ''; - $cache->store($res); - - return $res; - - - }, ['is_safe' => ['html']] - ); - } - /** * @return array */ public function getFilters(): array { $filters = [ - $this->typeIconTransaction(), + new Twig_SimpleFilter('transactionIcon', [TransactionExtension::class, 'icon'], ['is_safe' => ['html']]), + new Twig_SimpleFilter('transactionDescription', [TransactionExtension::class, 'description']), + new Twig_SimpleFilter('transactionIsSplit', [TransactionExtension::class, 'isSplit'], ['is_safe' => ['html']]), + new Twig_SimpleFilter('transactionReconciled', [TransactionExtension::class, 'isReconciled'], ['is_safe' => ['html']]), + new Twig_SimpleFilter('transactionHasAtt', [TransactionExtension::class, 'hasAttachments'], ['is_safe' => ['html']]), + new Twig_SimpleFilter('transactionAmount', [TransactionExtension::class, 'amount'], ['is_safe' => ['html']]), + new Twig_SimpleFilter('transactionArrayAmount', [TransactionExtension::class, 'amountArray'], ['is_safe' => ['html']]), + new Twig_SimpleFilter('transactionBudgets', [TransactionExtension::class, 'budgets'], ['is_safe' => ['html']]), + new Twig_SimpleFilter('transactionCategories', [TransactionExtension::class, 'categories'], ['is_safe' => ['html']]), + new Twig_SimpleFilter('transactionSourceAccount', [TransactionExtension::class, 'sourceAccount'], ['is_safe' => ['html']]), + new Twig_SimpleFilter('transactionDestinationAccount', [TransactionExtension::class, 'destinationAccount'], ['is_safe' => ['html']]), ]; return $filters; } - /** - * @return array - */ - public function getFunctions(): array - { - $functions = [ - $this->transactionSourceAccount(), - $this->transactionDestinationAccount(), - $this->transactionBudgets(), - $this->transactionIdBudgets(), - $this->transactionCategories(), - $this->transactionIdCategories(), - $this->splitJournalIndicator(), - $this->attachmentIndicator(), - ]; - - return $functions; - } - /** * Returns the name of the extension. * @@ -116,289 +62,4 @@ class Transaction extends Twig_Extension { return 'transaction'; } - - /** - * @return Twig_SimpleFunction - */ - public function splitJournalIndicator(): Twig_SimpleFunction - { - return new Twig_SimpleFunction( - 'splitJournalIndicator', function (int $journalId) { - - $cache = new CacheProperties; - $cache->addProperty('is_split_journal'); - $cache->addProperty($journalId); - if ($cache->has()) { - return $cache->get(); - } - $count = TransactionModel::where('transaction_journal_id', $journalId)->whereNull('deleted_at')->count(); - if ($count > 2) { - $res = ''; - $cache->store($res); - - return $res; - } - - $res = ''; - $cache->store($res); - - return $res; - - - }, ['is_safe' => ['html']] - ); - } - - /** - * @return Twig_SimpleFunction - */ - public function transactionBudgets(): Twig_SimpleFunction - { - return new Twig_SimpleFunction( - 'transactionBudgets', function (TransactionModel $transaction): string { - return $this->getTransactionBudgets($transaction); - }, ['is_safe' => ['html']] - ); - } - - /** - * @return Twig_SimpleFunction - */ - public function transactionCategories(): Twig_SimpleFunction - { - return new Twig_SimpleFunction( - 'transactionCategories', function (TransactionModel $transaction): string { - return $this->getTransactionCategories($transaction); - }, ['is_safe' => ['html']] - ); - } - - /** - * @return Twig_SimpleFunction - */ - public function transactionDestinationAccount(): Twig_SimpleFunction - { - return new Twig_SimpleFunction( - 'transactionDestinationAccount', function (TransactionModel $transaction): string { - - $name = Steam::decrypt(intval($transaction->account_encrypted), $transaction->account_name); - $transactionId = intval($transaction->account_id); - $type = $transaction->account_type; - - // name is present in object, use that one: - if (bccomp($transaction->transaction_amount, '0') === -1 && !is_null($transaction->opposing_account_id)) { - $name = $transaction->opposing_account_name; - $transactionId = intval($transaction->opposing_account_id); - $type = $transaction->opposing_account_type; - } - - // Find the opposing account and use that one: - if (bccomp($transaction->transaction_amount, '0') === -1 && is_null($transaction->opposing_account_id)) { - // if the amount is negative, find the opposing account and use that one: - $journalId = $transaction->journal_id; - /** @var TransactionModel $other */ - $other = TransactionModel::where('transaction_journal_id', $journalId)->where('transactions.id', '!=', $transaction->id) - ->where('amount', '=', bcmul($transaction->transaction_amount, '-1'))->where( - 'identifier', $transaction->identifier - ) - ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') - ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') - ->first(['transactions.account_id', 'accounts.encrypted', 'accounts.name', 'account_types.type']); - $name = Steam::decrypt(intval($other->encrypted), $other->name); - $transactionId = $other->account_id; - $type = $other->type; - } - - if ($type === AccountType::CASH) { - return '(cash)'; - } - - return sprintf('%1$s', e($name), route('accounts.show', [$transactionId])); - - }, ['is_safe' => ['html']] - ); - } - - /** - * @return Twig_SimpleFunction - */ - public function transactionIdBudgets(): Twig_SimpleFunction - { - return new Twig_SimpleFunction( - 'transactionIdBudgets', function (int $transactionId): string { - $transaction = TransactionModel::find($transactionId); - - return $this->getTransactionBudgets($transaction); - }, ['is_safe' => ['html']] - ); - } - - /** - * @return Twig_SimpleFunction - */ - public function transactionIdCategories(): Twig_SimpleFunction - { - return new Twig_SimpleFunction( - 'transactionIdCategories', function (int $transactionId): string { - $transaction = TransactionModel::find($transactionId); - - return $this->getTransactionCategories($transaction); - }, ['is_safe' => ['html']] - ); - } - - /** - * @return Twig_SimpleFunction - */ - public function transactionSourceAccount(): Twig_SimpleFunction - { - return new Twig_SimpleFunction( - 'transactionSourceAccount', function (TransactionModel $transaction): string { - - // if the amount is negative, assume that the current account (the one in $transaction) is indeed the source account. - $name = Steam::decrypt(intval($transaction->account_encrypted), $transaction->account_name); - $transactionId = intval($transaction->account_id); - $type = $transaction->account_type; - - // name is present in object, use that one: - if (bccomp($transaction->transaction_amount, '0') === 1 && !is_null($transaction->opposing_account_id)) { - $name = $transaction->opposing_account_name; - $transactionId = intval($transaction->opposing_account_id); - $type = $transaction->opposing_account_type; - } - // Find the opposing account and use that one: - if (bccomp($transaction->transaction_amount, '0') === 1 && is_null($transaction->opposing_account_id)) { - $journalId = $transaction->journal_id; - /** @var TransactionModel $other */ - $other = TransactionModel::where('transaction_journal_id', $journalId)->where('transactions.id', '!=', $transaction->id) - ->where('amount', '=', bcmul($transaction->transaction_amount, '-1'))->where( - 'identifier', $transaction->identifier - ) - ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') - ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') - ->first(['transactions.account_id', 'accounts.encrypted', 'accounts.name', 'account_types.type']); - $name = Steam::decrypt(intval($other->encrypted), $other->name); - $transactionId = $other->account_id; - $type = $other->type; - } - - if ($type === AccountType::CASH) { - return '(cash)'; - } - - return sprintf('%1$s', e($name), route('accounts.show', [$transactionId])); - - }, ['is_safe' => ['html']] - ); - } - - /** - * @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's 5. - * - * @return Twig_SimpleFilter - */ - public function typeIconTransaction(): Twig_SimpleFilter - { - return new Twig_SimpleFilter( - 'typeIconTransaction', function (TransactionModel $transaction): string { - - switch ($transaction->transaction_type_type) { - case TransactionType::WITHDRAWAL: - $txt = sprintf('', trans('firefly.withdrawal')); - break; - case TransactionType::DEPOSIT: - $txt = sprintf('', trans('firefly.deposit')); - break; - case TransactionType::TRANSFER: - $txt = sprintf('', trans('firefly.transfer')); - break; - case TransactionType::OPENING_BALANCE: - $txt = sprintf('', trans('firefly.openingBalance')); - break; - default: - $txt = ''; - break; - } - - return $txt; - }, ['is_safe' => ['html']] - ); - } - - /** - * @param TransactionModel $transaction - * - * @return string - */ - private function getTransactionBudgets(TransactionModel $transaction): string - { - // journal has a budget: - if (isset($transaction->transaction_journal_budget_id)) { - $name = Steam::decrypt(intval($transaction->transaction_journal_budget_encrypted), $transaction->transaction_journal_budget_name); - - return sprintf('%s', route('budgets.show', [$transaction->transaction_journal_budget_id]), $name, $name); - } - - // transaction has a budget - if (isset($transaction->transaction_budget_id)) { - $name = Steam::decrypt(intval($transaction->transaction_budget_encrypted), $transaction->transaction_budget_name); - - return sprintf('%s', route('budgets.show', [$transaction->transaction_budget_id]), $name, $name); - } - - // see if the transaction has a budget: - $budgets = $transaction->budgets()->get(); - if ($budgets->count() === 0) { - $budgets = $transaction->transactionJournal()->first()->budgets()->get(); - } - if ($budgets->count() > 0) { - $str = []; - foreach ($budgets as $budget) { - $str[] = sprintf('%s', route('budgets.show', [$budget->id]), $budget->name, $budget->name); - } - - return join(', ', $str); - } - - - return ''; - } - - /** - * @param TransactionModel $transaction - * - * @return string - */ - private function getTransactionCategories(TransactionModel $transaction): string - { - // journal has a category: - if (isset($transaction->transaction_journal_category_id)) { - $name = Steam::decrypt(intval($transaction->transaction_journal_category_encrypted), $transaction->transaction_journal_category_name); - - return sprintf('%s', route('categories.show', [$transaction->transaction_journal_category_id]), $name, $name); - } - - // transaction has a category: - if (isset($transaction->transaction_category_id)) { - $name = Steam::decrypt(intval($transaction->transaction_category_encrypted), $transaction->transaction_category_name); - - return sprintf('%s', route('categories.show', [$transaction->transaction_category_id]), $name, $name); - } - - // see if the transaction has a category: - $categories = $transaction->categories()->get(); - if ($categories->count() === 0) { - $categories = $transaction->transactionJournal()->first()->categories()->get(); - } - if ($categories->count() > 0) { - $str = []; - foreach ($categories as $category) { - $str[] = sprintf('%s', route('categories.show', [$category->id]), $category->name, $category->name); - } - - return join(', ', $str); - } - - return ''; - } } diff --git a/app/Support/Twig/Translation.php b/app/Support/Twig/Translation.php index 95c1456315..fd4ffe1852 100644 --- a/app/Support/Twig/Translation.php +++ b/app/Support/Twig/Translation.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Support\Twig; @@ -28,14 +27,10 @@ use Twig_SimpleFilter; use Twig_SimpleFunction; /** - * - * Class Budget - * - * @package FireflyIII\Support\Twig + * Class Budget. */ class Translation extends Twig_Extension { - /** * @return array */ @@ -44,31 +39,28 @@ class Translation extends Twig_Extension $filters = []; $filters[] = new Twig_SimpleFilter( - '_', function ($name) { - - return strval(trans(sprintf('firefly.%s', $name))); - - }, ['is_safe' => ['html']] + '_', + function ($name) { + return strval(trans(sprintf('firefly.%s', $name))); + }, + ['is_safe' => ['html']] ); return $filters; } - /** - * {@inheritDoc} + * {@inheritdoc} */ public function getFunctions(): array { return [ $this->journalLinkTranslation(), - ]; - } /** - * {@inheritDoc} + * {@inheritdoc} */ public function getName(): string { @@ -81,17 +73,17 @@ class Translation extends Twig_Extension public function journalLinkTranslation(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'journalLinkTranslation', function (string $direction, string $original) { - $key = sprintf('firefly.%s_%s', $original, $direction); - $translation = trans($key); - if ($key === $translation) { - return $original; - } + 'journalLinkTranslation', + function (string $direction, string $original) { + $key = sprintf('firefly.%s_%s', $original, $direction); + $translation = trans($key); + if ($key === $translation) { + return $original; + } - return $translation; - - - }, ['is_safe' => ['html']] + return $translation; + }, + ['is_safe' => ['html']] ); } } diff --git a/app/TransactionRules/Actions/ActionInterface.php b/app/TransactionRules/Actions/ActionInterface.php index 4df180fd8e..4b8fe556dc 100644 --- a/app/TransactionRules/Actions/ActionInterface.php +++ b/app/TransactionRules/Actions/ActionInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; @@ -27,9 +26,7 @@ use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; /** - * Interface ActionInterface - * - * @package FireflyIII\TransactionRules\Action + * Interface ActionInterface. */ interface ActionInterface { @@ -41,6 +38,8 @@ interface ActionInterface public function __construct(RuleAction $action); /** + * Execute the action. + * * @param TransactionJournal $journal * * @return bool diff --git a/app/TransactionRules/Actions/AddTag.php b/app/TransactionRules/Actions/AddTag.php index 0886008566..79514af3a4 100644 --- a/app/TransactionRules/Actions/AddTag.php +++ b/app/TransactionRules/Actions/AddTag.php @@ -18,26 +18,21 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; - use FireflyIII\Models\RuleAction; use FireflyIII\Models\Tag; use FireflyIII\Models\TransactionJournal; use Log; /** - * Class AddTag - * - * @package FireflyIII\TransactionRules\Actions + * Class AddTag. */ class AddTag implements ActionInterface { - - /** @var RuleAction */ + /** @var RuleAction The rule action */ private $action; /** @@ -51,18 +46,19 @@ class AddTag implements ActionInterface } /** + * Add a tag + * * @param TransactionJournal $journal * * @return bool */ public function act(TransactionJournal $journal): bool { - // journal has this tag maybe? $tag = Tag::firstOrCreateEncrypted(['tag' => $this->action->action_value, 'user_id' => $journal->user->id]); $count = $journal->tags()->where('tag_id', $tag->id)->count(); - if ($count === 0) { + if (0 === $count) { $journal->tags()->save($tag); Log::debug(sprintf('RuleAction AddTag. Added tag #%d ("%s") to journal %d.', $tag->id, $tag->tag, $journal->id)); diff --git a/app/TransactionRules/Actions/AppendDescription.php b/app/TransactionRules/Actions/AppendDescription.php index 6fd15be25e..1c15703706 100644 --- a/app/TransactionRules/Actions/AppendDescription.php +++ b/app/TransactionRules/Actions/AppendDescription.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; @@ -28,16 +27,13 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class AppendDescription - * - * @package FireflyIII\TransactionRules\Actions + * Class AppendDescription. */ class AppendDescription implements ActionInterface { - + /** @var RuleAction The rule action */ private $action; - /** * TriggerInterface constructor. * @@ -49,6 +45,8 @@ class AppendDescription implements ActionInterface } /** + * Append description with X + * * @param TransactionJournal $journal * * @return bool diff --git a/app/TransactionRules/Actions/AppendNotes.php b/app/TransactionRules/Actions/AppendNotes.php index b7d09e7b84..bdfb17838d 100644 --- a/app/TransactionRules/Actions/AppendNotes.php +++ b/app/TransactionRules/Actions/AppendNotes.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; @@ -29,16 +28,13 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class AppendNotes - * - * @package FireflyIII\TransactionRules\Actions + * Class AppendNotes. */ class AppendNotes implements ActionInterface { - + /** @var RuleAction The rule action */ private $action; - /** * TriggerInterface constructor. * @@ -50,6 +46,8 @@ class AppendNotes implements ActionInterface } /** + * Append notes with X + * * @param TransactionJournal $journal * * @return bool @@ -57,7 +55,7 @@ class AppendNotes implements ActionInterface public function act(TransactionJournal $journal): bool { $dbNote = $journal->notes()->first(); - if (is_null($dbNote)) { + if (null === $dbNote) { $dbNote = new Note; $dbNote->noteable()->associate($journal); } diff --git a/app/TransactionRules/Actions/ClearBudget.php b/app/TransactionRules/Actions/ClearBudget.php index b10e3ff7f7..c824651be1 100644 --- a/app/TransactionRules/Actions/ClearBudget.php +++ b/app/TransactionRules/Actions/ClearBudget.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; @@ -28,16 +27,13 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class ClearBudget - * - * @package FireflyIII\TransactionRules\Action + * Class ClearBudget. */ class ClearBudget implements ActionInterface { - + /** @var RuleAction The rule action */ private $action; - /** * TriggerInterface constructor. * @@ -49,6 +45,8 @@ class ClearBudget implements ActionInterface } /** + * Clear all budgets + * * @param TransactionJournal $journal * * @return bool diff --git a/app/TransactionRules/Actions/ClearCategory.php b/app/TransactionRules/Actions/ClearCategory.php index 198e9c0218..76456d06fd 100644 --- a/app/TransactionRules/Actions/ClearCategory.php +++ b/app/TransactionRules/Actions/ClearCategory.php @@ -18,27 +18,22 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; - use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; use Log; /** - * Class ClearCategory - * - * @package FireflyIII\TransactionRules\Action + * Class ClearCategory. */ class ClearCategory implements ActionInterface { - + /** @var RuleAction The rule action */ private $action; - /** * TriggerInterface constructor. * @@ -50,6 +45,8 @@ class ClearCategory implements ActionInterface } /** + * Clear all categories + * * @param TransactionJournal $journal * * @return bool diff --git a/app/TransactionRules/Actions/ClearNotes.php b/app/TransactionRules/Actions/ClearNotes.php index b1ed669e6c..0c132687cf 100644 --- a/app/TransactionRules/Actions/ClearNotes.php +++ b/app/TransactionRules/Actions/ClearNotes.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; @@ -29,16 +28,13 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class ClearNotes - * - * @package FireflyIII\TransactionRules\Actions + * Class ClearNotes. */ class ClearNotes implements ActionInterface { - + /** @var RuleAction The rule action */ private $action; - /** * TriggerInterface constructor. * @@ -50,6 +46,8 @@ class ClearNotes implements ActionInterface } /** + * Remove notes + * * @param TransactionJournal $journal * * @return bool diff --git a/app/TransactionRules/Actions/PrependDescription.php b/app/TransactionRules/Actions/PrependDescription.php index dae4a86649..bab0c148ef 100644 --- a/app/TransactionRules/Actions/PrependDescription.php +++ b/app/TransactionRules/Actions/PrependDescription.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; @@ -28,16 +27,13 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class AppendDescription - * - * @package FireflyIII\TransactionRules\Actions + * Class AppendDescription. */ class PrependDescription implements ActionInterface { - + /** @var RuleAction The rule action */ private $action; - /** * TriggerInterface constructor. * @@ -49,6 +45,8 @@ class PrependDescription implements ActionInterface } /** + * Prepend description with X + * * @param TransactionJournal $journal * * @return bool @@ -59,7 +57,6 @@ class PrependDescription implements ActionInterface $journal->description = $this->action->action_value . $journal->description; $journal->save(); - return true; } } diff --git a/app/TransactionRules/Actions/PrependNotes.php b/app/TransactionRules/Actions/PrependNotes.php index ee132f3c2d..30b54ae2fd 100644 --- a/app/TransactionRules/Actions/PrependNotes.php +++ b/app/TransactionRules/Actions/PrependNotes.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; @@ -29,16 +28,13 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class PrependNotes - * - * @package FireflyIII\TransactionRules\Actions + * Class PrependNotes. */ class PrependNotes implements ActionInterface { - + /** @var RuleAction The rule action */ private $action; - /** * TriggerInterface constructor. * @@ -50,6 +46,8 @@ class PrependNotes implements ActionInterface } /** + * Prepend notes with X + * * @param TransactionJournal $journal * * @return bool @@ -57,7 +55,7 @@ class PrependNotes implements ActionInterface public function act(TransactionJournal $journal): bool { $dbNote = $journal->notes()->first(); - if (is_null($dbNote)) { + if (null === $dbNote) { $dbNote = new Note; $dbNote->noteable()->associate($journal); } diff --git a/app/TransactionRules/Actions/RemoveAllTags.php b/app/TransactionRules/Actions/RemoveAllTags.php index e7ca077b4c..f1b506b865 100644 --- a/app/TransactionRules/Actions/RemoveAllTags.php +++ b/app/TransactionRules/Actions/RemoveAllTags.php @@ -18,26 +18,22 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; - use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; use Log; /** - * Class RemoveAllTags - * - * @package FireflyIII\TransactionRules\Actions + * Class RemoveAllTags. */ class RemoveAllTags implements ActionInterface { + /** @var RuleAction The rule action */ private $action; - /** * TriggerInterface constructor. * @@ -49,6 +45,8 @@ class RemoveAllTags implements ActionInterface } /** + * Remove all tags + * * @param TransactionJournal $journal * * @return bool @@ -59,6 +57,5 @@ class RemoveAllTags implements ActionInterface $journal->tags()->detach(); return true; - } } diff --git a/app/TransactionRules/Actions/RemoveTag.php b/app/TransactionRules/Actions/RemoveTag.php index a1d7b32a89..a5a2f4d616 100644 --- a/app/TransactionRules/Actions/RemoveTag.php +++ b/app/TransactionRules/Actions/RemoveTag.php @@ -18,28 +18,23 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; - use FireflyIII\Models\RuleAction; use FireflyIII\Models\Tag; use FireflyIII\Models\TransactionJournal; use Log; /** - * Class RemoveTag - * - * @package FireflyIII\TransactionRules\Actions + * Class RemoveTag. */ class RemoveTag implements ActionInterface { - + /** @var RuleAction The rule action */ private $action; - /** * TriggerInterface constructor. * @@ -51,6 +46,8 @@ class RemoveTag implements ActionInterface } /** + * Remove tag X + * * @param TransactionJournal $journal * * @return bool @@ -66,7 +63,7 @@ class RemoveTag implements ActionInterface } )->first(); - if (!is_null($tag)) { + if (null !== $tag) { Log::debug(sprintf('RuleAction RemoveTag removed tag #%d ("%s") from journal #%d.', $tag->id, $tag->tag, $journal->id)); $journal->tags()->detach([$tag->id]); diff --git a/app/TransactionRules/Actions/SetBudget.php b/app/TransactionRules/Actions/SetBudget.php index a832e7d5f4..40e93a73d3 100644 --- a/app/TransactionRules/Actions/SetBudget.php +++ b/app/TransactionRules/Actions/SetBudget.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; - use FireflyIII\Models\Budget; use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; @@ -32,16 +30,13 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use Log; /** - * Class SetBudget - * - * @package FireflyIII\TransactionRules\Action + * Class SetBudget. */ class SetBudget implements ActionInterface { - + /** @var RuleAction The rule action */ private $action; - /** * TriggerInterface constructor. * @@ -53,6 +48,8 @@ class SetBudget implements ActionInterface } /** + * Set budget X + * * @param TransactionJournal $journal * * @return bool @@ -69,14 +66,21 @@ class SetBudget implements ActionInterface return $current->name === $search; } )->first(); - if (is_null($budget)) { + if (null === $budget) { Log::debug(sprintf('RuleAction SetBudget could not set budget of journal #%d to "%s" because no such budget exists.', $journal->id, $search)); return true; } - if ($journal->transactionType->type !== TransactionType::WITHDRAWAL) { - Log::debug(sprintf('RuleAction SetBudget could not set budget of journal #%d to "%s" because journal is a %s.', $journal->id, $search, $journal->transactionType->type)); + if (TransactionType::WITHDRAWAL !== $journal->transactionType->type) { + Log::debug( + sprintf( + 'RuleAction SetBudget could not set budget of journal #%d to "%s" because journal is a %s.', + $journal->id, + $search, + $journal->transactionType->type + ) + ); return true; } @@ -85,7 +89,6 @@ class SetBudget implements ActionInterface $journal->budgets()->sync([$budget->id]); - return true; } } diff --git a/app/TransactionRules/Actions/SetCategory.php b/app/TransactionRules/Actions/SetCategory.php index 6644dbb10f..09e1bcd3d8 100644 --- a/app/TransactionRules/Actions/SetCategory.php +++ b/app/TransactionRules/Actions/SetCategory.php @@ -18,28 +18,23 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; - use FireflyIII\Models\Category; use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; use Log; /** - * Class SetCategory - * - * @package FireflyIII\TransactionRules\Action + * Class SetCategory. */ class SetCategory implements ActionInterface { - + /** @var RuleAction The rule action */ private $action; - /** * TriggerInterface constructor. * @@ -51,6 +46,8 @@ class SetCategory implements ActionInterface } /** + * Set category X + * * @param TransactionJournal $journal * * @return bool diff --git a/app/TransactionRules/Actions/SetDescription.php b/app/TransactionRules/Actions/SetDescription.php index f52a7346b6..1a72105aff 100644 --- a/app/TransactionRules/Actions/SetDescription.php +++ b/app/TransactionRules/Actions/SetDescription.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; @@ -28,17 +27,15 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class SetDescription - * - * @package FireflyIII\TransactionRules\Actions + * Class SetDescription. */ class SetDescription implements ActionInterface { - + /** @var RuleAction The rule action */ private $action; - /** + * * TriggerInterface constructor. * * @param RuleAction $action @@ -49,6 +46,8 @@ class SetDescription implements ActionInterface } /** + * Set description to X + * * @param TransactionJournal $journal * * @return bool @@ -61,7 +60,8 @@ class SetDescription implements ActionInterface Log::debug( sprintf( - 'RuleAction SetDescription changed the description of journal #%d from "%s" to "%s".', $journal->id, + 'RuleAction SetDescription changed the description of journal #%d from "%s" to "%s".', + $journal->id, $oldDescription, $this->action->action_value ) diff --git a/app/TransactionRules/Actions/SetDestinationAccount.php b/app/TransactionRules/Actions/SetDestinationAccount.php index 93b96f9905..933d46b1b4 100644 --- a/app/TransactionRules/Actions/SetDestinationAccount.php +++ b/app/TransactionRules/Actions/SetDestinationAccount.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; - use FireflyIII\Models\Account; use FireflyIII\Models\AccountType; use FireflyIII\Models\RuleAction; @@ -33,25 +31,22 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use Log; /** - * Class SetDestinationAccount - * - * @package FireflyIII\TransactionRules\Action + * Class SetDestinationAccount. */ class SetDestinationAccount implements ActionInterface { - + /** @var RuleAction The rule action */ private $action; - /** @var TransactionJournal */ + /** @var TransactionJournal The journal */ private $journal; - /** @var Account */ + /** @var Account The new account */ private $newDestinationAccount; - /** @var AccountRepositoryInterface */ + /** @var AccountRepositoryInterface Account repository */ private $repository; - /** * TriggerInterface constructor. * @@ -63,6 +58,7 @@ class SetDestinationAccount implements ActionInterface } /** + * Set destination account to X * @param TransactionJournal $journal * * @return bool @@ -83,11 +79,12 @@ class SetDestinationAccount implements ActionInterface $type = $journal->transactionType->type; // if this is a deposit or a transfer, the destination account must be an asset account or a default account, and it MUST exist: - if (($type === TransactionType::DEPOSIT || $type === TransactionType::TRANSFER) && !$this->findAssetAccount()) { + if ((TransactionType::DEPOSIT === $type || TransactionType::TRANSFER === $type) && !$this->findAssetAccount()) { Log::error( sprintf( 'Cannot change destination account of journal #%d because no asset account with name "%s" exists.', - $journal->id, $this->action->action_value + $journal->id, + $this->action->action_value ) ); @@ -95,7 +92,7 @@ class SetDestinationAccount implements ActionInterface } // if this is a withdrawal, the new destination account must be a expense account and may be created: - if ($type === TransactionType::WITHDRAWAL) { + if (TransactionType::WITHDRAWAL === $type) { $this->findExpenseAccount(); } @@ -118,7 +115,7 @@ class SetDestinationAccount implements ActionInterface { $account = $this->repository->findByName($this->action->action_value, [AccountType::DEFAULT, AccountType::ASSET]); - if (is_null($account->id)) { + if (null === $account->id) { Log::debug(sprintf('There is NO asset account called "%s".', $this->action->action_value)); return false; @@ -135,7 +132,7 @@ class SetDestinationAccount implements ActionInterface private function findExpenseAccount() { $account = $this->repository->findByName($this->action->action_value, [AccountType::EXPENSE]); - if (is_null($account->id)) { + if (null === $account->id) { // create new revenue account with this name: $data = [ 'name' => $this->action->action_value, diff --git a/app/TransactionRules/Actions/SetNotes.php b/app/TransactionRules/Actions/SetNotes.php index a29e14d0ba..c93419f8a2 100644 --- a/app/TransactionRules/Actions/SetNotes.php +++ b/app/TransactionRules/Actions/SetNotes.php @@ -29,16 +29,13 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class SetNotes - * - * @package FireflyIII\TransactionRules\Actions + * Class SetNotes. */ class SetNotes implements ActionInterface { - + /** @var RuleAction The rule action */ private $action; - /** * TriggerInterface constructor. * @@ -50,6 +47,8 @@ class SetNotes implements ActionInterface } /** + * Set notes to X + * * @param TransactionJournal $journal * * @return bool @@ -57,7 +56,7 @@ class SetNotes implements ActionInterface public function act(TransactionJournal $journal): bool { $dbNote = $journal->notes()->first(); - if (is_null($dbNote)) { + if (null === $dbNote) { $dbNote = new Note; $dbNote->noteable()->associate($journal); } diff --git a/app/TransactionRules/Actions/SetSourceAccount.php b/app/TransactionRules/Actions/SetSourceAccount.php index 8654646792..4bdb6be100 100644 --- a/app/TransactionRules/Actions/SetSourceAccount.php +++ b/app/TransactionRules/Actions/SetSourceAccount.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; - use FireflyIII\Models\Account; use FireflyIII\Models\AccountType; use FireflyIII\Models\RuleAction; @@ -33,25 +32,22 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use Log; /** - * Class SetSourceAccount - * - * @package FireflyIII\TransactionRules\Action + * Class SetSourceAccount. */ class SetSourceAccount implements ActionInterface { - + /** @var RuleAction The rule action */ private $action; - /** @var TransactionJournal */ + /** @var TransactionJournal The journal */ private $journal; - /** @var Account */ + /** @var Account The new source account*/ private $newSourceAccount; - /** @var AccountRepositoryInterface */ + /** @var AccountRepositoryInterface Account repository */ private $repository; - /** * TriggerInterface constructor. * @@ -63,6 +59,8 @@ class SetSourceAccount implements ActionInterface } /** + * Set source account to X + * * @param TransactionJournal $journal * * @return bool @@ -82,11 +80,12 @@ class SetSourceAccount implements ActionInterface // journal type: $type = $journal->transactionType->type; // if this is a transfer or a withdrawal, the new source account must be an asset account or a default account, and it MUST exist: - if (($type === TransactionType::WITHDRAWAL || $type === TransactionType::TRANSFER) && !$this->findAssetAccount()) { + if ((TransactionType::WITHDRAWAL === $type || TransactionType::TRANSFER === $type) && !$this->findAssetAccount()) { Log::error( sprintf( 'Cannot change source account of journal #%d because no asset account with name "%s" exists.', - $journal->id, $this->action->action_value + $journal->id, + $this->action->action_value ) ); @@ -94,7 +93,7 @@ class SetSourceAccount implements ActionInterface } // if this is a deposit, the new source account must be a revenue account and may be created: - if ($type === TransactionType::DEPOSIT) { + if (TransactionType::DEPOSIT === $type) { $this->findRevenueAccount(); } @@ -117,7 +116,7 @@ class SetSourceAccount implements ActionInterface { $account = $this->repository->findByName($this->action->action_value, [AccountType::DEFAULT, AccountType::ASSET]); - if (is_null($account->id)) { + if (null === $account->id) { Log::debug(sprintf('There is NO asset account called "%s".', $this->action->action_value)); return false; @@ -134,7 +133,7 @@ class SetSourceAccount implements ActionInterface private function findRevenueAccount() { $account = $this->repository->findByName($this->action->action_value, [AccountType::REVENUE]); - if (is_null($account->id)) { + if (null === $account->id) { // create new revenue account with this name: $data = [ 'name' => $this->action->action_value, diff --git a/app/TransactionRules/Factory/ActionFactory.php b/app/TransactionRules/Factory/ActionFactory.php index 9d0fe14e52..91c903487e 100644 --- a/app/TransactionRules/Factory/ActionFactory.php +++ b/app/TransactionRules/Factory/ActionFactory.php @@ -1,7 +1,7 @@ . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Factory; @@ -30,13 +29,13 @@ use FireflyIII\TransactionRules\Actions\ActionInterface; use Log; /** - * @codeCoverageIgnore - * Class ActionFactory + * Class ActionFactory can create actions. * - * @package FireflyIII\TransactionRules\Factory + * @codeCoverageIgnore */ class ActionFactory { + /** @var array array of action types */ protected static $actionTypes = []; /** @@ -65,6 +64,7 @@ class ActionFactory * @param string $actionType * * @return string + * * @throws FireflyException */ public static function getActionClass(string $actionType): string @@ -84,13 +84,13 @@ class ActionFactory } /** - * Returns a map with actiontypes, mapped to the class representing that type + * Returns a map with actiontypes, mapped to the class representing that type. * * @return array */ protected static function getActionTypes(): array { - if (count(self::$actionTypes) === 0) { + if (0 === count(self::$actionTypes)) { self::$actionTypes = Domain::getRuleActions(); } diff --git a/app/TransactionRules/Factory/TriggerFactory.php b/app/TransactionRules/Factory/TriggerFactory.php index 3f7bf3fc28..35cf8f2431 100644 --- a/app/TransactionRules/Factory/TriggerFactory.php +++ b/app/TransactionRules/Factory/TriggerFactory.php @@ -1,7 +1,7 @@ . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Factory; @@ -31,13 +30,13 @@ use FireflyIII\TransactionRules\Triggers\TriggerInterface; use Log; /** - * @codeCoverageIgnore - * Interface TriggerInterface + * Class TriggerFactory can create triggers. * - * @package FireflyIII\TransactionRules\Triggers + * @codeCoverageIgnore */ class TriggerFactory { + /** @var array array with trigger types */ protected static $triggerTypes = []; /** @@ -78,7 +77,9 @@ class TriggerFactory * @param bool $stopProcessing * * @see TriggerFactory::getTrigger + * * @return AbstractTrigger + * * @throws FireflyException */ public static function makeTriggerFromStrings(string $triggerType, string $triggerValue, bool $stopProcessing) @@ -98,7 +99,7 @@ class TriggerFactory */ protected static function getTriggerTypes(): array { - if (count(self::$triggerTypes) === 0) { + if (0 === count(self::$triggerTypes)) { self::$triggerTypes = Domain::getRuleTriggers(); } @@ -113,6 +114,7 @@ class TriggerFactory * @param string $triggerType * * @return TriggerInterface|string + * * @throws FireflyException */ private static function getTriggerClass(string $triggerType): string diff --git a/app/TransactionRules/Processor.php b/app/TransactionRules/Processor.php index 8aed15f659..ad4a3560b7 100644 --- a/app/TransactionRules/Processor.php +++ b/app/TransactionRules/Processor.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules; @@ -36,26 +35,23 @@ use Illuminate\Support\Collection; use Log; /** - * Class Processor - * - * @package FireflyIII\TransactionRules + * Class Processor. */ final class Processor { - /** @var Collection */ + /** @var Collection Actions to exectute */ public $actions; - /** @var TransactionJournal */ + /** @var TransactionJournal Journal to run them on */ public $journal; - /** @var Rule */ + /** @var Rule Rule that applies */ public $rule; - /** @var Collection */ + /** @var Collection All triggers*/ public $triggers; - /** @var int */ - protected $foundTriggers = 0; + /** @var int Found triggers */ + private $foundTriggers = 0; /** * Processor constructor. - * */ private function __construct() { @@ -68,7 +64,6 @@ final class Processor * and actions found in the given Rule. * * @param Rule $rule - * * @param bool $includeActions * * @return Processor @@ -128,7 +123,7 @@ final class Processor { $self = new self; foreach ($triggers as $entry) { - $entry['value'] = is_null($entry['value']) ? '' : $entry['value']; + $entry['value'] = null === $entry['value'] ? '' : $entry['value']; $trigger = TriggerFactory::makeTriggerFromStrings($entry['type'], $entry['value'], $entry['stopProcessing']); $self->triggers->push($trigger); } @@ -137,6 +132,8 @@ final class Processor } /** + * Return found triggers + * * @return int */ public function getFoundTriggers(): int @@ -145,6 +142,8 @@ final class Processor } /** + * Set found triggers + * * @param int $foundTriggers */ public function setFoundTriggers(int $foundTriggers) @@ -153,6 +152,7 @@ final class Processor } /** + * Returns the rule * * @return \FireflyIII\Models\Rule */ @@ -185,7 +185,7 @@ final class Processor Log::debug('Has more than zero actions.'); $this->actions(); } - if ($this->actions->count() === 0) { + if (0 === $this->actions->count()) { Log::info('Rule has no actions!'); } @@ -193,7 +193,6 @@ final class Processor } return false; - } /** @@ -220,16 +219,17 @@ final class Processor } return false; - } /** + * Run the actions + * * @return bool */ private function actions() { /** - * @var int $index + * @var int * @var RuleAction $action */ foreach ($this->actions as $action) { @@ -241,7 +241,6 @@ final class Processor Log::debug('Stop processing now and break.'); break; } - } return true; @@ -249,7 +248,7 @@ final class Processor /** * Method to check whether the current transaction would be triggered - * by the given list of triggers + * by the given list of triggers. * * @return bool */ @@ -261,25 +260,21 @@ final class Processor Log::debug(sprintf('Found triggers starts at %d', $foundTriggers)); /** @var AbstractTrigger $trigger */ foreach ($this->triggers as $trigger) { - $foundTriggers++; + ++$foundTriggers; Log::debug(sprintf('Now checking trigger %s with value %s', get_class($trigger), $trigger->getTriggerValue())); /** @var AbstractTrigger $trigger */ if ($trigger->triggered($this->journal)) { Log::debug('Is a match!'); - $hitTriggers++; + ++$hitTriggers; } if ($trigger->stopProcessing) { Log::debug('Stop processing this trigger and break.'); break; } - } $result = ($hitTriggers === $foundTriggers && $foundTriggers > 0); Log::debug('Result of triggered()', ['hitTriggers' => $hitTriggers, 'foundTriggers' => $foundTriggers, 'result' => $result]); return $result; - } - - } diff --git a/app/TransactionRules/TransactionMatcher.php b/app/TransactionRules/TransactionMatcher.php index 5e32179a2f..49ef27059b 100644 --- a/app/TransactionRules/TransactionMatcher.php +++ b/app/TransactionRules/TransactionMatcher.php @@ -1,7 +1,7 @@ . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules; @@ -33,21 +32,19 @@ use Log; /** * Class TransactionMatcher is used to find a list of - * transaction matching a set of triggers - * - * @package FireflyIII\TransactionRules + * transaction matching a set of triggers. */ class TransactionMatcher { - /** @var int */ + /** @var int Limit of matcher */ private $limit = 10; /** @var int Maximum number of transaction to search in (for performance reasons) * */ private $range = 200; - /** @var Rule */ + /** @var Rule The rule to apply */ private $rule; - /** @var JournalTaskerInterface */ + /** @var JournalTaskerInterface Tasker for some related tasks */ private $tasker; - /** @var array */ + /** @var array Types that can be matched using this matcher */ private $transactionTypes = [TransactionType::DEPOSIT, TransactionType::WITHDRAWAL, TransactionType::TRANSFER]; /** @var array List of triggers to match */ private $triggers = []; @@ -60,7 +57,6 @@ class TransactionMatcher public function __construct(JournalTaskerInterface $tasker) { $this->tasker = $tasker; - } /** @@ -69,11 +65,10 @@ class TransactionMatcher * triggers onto each transaction journal until enough matches are found ($limit). * * @return Collection - * */ public function findTransactionsByRule() { - if (count($this->rule->ruleTriggers) === 0) { + if (0 === count($this->rule->ruleTriggers)) { return new Collection; } @@ -94,11 +89,10 @@ class TransactionMatcher * triggers onto each transaction journal until enough matches are found ($limit). * * @return Collection - * */ public function findTransactionsByTriggers(): Collection { - if (count($this->triggers) === 0) { + if (0 === count($this->triggers)) { return new Collection; } @@ -114,6 +108,7 @@ class TransactionMatcher } /** + * Return limit * @return int */ public function getLimit(): int @@ -122,6 +117,8 @@ class TransactionMatcher } /** + * Set limit + * * @param int $limit * * @return TransactionMatcher @@ -134,6 +131,7 @@ class TransactionMatcher } /** + * Get range * @return int */ public function getRange(): int @@ -142,6 +140,8 @@ class TransactionMatcher } /** + * Set range + * * @param int $range * * @return TransactionMatcher @@ -151,10 +151,10 @@ class TransactionMatcher $this->range = $range; return $this; - } /** + * Get triggers * @return array */ public function getTriggers(): array @@ -163,6 +163,8 @@ class TransactionMatcher } /** + * Set triggers + * * @param array $triggers * * @return TransactionMatcher @@ -175,6 +177,8 @@ class TransactionMatcher } /** + * Set rule + * * @param Rule $rule */ public function setRule(Rule $rule) @@ -183,6 +187,8 @@ class TransactionMatcher } /** + * Run the processor. + * * @param Processor $processor * * @return Collection @@ -223,7 +229,7 @@ class TransactionMatcher Log::debug(sprintf('Total count is now %d', $result->count())); // Update counters - $page++; + ++$page; $processed += count($set); Log::debug(sprintf('Page is now %d, processed is %d', $page, $processed)); @@ -236,11 +242,8 @@ class TransactionMatcher Log::debug(sprintf('reachedEndOfList: %s', var_export($reachedEndOfList, true))); Log::debug(sprintf('foundEnough: %s', var_export($foundEnough, true))); Log::debug(sprintf('searchedEnough: %s', var_export($searchedEnough, true))); - } while (!$reachedEndOfList && !$foundEnough && !$searchedEnough); return $result; } - - } diff --git a/app/TransactionRules/Triggers/AbstractTrigger.php b/app/TransactionRules/Triggers/AbstractTrigger.php index 15368bd015..b6ca47c6ca 100644 --- a/app/TransactionRules/Triggers/AbstractTrigger.php +++ b/app/TransactionRules/Triggers/AbstractTrigger.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -30,33 +29,34 @@ use FireflyIII\Models\TransactionJournal; * This class will be magical! * * Class AbstractTrigger - * - * @package FireflyIII\TransactionRules\Triggers */ class AbstractTrigger { - /** @var bool */ + /** @var bool Whether to stop processing after this one is checked. */ public $stopProcessing; - /** @var string */ + /** @var string Value to check for */ protected $checkValue; - /** @var TransactionJournal */ + /** @var TransactionJournal Journal to check */ protected $journal; - /** @var RuleTrigger */ + /** @var RuleTrigger Trigger object */ protected $trigger; - /** @var string */ + /** @var string Trigger value */ protected $triggerValue; /** * AbstractTrigger constructor. + * * @codeCoverageIgnore */ private function __construct() { - } /** + * Make a new trigger from the value given in the string. + * * @codeCoverageIgnore + * * @param string $triggerValue * @param bool $stopProcessing * @@ -72,7 +72,9 @@ class AbstractTrigger } /** + * Make a new trigger from the rule trigger in the parameter * @codeCoverageIgnore + * * @param RuleTrigger $trigger * * @return AbstractTrigger @@ -88,7 +90,10 @@ class AbstractTrigger } /** + * Make a new trigger from a trigger value. + * * @codeCoverageIgnore + * * @param string $triggerValue * * @return AbstractTrigger @@ -102,7 +107,10 @@ class AbstractTrigger } /** + * Returns trigger + * * @codeCoverageIgnore + * * @return RuleTrigger */ public function getTrigger(): RuleTrigger @@ -111,13 +119,14 @@ class AbstractTrigger } /** + * Returns trigger value + * * @codeCoverageIgnore + * * @return string */ public function getTriggerValue(): string { return $this->triggerValue; } - - } diff --git a/app/TransactionRules/Triggers/AmountExactly.php b/app/TransactionRules/Triggers/AmountExactly.php index fadc89c159..b6f040478d 100644 --- a/app/TransactionRules/Triggers/AmountExactly.php +++ b/app/TransactionRules/Triggers/AmountExactly.php @@ -18,23 +18,18 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; - use FireflyIII\Models\TransactionJournal; use Log; /** - * Class AmountExactly - * - * @package FireflyIII\TransactionRules\Triggers + * Class AmountExactly. */ final class AmountExactly extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -53,7 +48,7 @@ final class AmountExactly extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { + if (null !== $value) { return false; } Log::error(sprintf('Cannot use %s with a null value.', self::class)); @@ -62,6 +57,8 @@ final class AmountExactly extends AbstractTrigger implements TriggerInterface } /** + * When the amount is exactly X. + * * @param TransactionJournal $journal * * @return bool @@ -71,7 +68,7 @@ final class AmountExactly extends AbstractTrigger implements TriggerInterface $amount = $journal->destination_amount ?? $journal->amountPositive(); $compare = $this->triggerValue; $result = bccomp($amount, $compare); - if ($result === 0) { + if (0 === $result) { Log::debug(sprintf('RuleTrigger AmountExactly for journal #%d: %d matches %d exactly, so return true', $journal->id, $amount, $compare)); return true; @@ -79,6 +76,5 @@ final class AmountExactly extends AbstractTrigger implements TriggerInterface Log::debug(sprintf('RuleTrigger AmountExactly for journal #%d: %d matches %d NOT exactly, so return false', $journal->id, $amount, $compare)); return false; - } } diff --git a/app/TransactionRules/Triggers/AmountLess.php b/app/TransactionRules/Triggers/AmountLess.php index 3879dd193b..7f3538a200 100644 --- a/app/TransactionRules/Triggers/AmountLess.php +++ b/app/TransactionRules/Triggers/AmountLess.php @@ -18,23 +18,18 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; - use FireflyIII\Models\TransactionJournal; use Log; /** - * Class AmountLess - * - * @package FireflyIII\TransactionRules\Triggers + * Class AmountLess. */ final class AmountLess extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -53,7 +48,7 @@ final class AmountLess extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { + if (null !== $value) { return false; } Log::error(sprintf('Cannot use %s with a null value.', self::class)); @@ -62,6 +57,8 @@ final class AmountLess extends AbstractTrigger implements TriggerInterface } /** + * Returns true when amount is less than X. + * * @param TransactionJournal $journal * * @return bool @@ -80,6 +77,5 @@ final class AmountLess extends AbstractTrigger implements TriggerInterface Log::debug(sprintf('RuleTrigger AmountLess for journal #%d: %d is NOT less than %d, so return false', $journal->id, $amount, $compare)); return false; - } } diff --git a/app/TransactionRules/Triggers/AmountMore.php b/app/TransactionRules/Triggers/AmountMore.php index 3f2c798861..5e641a8e11 100644 --- a/app/TransactionRules/Triggers/AmountMore.php +++ b/app/TransactionRules/Triggers/AmountMore.php @@ -18,23 +18,18 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; - use FireflyIII\Models\TransactionJournal; use Log; /** - * Class AmountMore - * - * @package FireflyIII\TransactionRules\Triggers + * Class AmountMore. */ final class AmountMore extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -53,9 +48,9 @@ final class AmountMore extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { - $res = bccomp('0', strval($value)) === 0; - if ($res === true) { + if (null !== $value) { + $res = 0 === bccomp('0', strval($value)); + if (true === $res) { Log::error(sprintf('Cannot use %s with a value equal to 0.', self::class)); } @@ -68,6 +63,8 @@ final class AmountMore extends AbstractTrigger implements TriggerInterface } /** + * Returns true when amount is more than X. + * * @param TransactionJournal $journal * * @return bool @@ -77,7 +74,7 @@ final class AmountMore extends AbstractTrigger implements TriggerInterface $amount = $journal->destination_amount ?? $journal->amountPositive(); $compare = $this->triggerValue; $result = bccomp($amount, $compare); - if ($result === 1) { + if (1 === $result) { Log::debug(sprintf('RuleTrigger AmountMore for journal #%d: %d is more than %d, so return true', $journal->id, $amount, $compare)); return true; @@ -86,6 +83,5 @@ final class AmountMore extends AbstractTrigger implements TriggerInterface Log::debug(sprintf('RuleTrigger AmountMore for journal #%d: %d is NOT more than %d, so return false', $journal->id, $amount, $compare)); return false; - } } diff --git a/app/TransactionRules/Triggers/BudgetIs.php b/app/TransactionRules/Triggers/BudgetIs.php index 73b1afe26b..8a87c96f84 100644 --- a/app/TransactionRules/Triggers/BudgetIs.php +++ b/app/TransactionRules/Triggers/BudgetIs.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class BudgetIs - * - * @package FireflyIII\TransactionRules\Triggers + * Class BudgetIs. */ final class BudgetIs extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -53,7 +49,7 @@ final class BudgetIs extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { + if (null !== $value) { return false; } Log::error(sprintf('Cannot use %s with a null value.', self::class)); @@ -62,6 +58,8 @@ final class BudgetIs extends AbstractTrigger implements TriggerInterface } /** + * Returns true when budget is X. + * * @param TransactionJournal $journal * * @return bool @@ -69,7 +67,7 @@ final class BudgetIs extends AbstractTrigger implements TriggerInterface public function triggered(TransactionJournal $journal): bool { $budget = $journal->budgets()->first(); - if (!is_null($budget)) { + if (null !== $budget) { $name = strtolower($budget->name); // match on journal: if ($name === strtolower($this->triggerValue)) { @@ -79,18 +77,21 @@ final class BudgetIs extends AbstractTrigger implements TriggerInterface } } - if (is_null($budget)) { + if (null === $budget) { // perhaps transactions have this budget? /** @var Transaction $transaction */ foreach ($journal->transactions as $transaction) { $budget = $transaction->budgets()->first(); - if (!is_null($budget)) { + if (null !== $budget) { $name = strtolower($budget->name); if ($name === strtolower($this->triggerValue)) { Log::debug( sprintf( 'RuleTrigger BudgetIs for journal #%d (transaction #%d): "%s" is "%s", return true.', - $journal->id, $transaction->id, $name, $this->triggerValue + $journal->id, + $transaction->id, + $name, + $this->triggerValue ) ); diff --git a/app/TransactionRules/Triggers/CategoryIs.php b/app/TransactionRules/Triggers/CategoryIs.php index d18aa02a24..840d93d017 100644 --- a/app/TransactionRules/Triggers/CategoryIs.php +++ b/app/TransactionRules/Triggers/CategoryIs.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class CategoryIs - * - * @package FireflyIII\TransactionRules\Triggers + * Class CategoryIs. */ final class CategoryIs extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -53,7 +49,7 @@ final class CategoryIs extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { + if (null !== $value) { return false; } Log::error(sprintf('Cannot use %s with a null value.', self::class)); @@ -62,6 +58,8 @@ final class CategoryIs extends AbstractTrigger implements TriggerInterface } /** + * Returns true when category is X. + * * @param TransactionJournal $journal * * @return bool @@ -69,7 +67,7 @@ final class CategoryIs extends AbstractTrigger implements TriggerInterface public function triggered(TransactionJournal $journal): bool { $category = $journal->categories()->first(); - if (!is_null($category)) { + if (null !== $category) { $name = strtolower($category->name); // match on journal: if ($name === strtolower($this->triggerValue)) { @@ -79,18 +77,21 @@ final class CategoryIs extends AbstractTrigger implements TriggerInterface } } - if (is_null($category)) { + if (null === $category) { // perhaps transactions have this category? /** @var Transaction $transaction */ foreach ($journal->transactions as $transaction) { $category = $transaction->categories()->first(); - if (!is_null($category)) { + if (null !== $category) { $name = strtolower($category->name); if ($name === strtolower($this->triggerValue)) { Log::debug( sprintf( 'RuleTrigger CategoryIs for journal #%d (transaction #%d): "%s" is "%s", return true.', - $journal->id, $transaction->id, $name, $this->triggerValue + $journal->id, + $transaction->id, + $name, + $this->triggerValue ) ); diff --git a/app/TransactionRules/Triggers/DescriptionContains.php b/app/TransactionRules/Triggers/DescriptionContains.php index 3bc2f0d77d..2a14eb97f0 100644 --- a/app/TransactionRules/Triggers/DescriptionContains.php +++ b/app/TransactionRules/Triggers/DescriptionContains.php @@ -18,23 +18,18 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; - use FireflyIII\Models\TransactionJournal; use Log; /** - * Class DescriptionContains - * - * @package FireflyIII\TransactionRules\Triggers + * Class DescriptionContains. */ final class DescriptionContains extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -53,9 +48,9 @@ final class DescriptionContains extends AbstractTrigger implements TriggerInterf */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { - $res = strval($value) === ''; - if ($res === true) { + if (null !== $value) { + $res = '' === strval($value); + if (true === $res) { Log::error(sprintf('Cannot use %s with "" as a value.', self::class)); } @@ -68,6 +63,7 @@ final class DescriptionContains extends AbstractTrigger implements TriggerInterf } /** + * Returns true when description contains X * @param TransactionJournal $journal * * @return bool @@ -77,7 +73,7 @@ final class DescriptionContains extends AbstractTrigger implements TriggerInterf $search = strtolower($this->triggerValue); $source = strtolower($journal->description ?? ''); $strpos = stripos($source, $search); - if (!($strpos === false)) { + if (!(false === $strpos)) { Log::debug(sprintf('RuleTrigger DescriptionContains for journal #%d: "%s" contains "%s", return true.', $journal->id, $source, $search)); return true; @@ -86,6 +82,5 @@ final class DescriptionContains extends AbstractTrigger implements TriggerInterf Log::debug(sprintf('RuleTrigger DescriptionContains for journal #%d: "%s" does NOT contain "%s", return false.', $journal->id, $source, $search)); return false; - } } diff --git a/app/TransactionRules/Triggers/DescriptionEnds.php b/app/TransactionRules/Triggers/DescriptionEnds.php index 5bbb6b5d83..36b077c7f2 100644 --- a/app/TransactionRules/Triggers/DescriptionEnds.php +++ b/app/TransactionRules/Triggers/DescriptionEnds.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class DescriptionEnds - * - * @package FireflyIII\TransactionRules\Triggers + * Class DescriptionEnds. */ final class DescriptionEnds extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -52,9 +48,9 @@ final class DescriptionEnds extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { - $res = strval($value) === ''; - if ($res === true) { + if (null !== $value) { + $res = '' === strval($value); + if (true === $res) { Log::error(sprintf('Cannot use %s with "" as a value.', self::class)); } @@ -67,6 +63,8 @@ final class DescriptionEnds extends AbstractTrigger implements TriggerInterface } /** + * Returns true when description ends with X + * * @param TransactionJournal $journal * * @return bool @@ -89,7 +87,6 @@ final class DescriptionEnds extends AbstractTrigger implements TriggerInterface $part = substr($description, $searchLength * -1); if ($part === $search) { - Log::debug(sprintf('RuleTrigger DescriptionEnds for journal #%d: "%s" ends with "%s", return true.', $journal->id, $description, $search)); return true; diff --git a/app/TransactionRules/Triggers/DescriptionIs.php b/app/TransactionRules/Triggers/DescriptionIs.php index bd6be247a5..bce888ebfe 100644 --- a/app/TransactionRules/Triggers/DescriptionIs.php +++ b/app/TransactionRules/Triggers/DescriptionIs.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class DescriptionIs - * - * @package FireflyIII\TransactionRules\Triggers + * Class DescriptionIs. */ final class DescriptionIs extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -52,7 +48,7 @@ final class DescriptionIs extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { + if (null !== $value) { return false; } @@ -62,6 +58,8 @@ final class DescriptionIs extends AbstractTrigger implements TriggerInterface } /** + * Returns true when description is X + * * @param TransactionJournal $journal * * @return bool @@ -72,7 +70,6 @@ final class DescriptionIs extends AbstractTrigger implements TriggerInterface $search = strtolower($this->triggerValue); if ($description === $search) { - Log::debug(sprintf('RuleTrigger DescriptionIs for journal #%d: "%s" is "%s", return true.', $journal->id, $description, $search)); return true; diff --git a/app/TransactionRules/Triggers/DescriptionStarts.php b/app/TransactionRules/Triggers/DescriptionStarts.php index 9d48ffcc2f..773a58e03a 100644 --- a/app/TransactionRules/Triggers/DescriptionStarts.php +++ b/app/TransactionRules/Triggers/DescriptionStarts.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class DescriptionStarts - * - * @package FireflyIII\TransactionRules\Triggers + * Class DescriptionStarts. */ final class DescriptionStarts extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -52,9 +48,9 @@ final class DescriptionStarts extends AbstractTrigger implements TriggerInterfac */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { - $res = strval($value) === ''; - if ($res === true) { + if (null !== $value) { + $res = '' === strval($value); + if (true === $res) { Log::error(sprintf('Cannot use %s with "" as a value.', self::class)); } @@ -67,6 +63,8 @@ final class DescriptionStarts extends AbstractTrigger implements TriggerInterfac } /** + * Returns true when description starts with X + * * @param TransactionJournal $journal * * @return bool diff --git a/app/TransactionRules/Triggers/FromAccountContains.php b/app/TransactionRules/Triggers/FromAccountContains.php index e6d0472264..8e265a2645 100644 --- a/app/TransactionRules/Triggers/FromAccountContains.php +++ b/app/TransactionRules/Triggers/FromAccountContains.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class FromAccountContains - * - * @package FireflyIII\TransactionRules\Triggers + * Class FromAccountContains. */ final class FromAccountContains extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -53,9 +49,9 @@ final class FromAccountContains extends AbstractTrigger implements TriggerInterf */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { - $res = strval($value) === ''; - if ($res === true) { + if (null !== $value) { + $res = '' === strval($value); + if (true === $res) { Log::error(sprintf('Cannot use %s with "" as a value.', self::class)); } @@ -67,6 +63,8 @@ final class FromAccountContains extends AbstractTrigger implements TriggerInterf } /** + * Returns true when from-account contains X + * * @param TransactionJournal $journal * * @return bool @@ -83,8 +81,7 @@ final class FromAccountContains extends AbstractTrigger implements TriggerInterf $search = strtolower($this->triggerValue); $strpos = strpos($fromAccountName, $search); - if (!($strpos === false)) { - + if (!(false === $strpos)) { Log::debug(sprintf('RuleTrigger FromAccountContains for journal #%d: "%s" contains "%s", return true.', $journal->id, $fromAccountName, $search)); return true; @@ -93,11 +90,12 @@ final class FromAccountContains extends AbstractTrigger implements TriggerInterf Log::debug( sprintf( 'RuleTrigger FromAccountContains for journal #%d: "%s" does not contain "%s", return false.', - $journal->id, $fromAccountName, $search + $journal->id, + $fromAccountName, + $search ) ); return false; - } } diff --git a/app/TransactionRules/Triggers/FromAccountEnds.php b/app/TransactionRules/Triggers/FromAccountEnds.php index 6e08f5d0de..0c7818ee91 100644 --- a/app/TransactionRules/Triggers/FromAccountEnds.php +++ b/app/TransactionRules/Triggers/FromAccountEnds.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class FromAccountEnds - * - * @package FireflyIII\TransactionRules\Triggers + * Class FromAccountEnds. */ final class FromAccountEnds extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -53,9 +49,9 @@ final class FromAccountEnds extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { - $res = strval($value) === ''; - if ($res === true) { + if (null !== $value) { + $res = '' === strval($value); + if (true === $res) { Log::error(sprintf('Cannot use %s with "" as a value.', self::class)); } @@ -67,6 +63,8 @@ final class FromAccountEnds extends AbstractTrigger implements TriggerInterface } /** + * Returns true when from account ends with X + * * @param TransactionJournal $journal * * @return bool @@ -92,7 +90,6 @@ final class FromAccountEnds extends AbstractTrigger implements TriggerInterface return false; } - $part = substr($name, $searchLength * -1); if ($part === $search) { @@ -104,6 +101,5 @@ final class FromAccountEnds extends AbstractTrigger implements TriggerInterface Log::debug(sprintf('RuleTrigger FromAccountEnds for journal #%d: "%s" does not end with "%s", return false.', $journal->id, $name, $search)); return false; - } } diff --git a/app/TransactionRules/Triggers/FromAccountIs.php b/app/TransactionRules/Triggers/FromAccountIs.php index 880cf37072..4c8321f241 100644 --- a/app/TransactionRules/Triggers/FromAccountIs.php +++ b/app/TransactionRules/Triggers/FromAccountIs.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class FromAccountIs - * - * @package FireflyIII\TransactionRules\Triggers + * Class FromAccountIs. */ final class FromAccountIs extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -53,9 +49,9 @@ final class FromAccountIs extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { - $res = strval($value) === ''; - if ($res === true) { + if (null !== $value) { + $res = '' === strval($value); + if (true === $res) { Log::error(sprintf('Cannot use %s with "" as a value.', self::class)); } @@ -67,6 +63,8 @@ final class FromAccountIs extends AbstractTrigger implements TriggerInterface } /** + * Returns true when from-account is X. + * * @param TransactionJournal $journal * * @return bool @@ -91,6 +89,5 @@ final class FromAccountIs extends AbstractTrigger implements TriggerInterface Log::debug(sprintf('RuleTrigger FromAccountIs for journal #%d: "%s" is NOT "%s", return false.', $journal->id, $name, $search)); return false; - } } diff --git a/app/TransactionRules/Triggers/FromAccountStarts.php b/app/TransactionRules/Triggers/FromAccountStarts.php index 637c3d34d3..117d727273 100644 --- a/app/TransactionRules/Triggers/FromAccountStarts.php +++ b/app/TransactionRules/Triggers/FromAccountStarts.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class FromAccountStarts - * - * @package FireflyIII\TransactionRules\Triggers + * Class FromAccountStarts. */ final class FromAccountStarts extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -53,9 +49,9 @@ final class FromAccountStarts extends AbstractTrigger implements TriggerInterfac */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { - $res = strval($value) === ''; - if ($res === true) { + if (null !== $value) { + $res = '' === strval($value); + if (true === $res) { Log::error(sprintf('Cannot use %s with "" as a value.', self::class)); } @@ -67,6 +63,8 @@ final class FromAccountStarts extends AbstractTrigger implements TriggerInterfac } /** + * Returns true when from-account starts with X. + * * @param TransactionJournal $journal * * @return bool diff --git a/app/TransactionRules/Triggers/HasAnyBudget.php b/app/TransactionRules/Triggers/HasAnyBudget.php index 66b6016ddc..57d3e7b2b4 100644 --- a/app/TransactionRules/Triggers/HasAnyBudget.php +++ b/app/TransactionRules/Triggers/HasAnyBudget.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class HasAnyBudget - * - * @package FireflyIII\TransactionRules\Triggers + * Class HasAnyBudget. */ final class HasAnyBudget extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -57,6 +53,8 @@ final class HasAnyBudget extends AbstractTrigger implements TriggerInterface } /** + * Returns true when transactions have any budget + * * @param TransactionJournal $journal * * @return bool @@ -86,6 +84,5 @@ final class HasAnyBudget extends AbstractTrigger implements TriggerInterface Log::debug(sprintf('RuleTrigger HasAnyBudget for journal #%d: count is %d, return false.', $journal->id, $count)); return false; - } } diff --git a/app/TransactionRules/Triggers/HasAnyCategory.php b/app/TransactionRules/Triggers/HasAnyCategory.php index 65fdb23723..58177c6603 100644 --- a/app/TransactionRules/Triggers/HasAnyCategory.php +++ b/app/TransactionRules/Triggers/HasAnyCategory.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class HasAnyCategory - * - * @package FireflyIII\TransactionRules\Triggers + * Class HasAnyCategory. */ final class HasAnyCategory extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -57,6 +53,8 @@ final class HasAnyCategory extends AbstractTrigger implements TriggerInterface } /** + * Returns true when journal has any category + * * @param TransactionJournal $journal * * @return bool @@ -86,6 +84,5 @@ final class HasAnyCategory extends AbstractTrigger implements TriggerInterface Log::debug(sprintf('RuleTrigger HasAnyCategory for journal #%d: count is %d, return false.', $journal->id, $count)); return false; - } } diff --git a/app/TransactionRules/Triggers/HasAnyTag.php b/app/TransactionRules/Triggers/HasAnyTag.php index 765f814129..bbc07bdcdc 100644 --- a/app/TransactionRules/Triggers/HasAnyTag.php +++ b/app/TransactionRules/Triggers/HasAnyTag.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class HasAnyTag - * - * @package FireflyIII\TransactionRules\Triggers + * Class HasAnyTag. */ final class HasAnyTag extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -56,6 +52,8 @@ final class HasAnyTag extends AbstractTrigger implements TriggerInterface } /** + * Returns true when journal has any tag + * * @param TransactionJournal $journal * * @return bool @@ -71,6 +69,5 @@ final class HasAnyTag extends AbstractTrigger implements TriggerInterface Log::debug(sprintf('RuleTrigger HasAnyTag for journal #%d: count is %d, return false.', $journal->id, $count)); return false; - } } diff --git a/app/TransactionRules/Triggers/HasAttachment.php b/app/TransactionRules/Triggers/HasAttachment.php index 86aed103ab..b9381cd82f 100644 --- a/app/TransactionRules/Triggers/HasAttachment.php +++ b/app/TransactionRules/Triggers/HasAttachment.php @@ -18,18 +18,18 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; - use FireflyIII\Models\TransactionJournal; use Log; +/** + * Class HasAttachment + */ class HasAttachment extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -57,18 +57,23 @@ class HasAttachment extends AbstractTrigger implements TriggerInterface } /** + * Returns true when journal has more than X attachments. + * * @param TransactionJournal $journal * * @return bool */ public function triggered(TransactionJournal $journal): bool { - $minimum = intval($this->triggerValue); + $minimum = intval($this->triggerValue); $attachments = $journal->attachments()->count(); if ($attachments >= $minimum) { Log::debug( sprintf( - 'RuleTrigger HasAttachment for journal #%d: count is %d, is more than or equal to %d, return true.', $journal->id, $attachments, $minimum + 'RuleTrigger HasAttachment for journal #%d: count is %d, is more than or equal to %d, return true.', + $journal->id, + $attachments, + $minimum ) ); diff --git a/app/TransactionRules/Triggers/HasNoBudget.php b/app/TransactionRules/Triggers/HasNoBudget.php index cd35f4ad78..f0990f99fb 100644 --- a/app/TransactionRules/Triggers/HasNoBudget.php +++ b/app/TransactionRules/Triggers/HasNoBudget.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class HasNoBudget - * - * @package FireflyIII\TransactionRules\Triggers + * Class HasNoBudget. */ final class HasNoBudget extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -57,6 +53,7 @@ final class HasNoBudget extends AbstractTrigger implements TriggerInterface } /** + * Returns true when journal has no budget * @param TransactionJournal $journal * * @return bool @@ -70,7 +67,7 @@ final class HasNoBudget extends AbstractTrigger implements TriggerInterface foreach ($journal->transactions()->get() as $transaction) { $count += $transaction->budgets()->count(); } - if ($count === 0) { + if (0 === $count) { Log::debug(sprintf('RuleTrigger HasNoBudget for journal #%d: count is %d, return true.', $journal->id, $count)); return true; @@ -79,6 +76,5 @@ final class HasNoBudget extends AbstractTrigger implements TriggerInterface Log::debug(sprintf('RuleTrigger HasNoBudget for journal #%d: count is %d, return false.', $journal->id, $count)); return false; - } } diff --git a/app/TransactionRules/Triggers/HasNoCategory.php b/app/TransactionRules/Triggers/HasNoCategory.php index ce3a84b678..03c8c18732 100644 --- a/app/TransactionRules/Triggers/HasNoCategory.php +++ b/app/TransactionRules/Triggers/HasNoCategory.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class HasNoCategory - * - * @package FireflyIII\TransactionRules\Triggers + * Class HasNoCategory. */ final class HasNoCategory extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -57,6 +53,8 @@ final class HasNoCategory extends AbstractTrigger implements TriggerInterface } /** + * Returns true when journal has no category + * * @param TransactionJournal $journal * * @return bool @@ -71,7 +69,7 @@ final class HasNoCategory extends AbstractTrigger implements TriggerInterface $count += $transaction->categories()->count(); } - if ($count === 0) { + if (0 === $count) { Log::debug(sprintf('RuleTrigger HasNoCategory for journal #%d: count is %d, return true.', $journal->id, $count)); return true; @@ -79,6 +77,5 @@ final class HasNoCategory extends AbstractTrigger implements TriggerInterface Log::debug(sprintf('RuleTrigger HasNoCategory for journal #%d: count is %d, return false.', $journal->id, $count)); return false; - } } diff --git a/app/TransactionRules/Triggers/HasNoTag.php b/app/TransactionRules/Triggers/HasNoTag.php index b2b610d588..377c2bcdd5 100644 --- a/app/TransactionRules/Triggers/HasNoTag.php +++ b/app/TransactionRules/Triggers/HasNoTag.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class HasNoTag - * - * @package FireflyIII\TransactionRules\Triggers + * Class HasNoTag. */ final class HasNoTag extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -56,6 +52,8 @@ final class HasNoTag extends AbstractTrigger implements TriggerInterface } /** + * Return true when journal has no tags. + * * @param TransactionJournal $journal * * @return bool @@ -63,7 +61,7 @@ final class HasNoTag extends AbstractTrigger implements TriggerInterface public function triggered(TransactionJournal $journal): bool { $count = $journal->tags()->count(); - if ($count === 0) { + if (0 === $count) { Log::debug(sprintf('RuleTrigger HasNoTag for journal #%d: count is %d, return true.', $journal->id, $count)); return true; @@ -71,6 +69,5 @@ final class HasNoTag extends AbstractTrigger implements TriggerInterface Log::debug(sprintf('RuleTrigger HasNoTag for journal #%d: count is %d, return false.', $journal->id, $count)); return false; - } } diff --git a/app/TransactionRules/Triggers/NotesAny.php b/app/TransactionRules/Triggers/NotesAny.php index 50c20ca324..6e9b298047 100644 --- a/app/TransactionRules/Triggers/NotesAny.php +++ b/app/TransactionRules/Triggers/NotesAny.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class NotesAny - * - * @package FireflyIII\TransactionRules\Triggers + * Class NotesAny. */ final class NotesAny extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -57,6 +53,8 @@ final class NotesAny extends AbstractTrigger implements TriggerInterface } /** + * Returns true when journal has any notes + * * @param TransactionJournal $journal * * @return bool @@ -66,12 +64,11 @@ final class NotesAny extends AbstractTrigger implements TriggerInterface /** @var Note $note */ $note = $journal->notes()->first(); $text = ''; - if (!is_null($note)) { + if (null !== $note) { $text = $note->text; } if (strlen($text) > 0) { - Log::debug(sprintf('RuleTrigger NotesEmpty for journal #%d: strlen > 0, return true.', $journal->id)); return true; diff --git a/app/TransactionRules/Triggers/NotesAre.php b/app/TransactionRules/Triggers/NotesAre.php index 25a889390d..5aea73ae2b 100644 --- a/app/TransactionRules/Triggers/NotesAre.php +++ b/app/TransactionRules/Triggers/NotesAre.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class NotesAre - * - * @package FireflyIII\TransactionRules\Triggers + * Class NotesAre. */ final class NotesAre extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -53,7 +49,7 @@ final class NotesAre extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { + if (null !== $value) { return false; } @@ -63,6 +59,8 @@ final class NotesAre extends AbstractTrigger implements TriggerInterface } /** + * Returns true when notes are specifically X + * * @param TransactionJournal $journal * * @return bool @@ -72,13 +70,12 @@ final class NotesAre extends AbstractTrigger implements TriggerInterface /** @var Note $note */ $note = $journal->notes()->first(); $text = ''; - if (!is_null($note)) { + if (null !== $note) { $text = strtolower($note->text); } $search = strtolower($this->triggerValue); if ($text === $search && strlen($text) > 0) { - Log::debug(sprintf('RuleTrigger NotesAre for journal #%d: "%s" is "%s", return true.', $journal->id, $text, $search)); return true; diff --git a/app/TransactionRules/Triggers/NotesContain.php b/app/TransactionRules/Triggers/NotesContain.php index 4cbbc3fc88..20a8549d56 100644 --- a/app/TransactionRules/Triggers/NotesContain.php +++ b/app/TransactionRules/Triggers/NotesContain.php @@ -18,24 +18,19 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; - use FireflyIII\Models\Note; use FireflyIII\Models\TransactionJournal; use Log; /** - * Class NotesContain - * - * @package FireflyIII\TransactionRules\Triggers + * Class NotesContain. */ final class NotesContain extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -54,9 +49,9 @@ final class NotesContain extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { - $res = strval($value) === ''; - if ($res === true) { + if (null !== $value) { + $res = '' === strval($value); + if (true === $res) { Log::error(sprintf('Cannot use %s with "" as a value.', self::class)); } @@ -69,6 +64,8 @@ final class NotesContain extends AbstractTrigger implements TriggerInterface } /** + * Returns true when notes contains X + * * @param TransactionJournal $journal * * @return bool @@ -77,7 +74,7 @@ final class NotesContain extends AbstractTrigger implements TriggerInterface { $search = trim(strtolower($this->triggerValue)); - if (strlen($search) === 0) { + if (0 === strlen($search)) { Log::debug(sprintf('RuleTrigger NotesContain for journal #%d: "%s" is empty, return false.', $journal->id, $search)); return false; @@ -86,14 +83,12 @@ final class NotesContain extends AbstractTrigger implements TriggerInterface /** @var Note $note */ $note = $journal->notes()->first(); $text = ''; - if (!is_null($note)) { + if (null !== $note) { $text = strtolower($note->text); } - $strpos = strpos($text, $search); - if (!($strpos === false)) { - + if (!(false === $strpos)) { Log::debug(sprintf('RuleTrigger NotesContain for journal #%d: "%s" contains "%s", return true.', $journal->id, $text, $search)); return true; @@ -102,6 +97,5 @@ final class NotesContain extends AbstractTrigger implements TriggerInterface Log::debug(sprintf('RuleTrigger NotesContain for journal #%d: "%s" does NOT contain "%s", return false.', $journal->id, $text, $search)); return false; - } } diff --git a/app/TransactionRules/Triggers/NotesEmpty.php b/app/TransactionRules/Triggers/NotesEmpty.php index d53c642857..91af8d7b43 100644 --- a/app/TransactionRules/Triggers/NotesEmpty.php +++ b/app/TransactionRules/Triggers/NotesEmpty.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class NotesEmpty - * - * @package FireflyIII\TransactionRules\Triggers + * Class NotesEmpty. */ final class NotesEmpty extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -57,6 +53,8 @@ final class NotesEmpty extends AbstractTrigger implements TriggerInterface } /** + * Returns true when journal has no notes. + * * @param TransactionJournal $journal * * @return bool @@ -66,12 +64,11 @@ final class NotesEmpty extends AbstractTrigger implements TriggerInterface /** @var Note $note */ $note = $journal->notes()->first(); $text = ''; - if (!is_null($note)) { + if (null !== $note) { $text = $note->text; } - if (strlen($text) === 0) { - + if (0 === strlen($text)) { Log::debug(sprintf('RuleTrigger NotesEmpty for journal #%d: strlen is 0, return true.', $journal->id)); return true; diff --git a/app/TransactionRules/Triggers/NotesEnd.php b/app/TransactionRules/Triggers/NotesEnd.php index 5e1e3140a6..5ed37b9a04 100644 --- a/app/TransactionRules/Triggers/NotesEnd.php +++ b/app/TransactionRules/Triggers/NotesEnd.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class NotesEnd - * - * @package FireflyIII\TransactionRules\Triggers + * Class NotesEnd. */ final class NotesEnd extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -53,9 +49,9 @@ final class NotesEnd extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { - $res = strval($value) === ''; - if ($res === true) { + if (null !== $value) { + $res = '' === strval($value); + if (true === $res) { Log::error(sprintf('Cannot use %s with "" as a value.', self::class)); } @@ -68,6 +64,7 @@ final class NotesEnd extends AbstractTrigger implements TriggerInterface } /** + * Returns true when notes end with X * @param TransactionJournal $journal * * @return bool @@ -77,7 +74,7 @@ final class NotesEnd extends AbstractTrigger implements TriggerInterface /** @var Note $note */ $note = $journal->notes()->first(); $text = ''; - if (!is_null($note)) { + if (null !== $note) { $text = strtolower($note->text); } $notesLength = strlen($text); @@ -95,7 +92,6 @@ final class NotesEnd extends AbstractTrigger implements TriggerInterface $part = substr($text, $searchLength * -1); if ($part === $search) { - Log::debug(sprintf('RuleTrigger NotesEnd for journal #%d: "%s" ends with "%s", return true.', $journal->id, $text, $search)); return true; diff --git a/app/TransactionRules/Triggers/NotesStart.php b/app/TransactionRules/Triggers/NotesStart.php index b5a8eadb71..31bc0b43b1 100644 --- a/app/TransactionRules/Triggers/NotesStart.php +++ b/app/TransactionRules/Triggers/NotesStart.php @@ -18,24 +18,19 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; - use FireflyIII\Models\Note; use FireflyIII\Models\TransactionJournal; use Log; /** - * Class NotesStart - * - * @package FireflyIII\TransactionRules\Triggers + * Class NotesStart. */ final class NotesStart extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -54,9 +49,9 @@ final class NotesStart extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { - $res = strval($value) === ''; - if ($res === true) { + if (null !== $value) { + $res = '' === strval($value); + if (true === $res) { Log::error(sprintf('Cannot use %s with "" as a value.', self::class)); } @@ -69,6 +64,8 @@ final class NotesStart extends AbstractTrigger implements TriggerInterface } /** + * When the notes start with X. + * * @param TransactionJournal $journal * * @return bool @@ -78,7 +75,7 @@ final class NotesStart extends AbstractTrigger implements TriggerInterface /** @var Note $note */ $note = $journal->notes()->first(); $text = ''; - if (!is_null($note)) { + if (null !== $note) { $text = strtolower($note->text); } $search = strtolower($this->triggerValue); @@ -94,6 +91,5 @@ final class NotesStart extends AbstractTrigger implements TriggerInterface Log::debug(sprintf('RuleTrigger NotesStart for journal #%d: "%s" does not start with "%s", return false.', $journal->id, $text, $search)); return false; - } } diff --git a/app/TransactionRules/Triggers/TagIs.php b/app/TransactionRules/Triggers/TagIs.php index 7c7b7b02c9..de0b952de1 100644 --- a/app/TransactionRules/Triggers/TagIs.php +++ b/app/TransactionRules/Triggers/TagIs.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class TagIs - * - * @package FireflyIII\TransactionRules\Triggers + * Class TagIs. */ final class TagIs extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -53,7 +49,7 @@ final class TagIs extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { + if (null !== $value) { return false; } Log::error(sprintf('Cannot use %s with a null value.', self::class)); @@ -62,6 +58,8 @@ final class TagIs extends AbstractTrigger implements TriggerInterface } /** + * Returns true when tag is X. + * * @param TransactionJournal $journal * * @return bool diff --git a/app/TransactionRules/Triggers/ToAccountContains.php b/app/TransactionRules/Triggers/ToAccountContains.php index e0085cf76f..e73f575a75 100644 --- a/app/TransactionRules/Triggers/ToAccountContains.php +++ b/app/TransactionRules/Triggers/ToAccountContains.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class ToAccountContains - * - * @package FireflyIII\TransactionRules\Triggers + * Class ToAccountContains. */ final class ToAccountContains extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -53,9 +49,9 @@ final class ToAccountContains extends AbstractTrigger implements TriggerInterfac */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { - $res = strval($value) === ''; - if ($res === true) { + if (null !== $value) { + $res = '' === strval($value); + if (true === $res) { Log::error(sprintf('Cannot use %s with "" as a value.', self::class)); } @@ -67,6 +63,8 @@ final class ToAccountContains extends AbstractTrigger implements TriggerInterfac } /** + * Returns true when to-account contains X + * * @param TransactionJournal $journal * * @return bool @@ -83,8 +81,7 @@ final class ToAccountContains extends AbstractTrigger implements TriggerInterfac $search = strtolower($this->triggerValue); $strpos = strpos($toAccountName, $search); - if (!($strpos === false)) { - + if (!(false === $strpos)) { Log::debug(sprintf('RuleTrigger ToAccountContains for journal #%d: "%s" contains "%s", return true.', $journal->id, $toAccountName, $search)); return true; @@ -93,7 +90,9 @@ final class ToAccountContains extends AbstractTrigger implements TriggerInterfac Log::debug( sprintf( 'RuleTrigger ToAccountContains for journal #%d: "%s" does not contain "%s", return false.', - $journal->id, $toAccountName, $search + $journal->id, + $toAccountName, + $search ) ); diff --git a/app/TransactionRules/Triggers/ToAccountEnds.php b/app/TransactionRules/Triggers/ToAccountEnds.php index 01a8936171..ab623133c8 100644 --- a/app/TransactionRules/Triggers/ToAccountEnds.php +++ b/app/TransactionRules/Triggers/ToAccountEnds.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class ToAccountEnds - * - * @package FireflyIII\TransactionRules\Triggers + * Class ToAccountEnds. */ final class ToAccountEnds extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -53,9 +49,9 @@ final class ToAccountEnds extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { - $res = strval($value) === ''; - if ($res === true) { + if (null !== $value) { + $res = '' === strval($value); + if (true === $res) { Log::error(sprintf('Cannot use %s with "" as a value.', self::class)); } @@ -67,6 +63,8 @@ final class ToAccountEnds extends AbstractTrigger implements TriggerInterface } /** + * Returns true when to-account ends with X + * * @param TransactionJournal $journal * * @return bool @@ -92,7 +90,6 @@ final class ToAccountEnds extends AbstractTrigger implements TriggerInterface return false; } - $part = substr($toAccountName, $searchLength * -1); if ($part === $search) { diff --git a/app/TransactionRules/Triggers/ToAccountIs.php b/app/TransactionRules/Triggers/ToAccountIs.php index c2931cf0f2..ab224ff5a0 100644 --- a/app/TransactionRules/Triggers/ToAccountIs.php +++ b/app/TransactionRules/Triggers/ToAccountIs.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class ToAccountIs - * - * @package FireflyIII\TransactionRules\Triggers + * Class ToAccountIs. */ final class ToAccountIs extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -53,9 +49,9 @@ final class ToAccountIs extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { - $res = strval($value) === ''; - if ($res === true) { + if (null !== $value) { + $res = '' === strval($value); + if (true === $res) { Log::error(sprintf('Cannot use %s with "" as a value.', self::class)); } @@ -67,6 +63,7 @@ final class ToAccountIs extends AbstractTrigger implements TriggerInterface } /** + * Returns true when to-account is X. * @param TransactionJournal $journal * * @return bool @@ -91,6 +88,5 @@ final class ToAccountIs extends AbstractTrigger implements TriggerInterface Log::debug(sprintf('RuleTrigger ToAccountIs for journal #%d: "%s" is NOT "%s", return true.', $journal->id, $toAccountName, $search)); return false; - } } diff --git a/app/TransactionRules/Triggers/ToAccountStarts.php b/app/TransactionRules/Triggers/ToAccountStarts.php index e903af5a8a..38b18bcd2a 100644 --- a/app/TransactionRules/Triggers/ToAccountStarts.php +++ b/app/TransactionRules/Triggers/ToAccountStarts.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class ToAccountStarts - * - * @package FireflyIII\TransactionRules\Triggers + * Class ToAccountStarts. */ final class ToAccountStarts extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -53,9 +49,9 @@ final class ToAccountStarts extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { - $res = strval($value) === ''; - if ($res === true) { + if (null !== $value) { + $res = '' === strval($value); + if (true === $res) { Log::error(sprintf('Cannot use %s with "" as a value.', self::class)); } @@ -67,6 +63,8 @@ final class ToAccountStarts extends AbstractTrigger implements TriggerInterface } /** + * Returns true when to-account starts with X + * * @param TransactionJournal $journal * * @return bool @@ -90,8 +88,6 @@ final class ToAccountStarts extends AbstractTrigger implements TriggerInterface } Log::debug(sprintf('RuleTrigger ToAccountStarts for journal #%d: "%s" does not start with "%s", return false.', $journal->id, $toAccountName, $search)); - return false; - } } diff --git a/app/TransactionRules/Triggers/TransactionType.php b/app/TransactionRules/Triggers/TransactionType.php index e2ddf1b564..0b15a440e1 100644 --- a/app/TransactionRules/Triggers/TransactionType.php +++ b/app/TransactionRules/Triggers/TransactionType.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class TransactionType - * - * @package FireflyIII\TransactionRules\Triggers + * Class TransactionType. */ final class TransactionType extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -52,7 +48,7 @@ final class TransactionType extends AbstractTrigger implements TriggerInterface */ public static function willMatchEverything($value = null) { - if (!is_null($value)) { + if (null !== $value) { return false; } Log::error(sprintf('Cannot use %s with a null value.', self::class)); @@ -61,13 +57,15 @@ final class TransactionType extends AbstractTrigger implements TriggerInterface } /** + * Return true when transaction type is X + * * @param TransactionJournal $journal * * @return bool */ public function triggered(TransactionJournal $journal): bool { - $type = !is_null($journal->transaction_type_type) ? $journal->transaction_type_type : strtolower($journal->transactionType->type); + $type = null !== $journal->transaction_type_type ? $journal->transaction_type_type : strtolower($journal->transactionType->type); $search = strtolower($this->triggerValue); if ($type === $search) { diff --git a/app/TransactionRules/Triggers/TriggerInterface.php b/app/TransactionRules/Triggers/TriggerInterface.php index 611498f7fc..63c2b57af6 100644 --- a/app/TransactionRules/Triggers/TriggerInterface.php +++ b/app/TransactionRules/Triggers/TriggerInterface.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -26,13 +25,10 @@ namespace FireflyIII\TransactionRules\Triggers; use FireflyIII\Models\TransactionJournal; /** - * Interface TriggerInterface - * - * @package FireflyIII\TransactionRules\Triggers + * Interface TriggerInterface. */ interface TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -52,6 +48,8 @@ interface TriggerInterface public static function willMatchEverything($value = null); /** + * Triggers on a value and journal. + * * @param TransactionJournal $journal * * @return bool diff --git a/app/TransactionRules/Triggers/UserAction.php b/app/TransactionRules/Triggers/UserAction.php index cd327c26d3..eb0a99076e 100644 --- a/app/TransactionRules/Triggers/UserAction.php +++ b/app/TransactionRules/Triggers/UserAction.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\TransactionRules\Triggers; @@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal; use Log; /** - * Class UserAction - * - * @package FireflyIII\TransactionRules\Triggers + * Class UserAction. */ final class UserAction extends AbstractTrigger implements TriggerInterface { - /** * A trigger is said to "match anything", or match any given transaction, * when the trigger value is very vague or has no restrictions. Easy examples @@ -47,6 +43,7 @@ final class UserAction extends AbstractTrigger implements TriggerInterface * false. * * @param null $value + * * @codeCoverageIgnore * * @return bool @@ -60,6 +57,7 @@ final class UserAction extends AbstractTrigger implements TriggerInterface * This trigger is always triggered, because the rule that it is a part of has been pre-selected on this condition. * * @param TransactionJournal $journal + * * @codeCoverageIgnore * * @return bool diff --git a/app/User.php b/app/User.php index 63ff33060f..1bad9256c7 100644 --- a/app/User.php +++ b/app/User.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace FireflyIII; use FireflyIII\Events\RequestedNewPassword; @@ -34,9 +32,7 @@ use Illuminate\Notifications\Notifiable; use Request; /** - * Class User - * - * @package FireflyIII + * Class User. */ class User extends Authenticatable { @@ -63,6 +59,8 @@ class User extends Authenticatable protected $table = 'users'; /** + * Link to accounts. + * * @return HasMany */ public function accounts(): HasMany @@ -91,6 +89,8 @@ class User extends Authenticatable } /** + * Link to attachments + * * @return HasMany */ public function attachments(): HasMany @@ -99,6 +99,8 @@ class User extends Authenticatable } /** + * Link to available budgets + * * @return HasMany */ public function availableBudgets(): HasMany @@ -107,6 +109,8 @@ class User extends Authenticatable } /** + * Link to bills. + * * @return HasMany */ public function bills(): HasMany @@ -115,6 +119,8 @@ class User extends Authenticatable } /** + * Link to budgets. + * * @return HasMany */ public function budgets(): HasMany @@ -123,6 +129,8 @@ class User extends Authenticatable } /** + * Link to categories + * * @return HasMany */ public function categories(): HasMany @@ -131,6 +139,8 @@ class User extends Authenticatable } /** + * Link to currency exchange rates + * * @return HasMany */ public function currencyExchangeRates(): HasMany @@ -139,6 +149,8 @@ class User extends Authenticatable } /** + * Link to export jobs + * * @return HasMany */ public function exportJobs(): HasMany @@ -147,6 +159,8 @@ class User extends Authenticatable } /** + * Generates access token. + * * @return string */ public function generateAccessToken(): string @@ -167,7 +181,6 @@ class User extends Authenticatable */ public function hasRole(string $name): bool { - foreach ($this->roles as $role) { if ($role->name === $name) { return true; @@ -178,6 +191,8 @@ class User extends Authenticatable } /** + * Link to import jobs. + * * @return HasMany */ public function importJobs(): HasMany @@ -186,6 +201,8 @@ class User extends Authenticatable } /** + * Link to piggy banks. + * * @return HasManyThrough */ public function piggyBanks(): HasManyThrough @@ -194,6 +211,8 @@ class User extends Authenticatable } /** + * Link to preferences. + * * @return HasMany */ public function preferences(): HasMany @@ -202,6 +221,8 @@ class User extends Authenticatable } /** + * Link to roles. + * * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ public function roles(): BelongsToMany @@ -210,6 +231,8 @@ class User extends Authenticatable } /** + * Link to rule groups. + * * @return HasMany */ public function ruleGroups(): HasMany @@ -218,6 +241,8 @@ class User extends Authenticatable } /** + * Link to rules. + * * @return HasMany */ public function rules(): HasMany @@ -228,9 +253,7 @@ class User extends Authenticatable /** * Send the password reset notification. * - * @param string $token - * - * @return void + * @param string $token */ public function sendPasswordResetNotification($token) { @@ -240,6 +263,8 @@ class User extends Authenticatable } /** + * Link to tags. + * * @return HasMany */ public function tags(): HasMany @@ -248,6 +273,8 @@ class User extends Authenticatable } /** + * Link to transaction journals. + * * @return HasMany */ public function transactionJournals(): HasMany @@ -256,12 +283,12 @@ class User extends Authenticatable } /** + * Link to transactions. + * * @return HasManyThrough */ public function transactions(): HasManyThrough { return $this->hasManyThrough('FireflyIII\Models\Transaction', 'FireflyIII\Models\TransactionJournal'); } - - } diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index 368b9361ae..95b14b987b 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace FireflyIII\Validation; @@ -42,20 +41,16 @@ use Illuminate\Contracts\Translation\Translator; use Illuminate\Validation\Validator; /** - * Class FireflyValidator - * - * @package FireflyIII\Validation + * Class FireflyValidator. */ class FireflyValidator extends Validator { - /** * @param Translator $translator * @param array $data * @param array $rules * @param array $messages * @param array $customAttributes - * */ public function __construct(Translator $translator, array $data, array $rules, array $messages = [], array $customAttributes = []) { @@ -64,15 +59,15 @@ class FireflyValidator extends Validator /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * * @param $attribute * @param $value * * @return bool - * */ public function validate2faCode($attribute, $value): bool { - if (!is_string($value) || is_null($value) || strlen($value) <> 6) { + if (!is_string($value) || null === $value || 6 != strlen($value)) { return false; } @@ -83,6 +78,7 @@ class FireflyValidator extends Validator /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * * @param $attribute * @param $value * @param $parameters @@ -93,34 +89,33 @@ class FireflyValidator extends Validator { $field = $parameters[1] ?? 'id'; - if (intval($value) === 0) { + if (0 === intval($value)) { return true; } $count = DB::table($parameters[0])->where('user_id', auth()->user()->id)->where($field, $value)->count(); - if ($count === 1) { + if (1 === $count) { return true; } return false; - } /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * * @param $attribute * @param $value * * @return bool - * */ public function validateBic($attribute, $value): bool { $regex = '/^[a-z]{6}[0-9a-z]{2}([0-9a-z]{3})?\z/i'; $result = preg_match($regex, $value); - if ($result === false) { + if (false === $result) { return false; } - if ($result === 0) { + if (0 === $result) { return false; } @@ -129,15 +124,15 @@ class FireflyValidator extends Validator /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * * @param $attribute * @param $value * - * * @return bool */ public function validateIban($attribute, $value): bool { - if (!is_string($value) || is_null($value) || strlen($value) < 6) { + if (!is_string($value) || null === $value || strlen($value) < 6) { return false; } @@ -145,7 +140,7 @@ class FireflyValidator extends Validator $search = [' ', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; $replace = ['', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', - '32', '33', '34', '35']; + '32', '33', '34', '35',]; // take $first = substr($value, 0, 4); @@ -154,7 +149,7 @@ class FireflyValidator extends Validator $iban = str_replace($search, $replace, $iban); $checksum = bcmod($iban, '97'); - return (intval($checksum) === 1); + return 1 === intval($checksum); } /** @@ -174,6 +169,7 @@ class FireflyValidator extends Validator /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * * @param $attribute * @param $value * @param $parameters @@ -184,11 +180,11 @@ class FireflyValidator extends Validator { $field = $parameters[1] ?? 'id'; - if (intval($value) === 0) { + if (0 === intval($value)) { return true; } $count = DB::table($parameters[0])->where($field, $value)->count(); - if ($count === 1) { + if (1 === $count) { return true; } @@ -226,10 +222,9 @@ class FireflyValidator extends Validator } )->count(); - return ($count === 1); + return 1 === $count; case 'invalid': return false; - } } @@ -257,13 +252,13 @@ class FireflyValidator extends Validator switch ($name) { case 'amount_less': $result = is_numeric($value); - if ($result === false) { + if (false === $result) { return false; } break; case 'transaction_type': $count = TransactionType::where('type', $value)->count(); - if (!($count === 1)) { + if (!(1 === $count)) { return false; } break; @@ -279,7 +274,6 @@ class FireflyValidator extends Validator $class = $classes[$name]; return !($class::willMatchEverything($value)); - } return false; @@ -295,7 +289,7 @@ class FireflyValidator extends Validator { $verify = false; if (isset($this->data['verify_password'])) { - $verify = intval($this->data['verify_password']) === 1; + $verify = 1 === intval($this->data['verify_password']); } if ($verify) { /** @var Verifier $service */ @@ -309,11 +303,11 @@ class FireflyValidator extends Validator /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * * @param $attribute * @param $value * @param $parameters * - * * @return bool */ public function validateUniqueAccountForUser($attribute, $value, $parameters): bool @@ -334,12 +328,12 @@ class FireflyValidator extends Validator return $this->validateByAccountId($value); } - return false; } /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * * @param $attribute * @param $value * @param $parameters @@ -363,13 +357,11 @@ class FireflyValidator extends Validator /** @var AccountMeta $entry */ foreach ($set as $entry) { if ($entry->data === $value) { - return false; } } return true; - } /** @@ -384,7 +376,6 @@ class FireflyValidator extends Validator * @param $value * @param $parameters * - * * @return bool */ public function validateUniqueObjectForUser($attribute, $value, $parameters): bool @@ -412,6 +403,7 @@ class FireflyValidator extends Validator /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * * @param $attribute * @param $value * @param $parameters @@ -423,7 +415,7 @@ class FireflyValidator extends Validator $exclude = $parameters[0] ?? null; $query = DB::table('piggy_banks')->whereNull('piggy_banks.deleted_at') ->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')->where('accounts.user_id', auth()->user()->id); - if (!is_null($exclude)) { + if (null !== $exclude) { $query->where('piggy_banks.id', '!=', $exclude); } $set = $query->get(['piggy_banks.*']); @@ -447,7 +439,6 @@ class FireflyValidator extends Validator private function getRuleTriggerName($index): string { return $this->data['rule-trigger'][$index] ?? 'invalid'; - } /** @@ -489,7 +480,6 @@ class FireflyValidator extends Validator $type = AccountType::find($this->data['account_type_id'])->first(); $value = $this->tryDecrypt($this->data['name']); - $set = $user->accounts()->where('account_type_id', $type->id)->get(); /** @var Account $entry */ foreach ($set as $entry) { @@ -505,7 +495,6 @@ class FireflyValidator extends Validator * @param $value * * @return bool - * */ private function validateByAccountId($value): bool { @@ -525,7 +514,6 @@ class FireflyValidator extends Validator } return true; - } /** @@ -549,7 +537,6 @@ class FireflyValidator extends Validator } return true; - } /** @@ -575,4 +562,3 @@ class FireflyValidator extends Validator return true; } } - diff --git a/bootstrap/app.php b/bootstrap/app.php index 3517e6246b..e6099f49e7 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -21,7 +21,7 @@ bcscale(12); $app = new Illuminate\Foundation\Application( - realpath(__DIR__.'/../') + realpath(__DIR__ . '/../') ); /* @@ -51,33 +51,36 @@ $app->singleton( ); /* Overrule logging */ -$app->configureMonologUsing( - function (Logger $monolog) use ($app) { - $interface = php_sapi_name(); - $path = $app->storagePath() . '/logs/ff3-' . $interface . '.log'; - $level = 'debug'; - if ($app->bound('config')) { - $level = $app->make('config')->get('app.log_level', 'debug'); +if (env('APP_LOG', 'errorlog') === 'daily') { + $app->configureMonologUsing( + function (Logger $monolog) use ($app) { + + $interface = php_sapi_name(); + $path = $app->storagePath() . '/logs/ff3-' . $interface . '.log'; + $level = 'debug'; + if ($app->bound('config')) { + $level = $app->make('config')->get('app.log_level', 'debug'); + } + $levels = [ + 'debug' => Logger::DEBUG, + 'info' => Logger::INFO, + 'notice' => Logger::NOTICE, + 'warning' => Logger::WARNING, + 'error' => Logger::ERROR, + 'critical' => Logger::CRITICAL, + 'alert' => Logger::ALERT, + 'emergency' => Logger::EMERGENCY, + ]; + + $useLevel = $levels[$level]; + + $formatter = new LineFormatter(null, null, true, true); + $handler = new RotatingFileHandler($path, 5, $useLevel); + $handler->setFormatter($formatter); + $monolog->pushHandler($handler); } - $levels = [ - 'debug' => Logger::DEBUG, - 'info' => Logger::INFO, - 'notice' => Logger::NOTICE, - 'warning' => Logger::WARNING, - 'error' => Logger::ERROR, - 'critical' => Logger::CRITICAL, - 'alert' => Logger::ALERT, - 'emergency' => Logger::EMERGENCY, - ]; - - $useLevel = $levels[$level]; - - $formatter = new LineFormatter(null, null, true, true); - $handler = new RotatingFileHandler($path, 5, $useLevel); - $handler->setFormatter($formatter); - $monolog->pushHandler($handler); - } -); + ); +} /* |-------------------------------------------------------------------------- diff --git a/composer.json b/composer.json index 7000a1c6d5..ed4265d187 100644 --- a/composer.json +++ b/composer.json @@ -104,8 +104,7 @@ "@php artisan key:generate" ], "post-autoload-dump": [ - "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", - "@php artisan package:discover" + "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump" ], "post-update-cmd": [ "php artisan firefly:upgrade-database", @@ -116,6 +115,9 @@ "post-install-cmd": [ "php artisan optimize", "php artisan firefly:instructions install" + ], + "compile": [ + "@php -r \"file_exists('.env.heroku') || copy('.env.heroku', '.env');\"" ] }, "config": { diff --git a/composer.lock b/composer.lock index aefd8fccb3..6cc0578933 100644 --- a/composer.lock +++ b/composer.lock @@ -438,16 +438,16 @@ }, { "name": "doctrine/dbal", - "version": "v2.6.2", + "version": "v2.6.3", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "1a4ee83a5a709555f2c6f9057a3aacf892451c7e" + "reference": "e3eed9b1facbb0ced3a0995244843a189e7d1b13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/1a4ee83a5a709555f2c6f9057a3aacf892451c7e", - "reference": "1a4ee83a5a709555f2c6f9057a3aacf892451c7e", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/e3eed9b1facbb0ced3a0995244843a189e7d1b13", + "reference": "e3eed9b1facbb0ced3a0995244843a189e7d1b13", "shasum": "" }, "require": { @@ -507,7 +507,7 @@ "persistence", "queryobject" ], - "time": "2017-08-28T11:02:56+00:00" + "time": "2017-11-19T13:38:54+00:00" }, { "name": "doctrine/inflector", @@ -632,16 +632,16 @@ }, { "name": "egulias/email-validator", - "version": "2.1.2", + "version": "2.1.3", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "bc31baa11ea2883e017f0a10d9722ef9d50eac1c" + "reference": "1bec00a10039b823cc94eef4eddd47dcd3b2ca04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/bc31baa11ea2883e017f0a10d9722ef9d50eac1c", - "reference": "bc31baa11ea2883e017f0a10d9722ef9d50eac1c", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/1bec00a10039b823cc94eef4eddd47dcd3b2ca04", + "reference": "1bec00a10039b823cc94eef4eddd47dcd3b2ca04", "shasum": "" }, "require": { @@ -650,8 +650,8 @@ }, "require-dev": { "dominicsayers/isemail": "dev-master", - "phpunit/phpunit": "^4.8.0", - "satooshi/php-coveralls": "dev-master" + "phpunit/phpunit": "^4.8.35", + "satooshi/php-coveralls": "^1.0.1" }, "suggest": { "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" @@ -685,25 +685,28 @@ "validation", "validator" ], - "time": "2017-01-30T22:07:36+00:00" + "time": "2017-11-15T23:40:40+00:00" }, { "name": "erusev/parsedown", - "version": "1.6.3", + "version": "1.6.4", "source": { "type": "git", "url": "https://github.com/erusev/parsedown.git", - "reference": "728952b90a333b5c6f77f06ea9422b94b585878d" + "reference": "fbe3fe878f4fe69048bb8a52783a09802004f548" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/728952b90a333b5c6f77f06ea9422b94b585878d", - "reference": "728952b90a333b5c6f77f06ea9422b94b585878d", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/fbe3fe878f4fe69048bb8a52783a09802004f548", + "reference": "fbe3fe878f4fe69048bb8a52783a09802004f548", "shasum": "" }, "require": { "php": ">=5.3.0" }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, "type": "library", "autoload": { "psr-0": { @@ -727,7 +730,7 @@ "markdown", "parser" ], - "time": "2017-05-14T14:47:48+00:00" + "time": "2017-11-14T20:44:03+00:00" }, { "name": "fideloper/proxy", @@ -788,16 +791,16 @@ }, { "name": "laravel/framework", - "version": "v5.5.19", + "version": "v5.5.22", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "c678100e84934ec85c9f8bc26bd0a60222682719" + "reference": "2404af887ca8272d721628a99bbc721ac3b692e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/c678100e84934ec85c9f8bc26bd0a60222682719", - "reference": "c678100e84934ec85c9f8bc26bd0a60222682719", + "url": "https://api.github.com/repos/laravel/framework/zipball/2404af887ca8272d721628a99bbc721ac3b692e7", + "reference": "2404af887ca8272d721628a99bbc721ac3b692e7", "shasum": "" }, "require": { @@ -871,6 +874,8 @@ "suggest": { "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (~3.0).", "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.5).", + "ext-pcntl": "Required to use all features of the queue worker.", + "ext-posix": "Required to use all features of the queue worker.", "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (~6.0).", "laravel/tinker": "Required to use the tinker console command (~1.0).", @@ -879,7 +884,7 @@ "nexmo/client": "Required to use the Nexmo transport (~1.0).", "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0).", "predis/predis": "Required to use the redis cache and queue drivers (~1.0).", - "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (~2.0).", + "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (~3.0).", "symfony/css-selector": "Required to use some of the crawler integration testing tools (~3.3).", "symfony/dom-crawler": "Required to use most of the crawler integration testing tools (~3.3).", "symfony/psr-http-message-bridge": "Required to psr7 bridging features (~1.0)." @@ -915,7 +920,7 @@ "framework", "laravel" ], - "time": "2017-10-25T19:10:45+00:00" + "time": "2017-11-27T15:29:55+00:00" }, { "name": "laravelcollective/html", @@ -1871,44 +1876,45 @@ }, { "name": "symfony/console", - "version": "v3.3.10", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "116bc56e45a8e5572e51eb43ab58c769a352366c" + "reference": "9468ad3fba3a5e1f0dc12a96e50e84cddb923cf0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/116bc56e45a8e5572e51eb43ab58c769a352366c", - "reference": "116bc56e45a8e5572e51eb43ab58c769a352366c", + "url": "https://api.github.com/repos/symfony/console/zipball/9468ad3fba3a5e1f0dc12a96e50e84cddb923cf0", + "reference": "9468ad3fba3a5e1f0dc12a96e50e84cddb923cf0", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0", + "symfony/debug": "~2.8|~3.0|~4.0", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/dependency-injection": "<3.3" + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.3", - "symfony/dependency-injection": "~3.3", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/filesystem": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0" + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" }, "suggest": { "psr/log": "For using the console logger", "symfony/event-dispatcher": "", - "symfony/filesystem": "", + "symfony/lock": "", "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1935,20 +1941,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-10-02T06:42:24+00:00" + "time": "2017-11-29T13:28:14+00:00" }, { "name": "symfony/css-selector", - "version": "v3.3.10", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "07447650225ca9223bd5c97180fe7c8267f7d332" + "reference": "7134b93e90ea7e7881fcb2da006d21b4c5f31908" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/07447650225ca9223bd5c97180fe7c8267f7d332", - "reference": "07447650225ca9223bd5c97180fe7c8267f7d332", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/7134b93e90ea7e7881fcb2da006d21b4c5f31908", + "reference": "7134b93e90ea7e7881fcb2da006d21b4c5f31908", "shasum": "" }, "require": { @@ -1957,7 +1963,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1988,20 +1994,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2017-10-02T06:42:24+00:00" + "time": "2017-11-05T16:10:10+00:00" }, { "name": "symfony/debug", - "version": "v3.3.10", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd" + "reference": "fb2001e5d85f95d8b6ab94ae3be5d2672df128fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd", - "reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd", + "url": "https://api.github.com/repos/symfony/debug/zipball/fb2001e5d85f95d8b6ab94ae3be5d2672df128fd", + "reference": "fb2001e5d85f95d8b6ab94ae3be5d2672df128fd", "shasum": "" }, "require": { @@ -2012,12 +2018,12 @@ "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" }, "require-dev": { - "symfony/http-kernel": "~2.8|~3.0" + "symfony/http-kernel": "~2.8|~3.0|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2044,20 +2050,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-10-02T06:42:24+00:00" + "time": "2017-11-21T09:01:46+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v2.8.28", + "version": "v2.8.31", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "7fe089232554357efb8d4af65ce209fc6e5a2186" + "reference": "b59aacf238fadda50d612c9de73b74751872a903" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7fe089232554357efb8d4af65ce209fc6e5a2186", - "reference": "7fe089232554357efb8d4af65ce209fc6e5a2186", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b59aacf238fadda50d612c9de73b74751872a903", + "reference": "b59aacf238fadda50d612c9de73b74751872a903", "shasum": "" }, "require": { @@ -2104,20 +2110,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-10-01T21:00:16+00:00" + "time": "2017-11-05T15:25:56+00:00" }, { "name": "symfony/finder", - "version": "v3.3.10", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "773e19a491d97926f236942484cb541560ce862d" + "reference": "dac8d7db537bac7ad8143eb11360a8c2231f251a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/773e19a491d97926f236942484cb541560ce862d", - "reference": "773e19a491d97926f236942484cb541560ce862d", + "url": "https://api.github.com/repos/symfony/finder/zipball/dac8d7db537bac7ad8143eb11360a8c2231f251a", + "reference": "dac8d7db537bac7ad8143eb11360a8c2231f251a", "shasum": "" }, "require": { @@ -2126,7 +2132,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2153,33 +2159,34 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-10-02T06:42:24+00:00" + "time": "2017-11-05T16:10:10+00:00" }, { "name": "symfony/http-foundation", - "version": "v3.3.10", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8" + "reference": "d9625c8abb907e0ca2d7506afd7a719a572c766f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8", - "reference": "22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d9625c8abb907e0ca2d7506afd7a719a572c766f", + "reference": "d9625c8abb907e0ca2d7506afd7a719a572c766f", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.1" + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php70": "~1.6" }, "require-dev": { - "symfony/expression-language": "~2.8|~3.0" + "symfony/expression-language": "~2.8|~3.0|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2206,7 +2213,7 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2017-10-05T23:10:23+00:00" + "time": "2017-11-30T14:56:21+00:00" }, { "name": "symfony/http-kernel", @@ -2408,6 +2415,65 @@ ], "time": "2017-10-11T12:05:26+00:00" }, + { + "name": "symfony/polyfill-php70", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff", + "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "~1.0|~2.0", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, { "name": "symfony/polyfill-util", "version": "v1.6.0", @@ -2462,16 +2528,16 @@ }, { "name": "symfony/process", - "version": "v3.3.10", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "fdf89e57a723a29baf536e288d6e232c059697b1" + "reference": "db25e810fd5e124085e3777257d0cf4ae533d0ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/fdf89e57a723a29baf536e288d6e232c059697b1", - "reference": "fdf89e57a723a29baf536e288d6e232c059697b1", + "url": "https://api.github.com/repos/symfony/process/zipball/db25e810fd5e124085e3777257d0cf4ae533d0ea", + "reference": "db25e810fd5e124085e3777257d0cf4ae533d0ea", "shasum": "" }, "require": { @@ -2480,7 +2546,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2507,20 +2573,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-10-02T06:42:24+00:00" + "time": "2017-11-22T12:18:49+00:00" }, { "name": "symfony/routing", - "version": "v3.3.10", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "2e26fa63da029dab49bf9377b3b4f60a8fecb009" + "reference": "d768aa5b25d98188bae3fe4ce3eb2924c97aafac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/2e26fa63da029dab49bf9377b3b4f60a8fecb009", - "reference": "2e26fa63da029dab49bf9377b3b4f60a8fecb009", + "url": "https://api.github.com/repos/symfony/routing/zipball/d768aa5b25d98188bae3fe4ce3eb2924c97aafac", + "reference": "d768aa5b25d98188bae3fe4ce3eb2924c97aafac", "shasum": "" }, "require": { @@ -2529,17 +2595,17 @@ "conflict": { "symfony/config": "<2.8", "symfony/dependency-injection": "<3.3", - "symfony/yaml": "<3.3" + "symfony/yaml": "<3.4" }, "require-dev": { "doctrine/annotations": "~1.0", "doctrine/common": "~2.2", "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/http-foundation": "~2.8|~3.0", - "symfony/yaml": "~3.3" + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "~2.8|~3.0|~4.0", + "symfony/yaml": "~3.4|~4.0" }, "suggest": { "doctrine/annotations": "For using the annotation loader", @@ -2552,7 +2618,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2585,20 +2651,20 @@ "uri", "url" ], - "time": "2017-10-02T07:25:00+00:00" + "time": "2017-11-24T14:13:49+00:00" }, { "name": "symfony/translation", - "version": "v3.3.10", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "409bf229cd552bf7e3faa8ab7e3980b07672073f" + "reference": "e05b0a5996ad7a35ba3a19ffad8b72c9daa64dfa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/409bf229cd552bf7e3faa8ab7e3980b07672073f", - "reference": "409bf229cd552bf7e3faa8ab7e3980b07672073f", + "url": "https://api.github.com/repos/symfony/translation/zipball/e05b0a5996ad7a35ba3a19ffad8b72c9daa64dfa", + "reference": "e05b0a5996ad7a35ba3a19ffad8b72c9daa64dfa", "shasum": "" }, "require": { @@ -2607,13 +2673,16 @@ }, "conflict": { "symfony/config": "<2.8", - "symfony/yaml": "<3.3" + "symfony/dependency-injection": "<3.4", + "symfony/yaml": "<3.4" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/intl": "^2.8.18|^3.2.5", - "symfony/yaml": "~3.3" + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/intl": "^2.8.18|^3.2.5|~4.0", + "symfony/yaml": "~3.4|~4.0" }, "suggest": { "psr/log": "To use logging capability in translator", @@ -2623,7 +2692,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2650,20 +2719,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2017-10-02T06:42:24+00:00" + "time": "2017-11-27T14:23:00+00:00" }, { "name": "symfony/var-dumper", - "version": "v3.3.10", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "03e3693a36701f1c581dd24a6d6eea2eba2113f6" + "reference": "ec650a975a8e04e0c114d35eab732981243db3a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/03e3693a36701f1c581dd24a6d6eea2eba2113f6", - "reference": "03e3693a36701f1c581dd24a6d6eea2eba2113f6", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/ec650a975a8e04e0c114d35eab732981243db3a2", + "reference": "ec650a975a8e04e0c114d35eab732981243db3a2", "shasum": "" }, "require": { @@ -2679,12 +2748,13 @@ }, "suggest": { "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump", "ext-symfony_debug": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2718,7 +2788,7 @@ "debug", "dump" ], - "time": "2017-10-02T06:42:24+00:00" + "time": "2017-11-30T14:59:23+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -2880,16 +2950,16 @@ }, { "name": "watson/validating", - "version": "3.1.1", + "version": "3.1.2", "source": { "type": "git", "url": "https://github.com/dwightwatson/validating.git", - "reference": "ade13078bf2e820e244603446114a28eda51b08c" + "reference": "22edd06d45893f5d4f79c9e901bd7fbce174a79f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dwightwatson/validating/zipball/ade13078bf2e820e244603446114a28eda51b08c", - "reference": "ade13078bf2e820e244603446114a28eda51b08c", + "url": "https://api.github.com/repos/dwightwatson/validating/zipball/22edd06d45893f5d4f79c9e901bd7fbce174a79f", + "reference": "22edd06d45893f5d4f79c9e901bd7fbce174a79f", "shasum": "" }, "require": { @@ -2926,7 +2996,7 @@ "laravel", "validation" ], - "time": "2017-10-08T22:42:01+00:00" + "time": "2017-11-06T21:35:49+00:00" } ], "packages-dev": [ @@ -3157,16 +3227,16 @@ }, { "name": "filp/whoops", - "version": "2.1.12", + "version": "2.1.14", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "a99f0b151846021ba7a73b4e3cba3ebc9f14f03e" + "reference": "c6081b8838686aa04f1e83ba7e91f78b7b2a23e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/a99f0b151846021ba7a73b4e3cba3ebc9f14f03e", - "reference": "a99f0b151846021ba7a73b4e3cba3ebc9f14f03e", + "url": "https://api.github.com/repos/filp/whoops/zipball/c6081b8838686aa04f1e83ba7e91f78b7b2a23e6", + "reference": "c6081b8838686aa04f1e83ba7e91f78b7b2a23e6", "shasum": "" }, "require": { @@ -3175,7 +3245,7 @@ }, "require-dev": { "mockery/mockery": "0.9.*", - "phpunit/phpunit": "^4.8 || ^5.0", + "phpunit/phpunit": "^4.8.35 || ^5.7", "symfony/var-dumper": "^2.6 || ^3.0" }, "suggest": { @@ -3214,7 +3284,7 @@ "throwable", "whoops" ], - "time": "2017-10-15T13:05:10+00:00" + "time": "2017-11-23T18:22:44+00:00" }, { "name": "fzaninotto/faker", @@ -3797,29 +3867,35 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.1.1", + "version": "4.2.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2" + "reference": "66465776cfc249844bde6d117abff1d22e06c2da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/2d3d238c433cf69caeb4842e97a3223a116f94b2", - "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/66465776cfc249844bde6d117abff1d22e06c2da", + "reference": "66465776cfc249844bde6d117abff1d22e06c2da", "shasum": "" }, "require": { "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/reflection-common": "^1.0.0", "phpdocumentor/type-resolver": "^0.4.0", "webmozart/assert": "^1.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, "autoload": { "psr-4": { "phpDocumentor\\Reflection\\": [ @@ -3838,7 +3914,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-08-30T18:51:59+00:00" + "time": "2017-11-27T17:38:31+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -3889,16 +3965,16 @@ }, { "name": "phpspec/prophecy", - "version": "v1.7.2", + "version": "1.7.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", "shasum": "" }, "require": { @@ -3910,7 +3986,7 @@ }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7" }, "type": "library", "extra": { @@ -3948,20 +4024,20 @@ "spy", "stub" ], - "time": "2017-09-04T11:05:03+00:00" + "time": "2017-11-24T13:59:53+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "5.2.2", + "version": "5.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "8ed1902a57849e117b5651fc1a5c48110946c06b" + "reference": "033ec97498cf530cc1be4199264cad568b19be26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/8ed1902a57849e117b5651fc1a5c48110946c06b", - "reference": "8ed1902a57849e117b5651fc1a5c48110946c06b", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/033ec97498cf530cc1be4199264cad568b19be26", + "reference": "033ec97498cf530cc1be4199264cad568b19be26", "shasum": "" }, "require": { @@ -3970,7 +4046,7 @@ "php": "^7.0", "phpunit/php-file-iterator": "^1.4.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^1.4.11 || ^2.0", + "phpunit/php-token-stream": "^2.0.1", "sebastian/code-unit-reverse-lookup": "^1.0.1", "sebastian/environment": "^3.0", "sebastian/version": "^2.0.1", @@ -4012,20 +4088,20 @@ "testing", "xunit" ], - "time": "2017-08-03T12:40:43+00:00" + "time": "2017-11-27T09:00:30+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.2", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", "shasum": "" }, "require": { @@ -4059,7 +4135,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03T07:40:28+00:00" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -4153,16 +4229,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0" + "reference": "791198a2c6254db10131eecfe8c06670700904db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9a02332089ac48e704c70f6cefed30c224e3c0b0", - "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", + "reference": "791198a2c6254db10131eecfe8c06670700904db", "shasum": "" }, "require": { @@ -4198,20 +4274,20 @@ "keywords": [ "tokenizer" ], - "time": "2017-08-20T05:47:52+00:00" + "time": "2017-11-27T05:48:46+00:00" }, { "name": "phpunit/phpunit", - "version": "6.4.3", + "version": "6.4.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "06b28548fd2b4a20c3cd6e247dc86331a7d4db13" + "reference": "562f7dc75d46510a4ed5d16189ae57fbe45a9932" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/06b28548fd2b4a20c3cd6e247dc86331a7d4db13", - "reference": "06b28548fd2b4a20c3cd6e247dc86331a7d4db13", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/562f7dc75d46510a4ed5d16189ae57fbe45a9932", + "reference": "562f7dc75d46510a4ed5d16189ae57fbe45a9932", "shasum": "" }, "require": { @@ -4282,7 +4358,7 @@ "testing", "xunit" ], - "time": "2017-10-16T13:18:59+00:00" + "time": "2017-11-08T11:26:09+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -4390,30 +4466,30 @@ }, { "name": "sebastian/comparator", - "version": "2.0.2", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "ae068fede81d06e7bb9bb46a367210a3d3e1fe6a" + "reference": "1174d9018191e93cb9d719edec01257fc05f8158" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/ae068fede81d06e7bb9bb46a367210a3d3e1fe6a", - "reference": "ae068fede81d06e7bb9bb46a367210a3d3e1fe6a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1174d9018191e93cb9d719edec01257fc05f8158", + "reference": "1174d9018191e93cb9d719edec01257fc05f8158", "shasum": "" }, "require": { "php": "^7.0", "sebastian/diff": "^2.0", - "sebastian/exporter": "^3.0" + "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^6.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.1.x-dev" } }, "autoload": { @@ -4444,13 +4520,13 @@ } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2017-08-03T07:14:59+00:00" + "time": "2017-11-03T07:16:52+00:00" }, { "name": "sebastian/diff", @@ -4904,23 +4980,23 @@ }, { "name": "symfony/class-loader", - "version": "v3.3.10", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/class-loader.git", - "reference": "7572c904b209fa9907c69a6a9a68243c265a4d01" + "reference": "e8d36a7b5568d232f5c3f8ef92665836b9f1e038" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/class-loader/zipball/7572c904b209fa9907c69a6a9a68243c265a4d01", - "reference": "7572c904b209fa9907c69a6a9a68243c265a4d01", + "url": "https://api.github.com/repos/symfony/class-loader/zipball/e8d36a7b5568d232f5c3f8ef92665836b9f1e038", + "reference": "e8d36a7b5568d232f5c3f8ef92665836b9f1e038", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8" }, "require-dev": { - "symfony/finder": "~2.8|~3.0", + "symfony/finder": "~2.8|~3.0|~4.0", "symfony/polyfill-apcu": "~1.1" }, "suggest": { @@ -4929,7 +5005,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -4956,34 +5032,32 @@ ], "description": "Symfony ClassLoader Component", "homepage": "https://symfony.com", - "time": "2017-10-02T06:42:24+00:00" + "time": "2017-11-05T16:10:10+00:00" }, { "name": "symfony/config", - "version": "v3.3.10", + "version": "v4.0.0", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "4ab62407bff9cd97c410a7feaef04c375aaa5cfd" + "reference": "6e6dbc6d2beff8117b974d74274bff02e43c32a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/4ab62407bff9cd97c410a7feaef04c375aaa5cfd", - "reference": "4ab62407bff9cd97c410a7feaef04c375aaa5cfd", + "url": "https://api.github.com/repos/symfony/config/zipball/6e6dbc6d2beff8117b974d74274bff02e43c32a6", + "reference": "6e6dbc6d2beff8117b974d74274bff02e43c32a6", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0" + "php": "^7.1.3", + "symfony/filesystem": "~3.4|~4.0" }, "conflict": { - "symfony/dependency-injection": "<3.3", - "symfony/finder": "<3.3" + "symfony/finder": "<3.4" }, "require-dev": { - "symfony/dependency-injection": "~3.3", - "symfony/finder": "~3.3", - "symfony/yaml": "~3.0" + "symfony/finder": "~3.4|~4.0", + "symfony/yaml": "~3.4|~4.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" @@ -4991,7 +5065,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -5018,29 +5092,29 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-10-04T18:56:58+00:00" + "time": "2017-11-20T18:22:57+00:00" }, { "name": "symfony/filesystem", - "version": "v3.3.10", + "version": "v4.0.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "90bc45abf02ae6b7deb43895c1052cb0038506f1" + "reference": "c9d4a26759ff75a077e4e334315cb632739b661a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/90bc45abf02ae6b7deb43895c1052cb0038506f1", - "reference": "90bc45abf02ae6b7deb43895c1052cb0038506f1", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/c9d4a26759ff75a077e4e334315cb632739b661a", + "reference": "c9d4a26759ff75a077e4e334315cb632739b661a", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -5067,29 +5141,29 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-10-03T13:33:10+00:00" + "time": "2017-11-21T14:14:53+00:00" }, { "name": "symfony/stopwatch", - "version": "v3.3.10", + "version": "v4.0.0", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "170edf8b3247d7b6779eb6fa7428f342702ca184" + "reference": "ac0e49150555c703fef6b696d8eaba1db7a3ca03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/170edf8b3247d7b6779eb6fa7428f342702ca184", - "reference": "170edf8b3247d7b6779eb6fa7428f342702ca184", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/ac0e49150555c703fef6b696d8eaba1db7a3ca03", + "reference": "ac0e49150555c703fef6b696d8eaba1db7a3ca03", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -5116,27 +5190,30 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2017-10-02T06:42:24+00:00" + "time": "2017-11-09T12:45:29+00:00" }, { "name": "symfony/yaml", - "version": "v3.3.10", + "version": "v4.0.0", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46" + "reference": "7be8741ce5dce9943f41a9269f6828b66e726776" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46", - "reference": "8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46", + "url": "https://api.github.com/repos/symfony/yaml/zipball/7be8741ce5dce9943f41a9269f6828b66e726776", + "reference": "7be8741ce5dce9943f41a9269f6828b66e726776", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" + }, + "conflict": { + "symfony/console": "<3.4" }, "require-dev": { - "symfony/console": "~2.8|~3.0" + "symfony/console": "~3.4|~4.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -5144,7 +5221,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -5171,7 +5248,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-10-05T14:43:42+00:00" + "time": "2017-11-29T13:42:03+00:00" }, { "name": "theseer/tokenizer", diff --git a/config/auth.php b/config/auth.php index e324d1a6f8..73352da7a0 100644 --- a/config/auth.php +++ b/config/auth.php @@ -36,7 +36,7 @@ return [ */ 'defaults' => [ - 'guard' => 'web', + 'guard' => 'web', 'passwords' => 'users', ], @@ -59,12 +59,12 @@ return [ 'guards' => [ 'web' => [ - 'driver' => 'session', + 'driver' => 'session', 'provider' => 'users', ], 'api' => [ - 'driver' => 'token', + 'driver' => 'token', 'provider' => 'users', ], ], @@ -89,7 +89,7 @@ return [ 'providers' => [ 'users' => [ 'driver' => 'eloquent', - 'model' => FireflyIII\User::class, + 'model' => FireflyIII\User::class, ], // 'users' => [ @@ -116,8 +116,8 @@ return [ 'passwords' => [ 'users' => [ 'provider' => 'users', - 'table' => 'password_resets', - 'expire' => 60, + 'table' => 'password_resets', + 'expire' => 60, ], ], diff --git a/config/broadcasting.php b/config/broadcasting.php index 962c603b70..00c45c8caf 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -53,17 +53,17 @@ return [ 'connections' => [ 'pusher' => [ - 'driver' => 'pusher', - 'key' => env('PUSHER_APP_KEY'), - 'secret' => env('PUSHER_APP_SECRET'), - 'app_id' => env('PUSHER_APP_ID'), + 'driver' => 'pusher', + 'key' => env('PUSHER_APP_KEY'), + 'secret' => env('PUSHER_APP_SECRET'), + 'app_id' => env('PUSHER_APP_ID'), 'options' => [ // ], ], 'redis' => [ - 'driver' => 'redis', + 'driver' => 'redis', 'connection' => 'default', ], diff --git a/config/cache.php b/config/cache.php index 812128ea27..c3360fdae1 100644 --- a/config/cache.php +++ b/config/cache.php @@ -61,37 +61,37 @@ return [ ], 'database' => [ - 'driver' => 'database', - 'table' => 'cache', + 'driver' => 'database', + 'table' => 'cache', 'connection' => null, ], 'file' => [ 'driver' => 'file', - 'path' => storage_path('framework/cache/data'), + 'path' => storage_path('framework/cache/data'), ], 'memcached' => [ - 'driver' => 'memcached', + 'driver' => 'memcached', 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), - 'sasl' => [ + 'sasl' => [ env('MEMCACHED_USERNAME'), env('MEMCACHED_PASSWORD'), ], - 'options' => [ + 'options' => [ // Memcached::OPT_CONNECT_TIMEOUT => 2000, ], - 'servers' => [ + 'servers' => [ [ - 'host' => env('MEMCACHED_HOST', '127.0.0.1'), - 'port' => env('MEMCACHED_PORT', 11211), + 'host' => env('MEMCACHED_HOST', '127.0.0.1'), + 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100, ], ], ], 'redis' => [ - 'driver' => 'redis', + 'driver' => 'redis', 'connection' => 'default', ], diff --git a/config/csv.php b/config/csv.php index edba7b4714..a10ea901ba 100644 --- a/config/csv.php +++ b/config/csv.php @@ -280,6 +280,18 @@ return [ 'converter' => 'Amount', 'field' => 'amount', ], + 'amount_debet' => [ + 'mappable' => false, + 'pre-process-map' => false, + 'converter' => 'AmountDebet', + 'field' => 'amount_debet', + ], + 'amount_credit' => [ + 'mappable' => false, + 'pre-process-map' => false, + 'converter' => 'AmountCredit', + 'field' => 'amount_credit', + ], 'sepa-ct-id' => [ 'mappable' => false, 'pre-process-map' => false, diff --git a/config/database.php b/config/database.php index f23918048e..352c2e6f7f 100644 --- a/config/database.php +++ b/config/database.php @@ -22,6 +22,20 @@ declare(strict_types=1); +$databaseUrl = getenv('DATABASE_URL'); +$host = ''; +$username = ''; +$password = ''; +$database = ''; + +if (!($databaseUrl === false)) { + $options = parse_url($databaseUrl); + $host = $options['host']; + $username = $options['user']; + $password = $options['pass']; + $database = substr($options['path'], 1); +} + return [ 'default' => env('DB_CONNECTION', 'mysql'), @@ -47,11 +61,11 @@ return [ ], 'pgsql' => [ 'driver' => 'pgsql', - 'host' => env('DB_HOST', '127.0.0.1'), + 'host' => env('DB_HOST', $host), 'port' => env('DB_PORT', '5432'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), + 'database' => env('DB_DATABASE', $database), + 'username' => env('DB_USERNAME', $username), + 'password' => env('DB_PASSWORD', $password), 'charset' => 'utf8', 'prefix' => '', 'schema' => 'public', diff --git a/config/firefly.php b/config/firefly.php index 8ca8c90385..3643b2c39e 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -33,9 +33,9 @@ return [ 'is_demo_site' => false, ], 'encryption' => (is_null(env('USE_ENCRYPTION')) || env('USE_ENCRYPTION') === true), - 'version' => '4.6.10', + 'version' => '4.6.11', 'maxUploadSize' => 15242880, - 'allowedMimes' => ['image/png', 'image/jpeg', 'application/pdf'], + 'allowedMimes' => ['image/png', 'image/jpeg', 'application/pdf','text/plain'], 'list_length' => 10, 'export_formats' => [ 'csv' => 'FireflyIII\Export\Exporter\CsvExporter', @@ -107,12 +107,13 @@ return [ ], 'accountTypeByIdentifier' => [ - 'asset' => 'Asset account', - 'expense' => 'Expense account', - 'revenue' => 'Revenue account', - 'opening' => 'Initial balance account', - 'initial' => 'Initial balance account', - 'import' => 'Import account', + 'asset' => 'Asset account', + 'expense' => 'Expense account', + 'revenue' => 'Revenue account', + 'opening' => 'Initial balance account', + 'initial' => 'Initial balance account', + 'import' => 'Import account', + 'reconcile' => 'Reconciliation account', ], 'shortNamesByFullName' => [ @@ -125,16 +126,20 @@ return [ 'Cash account' => 'cash', ], 'languages' => [ + // completed languages + 'nl_NL' => ['name_locale' => 'Nederlands', 'name_english' => 'Dutch', 'complete' => true], 'de_DE' => ['name_locale' => 'Deutsch', 'name_english' => 'German', 'complete' => true], - 'es_ES' => ['name_locale' => 'Spanish', 'name_english' => 'Spanish', 'complete' => false], 'en_US' => ['name_locale' => 'English', 'name_english' => 'English', 'complete' => true], 'fr_FR' => ['name_locale' => 'Français', 'name_english' => 'French', 'complete' => true], - 'id_ID' => ['name_locale' => 'Indonesian', 'name_english' => 'Indonesian', 'complete' => false], - 'nl_NL' => ['name_locale' => 'Nederlands', 'name_english' => 'Dutch', 'complete' => true], 'pl_PL' => ['name_locale' => 'Polski', 'name_english' => 'Polish ', 'complete' => true], - 'pt_BR' => ['name_locale' => 'Português do Brasil', 'name_english' => 'Portuguese (Brazil)', 'complete' => true], + + // incomplete languages: + 'pt_BR' => ['name_locale' => 'Português do Brasil', 'name_english' => 'Portuguese (Brazil)', 'complete' => false], + 'id_ID' => ['name_locale' => 'Indonesian', 'name_english' => 'Indonesian', 'complete' => false], + 'es_ES' => ['name_locale' => 'Spanish', 'name_english' => 'Spanish', 'complete' => false], 'ru_RU' => ['name_locale' => 'Русский', 'name_english' => 'Russian', 'complete' => false], 'sl_SI' => ['name_locale' => 'Slovenščina', 'name_english' => 'Slovenian', 'complete' => false], + 'tr_TR' => ['name_locale' => 'Türkçe', 'name_english' => 'Turkish', 'complete' => false], ], 'transactionTypesByWhat' => [ 'expenses' => ['Withdrawal'], diff --git a/config/queue.php b/config/queue.php index 7c4b8840a2..171e9babc5 100644 --- a/config/queue.php +++ b/config/queue.php @@ -57,32 +57,32 @@ return [ ], 'database' => [ - 'driver' => 'database', - 'table' => 'jobs', - 'queue' => 'default', + 'driver' => 'database', + 'table' => 'jobs', + 'queue' => 'default', 'retry_after' => 90, ], 'beanstalkd' => [ - 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', + 'driver' => 'beanstalkd', + 'host' => 'localhost', + 'queue' => 'default', 'retry_after' => 90, ], 'sqs' => [ 'driver' => 'sqs', - 'key' => 'your-public-key', + 'key' => 'your-public-key', 'secret' => 'your-secret-key', 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id', - 'queue' => 'your-queue-name', + 'queue' => 'your-queue-name', 'region' => 'us-east-1', ], 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - 'queue' => 'default', + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => 'default', 'retry_after' => 90, ], @@ -101,7 +101,7 @@ return [ 'failed' => [ 'database' => env('DB_CONNECTION', 'mysql'), - 'table' => 'failed_jobs', + 'table' => 'failed_jobs', ], ]; diff --git a/config/services.php b/config/services.php index 0e0dd3b120..8b9e73ff36 100644 --- a/config/services.php +++ b/config/services.php @@ -42,7 +42,7 @@ return [ ], 'ses' => [ - 'key' => env('SES_KEY'), + 'key' => env('SES_KEY'), 'secret' => env('SES_SECRET'), 'region' => 'us-east-1', ], @@ -52,8 +52,8 @@ return [ ], 'stripe' => [ - 'model' => FireflyIII\User::class, - 'key' => env('STRIPE_KEY'), + 'model' => FireflyIII\User::class, + 'key' => env('STRIPE_KEY'), 'secret' => env('STRIPE_SECRET'), ], diff --git a/config/twigbridge.php b/config/twigbridge.php index 601364ccfe..df96c93a2d 100644 --- a/config/twigbridge.php +++ b/config/twigbridge.php @@ -176,7 +176,7 @@ return [ 'is_safe' => [ 'date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer', 'textarea', 'location', 'multiRadio', 'file', 'multiCheckbox', 'staticText', 'amountSmall', 'password', 'nonSelectableBalance', 'nonSelectableAmount', - 'number' + 'number', ], ], 'Form' => [ diff --git a/config/upgrade.php b/config/upgrade.php index 9d162714ac..d0f6e5b716 100644 --- a/config/upgrade.php +++ b/config/upgrade.php @@ -27,13 +27,13 @@ return [ [ '4.3' => 'Make sure you run the migrations and clear your cache. If you need more help, please check Github or the Firefly III website.', '4.6.3' => 'This will be the last version to require PHP7.0. Future versions will require PHP7.1 minimum.', - '4.6.4' => 'This version of Firefly III requires PHP7.1.' + '4.6.4' => 'This version of Firefly III requires PHP7.1.', ], 'install' => [ '4.3' => 'Welcome to Firefly! Make sure you follow the installation guide. If you need more help, please check Github or the Firefly III website. The installation guide has a FAQ which you should check out as well.', '4.6.3' => 'This will be the last version to require PHP7.0. Future versions will require PHP7.1 minimum.', - '4.6.4' => 'This version of Firefly III requires PHP7.1.' + '4.6.4' => 'This version of Firefly III requires PHP7.1.', ], ], ]; diff --git a/crowdin.yaml b/crowdin.yaml deleted file mode 100644 index 2ebe1dbabf..0000000000 --- a/crowdin.yaml +++ /dev/null @@ -1,4 +0,0 @@ -files: - - - source: /resources/lang/en_US/*.php - translation: /resources/lang/%locale_with_underscore%/%original_file_name% diff --git a/crowdin.yml b/crowdin.yml new file mode 100644 index 0000000000..c4313cfa93 --- /dev/null +++ b/crowdin.yml @@ -0,0 +1,129 @@ +# +# Your crowdin's credentials +# +"api_key_env": CROWDIN_API_KEY +"project_identifier_env": CROWDIN_PROJECT_ID +"base_path_env": CROWDIN_BASE_PATH +#"base_url" : "" + +# +# Choose file structure in crowdin +# e.g. true or false +# +"preserve_hierarchy": false + +# +# Files configuration +# +files: [ + { + # + # Source files filter + # e.g. "/resources/en/*.json" + # + "source" : "", + source: "/resources/lang/en_US/*.php", + + # + # where translations live + # e.g. "/resources/%two_letters_code%/%original_file_name%" + # + "translation" : "", + translation: /resources/lang/%locale_with_underscore%/%original_file_name%, + + # + # files or directories for ignore + # e.g. ["/**/?.txt", "/**/[0-9].txt", "/**/*\?*.txt"] + # + #"ignore" : [], + + # + # The dest allows you to specify a file name on Crowdin + # e.g. "/messages.json" + # + #"dest" : "", + + # + # File type + # e.g. "json" + # + #type:"json" + + # + # The parameter "update_option" is optional. If it is not set, translations for changed strings will be lost. Useful for typo fixes and minor changes in source strings. + # e.g. "update_as_unapproved" or "update_without_changes" + # + #"update_option" : "", + + # + # Start block only for XML + # + + # + # Defines whether to translate tags attributes. + # e.g. 0 or 1 (Default is 1) + # + # "translate_attributes" : 1, + + # + # Defines whether to translate texts placed inside the tags. + # e.g. 0 or 1 (Default is 1) + # + # "translate_content" : 1, + + # + # This is an array of strings, where each item is the XPaths to DOM element that should be imported + # e.g. ["/content/text", "/content/text[@value]"] + # + # "translatable_elements" : [], + + # + # Defines whether to split long texts into smaller text segments. + # e.g. 0 or 1 (Default is 1) + # + # "content_segmentation" : 1, + + # + # End block only for XML + # + + # + # Start .properties block + # + + # + # Defines whether single quote should be escaped by another single quote or backslash in exported translations. + # e.g. 0 or 1 or 2 or 3 (Default is 3) + # 0 - do not escape single quote; + # 1 - escape single quote by another single quote; + # 2 - escape single quote by backslash; + # 3 - escape single quote by another single quote only in strings containing variables ( {0} ). + # + # "escape_quotes" : 3, + + # + # End .properties block + # + + # + # Often software projects have custom names for locale directories. crowdin-cli allows you to map your own languages to be understandable by Crowdin. + # + #"languages_mapping" : { + # "two_letters_code" : { + # "crowdin_language_code" : "local_name" + # } + #}, + + # + # Is first line contains header? + # e.g. true or false + # + #"first_line_contains_header" : true, + + # + # for spreadsheets + # e.g. "identifier,source_phrase,context,uk,ru,fr" + # + # "scheme" : "", + } +] \ No newline at end of file diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index 8669ccf1b3..85bedc97cf 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -12,7 +12,6 @@ declare(strict_types=1); use Carbon\Carbon; - /* |-------------------------------------------------------------------------- | Model Factories @@ -25,224 +24,235 @@ use Carbon\Carbon; */ $factory->define( - FireflyIII\User::class, function (Faker\Generator $faker) { - static $password; + FireflyIII\User::class, + function (Faker\Generator $faker) { + static $password; - return [ - 'email' => $faker->safeEmail, - 'password' => $password ?: $password = bcrypt('secret'), - 'remember_token' => str_random(10), - ]; -} + return [ + 'email' => $faker->safeEmail, + 'password' => $password ?: $password = bcrypt('secret'), + 'remember_token' => str_random(10), + ]; + } ); $factory->define( - FireflyIII\Models\CurrencyExchangeRate::class, function (Faker\Generator $faker) { - - return [ - 'user_id' => 1, - 'from_currency_id' => 1, - 'to_currency_id' => 2, - 'date' => '2017-01-01', - 'rate' => '1.5', - 'user_rate' => null, - ]; -} + FireflyIII\Models\CurrencyExchangeRate::class, + function (Faker\Generator $faker) { + return [ + 'user_id' => 1, + 'from_currency_id' => 1, + 'to_currency_id' => 2, + 'date' => '2017-01-01', + 'rate' => '1.5', + 'user_rate' => null, + ]; + } ); $factory->define( - FireflyIII\Models\TransactionCurrency::class, function (Faker\Generator $faker) { - - return [ - 'name' => $faker->words(1, true), - 'code' => 'ABC', - 'symbol' => 'x', - ]; -} + FireflyIII\Models\TransactionCurrency::class, + function (Faker\Generator $faker) { + return [ + 'name' => $faker->words(1, true), + 'code' => 'ABC', + 'symbol' => 'x', + ]; + } ); $factory->define( - FireflyIII\Models\ImportJob::class, function (Faker\Generator $faker) { - return [ - 'id' => $faker->numberBetween(1, 100), - 'user_id' => 1, - 'key' => $faker->words(1, true), - 'file_type' => 'csv', - 'status' => 'import_status_never_started', - 'configuration' => null, - 'extended_status' => [ - 'total_steps' => 0, - 'steps_done' => 0, - 'import_count' => 0, - 'importTag' => 0, - 'errors' => [], - ], - ]; -} -); - - -$factory->define( - FireflyIII\Models\TransactionJournal::class, function (Faker\Generator $faker) { - return [ - 'id' => $faker->unique()->numberBetween(1000, 10000), - 'user_id' => 1, - 'transaction_type_id' => 1, - 'bill_id' => null, - // TODO update this transaction currency reference. - 'transaction_currency_id' => 1, - 'description' => $faker->words(3, true), - 'date' => '2017-01-01', - 'interest_date' => null, - 'book_date' => null, - 'process_date' => null, - 'order' => 0, - 'tag_count' => 0, - 'encrypted' => 0, - 'completed' => 1, - ]; -} + FireflyIII\Models\ImportJob::class, + function (Faker\Generator $faker) { + return [ + 'id' => $faker->numberBetween(1, 100), + 'user_id' => 1, + 'key' => $faker->words(1, true), + 'file_type' => 'csv', + 'status' => 'import_status_never_started', + 'configuration' => null, + 'extended_status' => [ + 'total_steps' => 0, + 'steps_done' => 0, + 'import_count' => 0, + 'importTag' => 0, + 'errors' => [], + ], + ]; + } ); $factory->define( - FireflyIII\Models\Bill::class, function (Faker\Generator $faker) { - return [ - 'id' => $faker->numberBetween(1, 10), - 'user_id' => 1, - 'name' => $faker->words(3, true), - 'match' => $faker->words(3, true), - 'amount_min' => '100.00', - 'amount_max' => '100.00', - 'date' => '2017-01-01', - 'repeat_freq' => 'monthly', - 'skip' => 0, - 'automatch' => 1, - 'name_encrypted' => 0, - 'match_encrypted' => 0, - ]; -} + FireflyIII\Models\TransactionJournal::class, + function (Faker\Generator $faker) { + return [ + 'id' => $faker->unique()->numberBetween(1000, 10000), + 'user_id' => 1, + 'transaction_type_id' => 1, + 'bill_id' => null, + // TODO update this transaction currency reference. + 'transaction_currency_id' => 1, + 'description' => $faker->words(3, true), + 'date' => '2017-01-01', + 'interest_date' => null, + 'book_date' => null, + 'process_date' => null, + 'order' => 0, + 'tag_count' => 0, + 'encrypted' => 0, + 'completed' => 1, + ]; + } ); $factory->define( - FireflyIII\Models\PiggyBankRepetition::class, function (Faker\Generator $faker) { - return [ - 'id' => $faker->unique()->numberBetween(100, 10000), - 'piggy_bank_id' => $faker->numberBetween(1, 10), - 'startdate' => '2017-01-01', - 'targetdate' => '2020-01-01', - 'currentamount' => 10, - ]; -} + FireflyIII\Models\Bill::class, + function (Faker\Generator $faker) { + return [ + 'id' => $faker->numberBetween(1, 10), + 'user_id' => 1, + 'name' => $faker->words(3, true), + 'match' => $faker->words(3, true), + 'amount_min' => '100.00', + 'amount_max' => '100.00', + 'date' => '2017-01-01', + 'repeat_freq' => 'monthly', + 'skip' => 0, + 'automatch' => 1, + 'name_encrypted' => 0, + 'match_encrypted' => 0, + ]; + } ); $factory->define( - FireflyIII\Models\PiggyBank::class, function (Faker\Generator $faker) { - return [ - 'id' => $faker->unique()->numberBetween(100, 10000), - 'account_id' => $faker->numberBetween(1, 10), - 'name' => $faker->words(3, true), - 'target_amount' => '1000.00', - 'startdate' => '2017-01-01', - 'order' => 1, - 'active' => 1, - 'encrypted' => 0, - ]; -} + FireflyIII\Models\PiggyBankRepetition::class, + function (Faker\Generator $faker) { + return [ + 'id' => $faker->unique()->numberBetween(100, 10000), + 'piggy_bank_id' => $faker->numberBetween(1, 10), + 'startdate' => '2017-01-01', + 'targetdate' => '2020-01-01', + 'currentamount' => 10, + ]; + } ); $factory->define( - FireflyIII\Models\Tag::class, function (Faker\Generator $faker) { - return [ - 'id' => $faker->unique()->numberBetween(200, 10000), - 'user_id' => 1, - 'tagMode' => 'nothing', - 'tag' => $faker->words(1, true), - ]; -} + FireflyIII\Models\PiggyBank::class, + function (Faker\Generator $faker) { + return [ + 'id' => $faker->unique()->numberBetween(100, 10000), + 'account_id' => $faker->numberBetween(1, 10), + 'name' => $faker->words(3, true), + 'target_amount' => '1000.00', + 'startdate' => '2017-01-01', + 'order' => 1, + 'active' => 1, + 'encrypted' => 0, + ]; + } ); $factory->define( - FireflyIII\Models\Category::class, function (Faker\Generator $faker) { - return [ - 'id' => $faker->numberBetween(1, 10), - 'name' => $faker->words(3, true), - ]; -} + FireflyIII\Models\Tag::class, + function (Faker\Generator $faker) { + return [ + 'id' => $faker->unique()->numberBetween(200, 10000), + 'user_id' => 1, + 'tagMode' => 'nothing', + 'tag' => $faker->words(1, true), + ]; + } ); $factory->define( - FireflyIII\Models\Budget::class, function (Faker\Generator $faker) { - return [ - 'id' => $faker->numberBetween(1, 10), - 'name' => $faker->words(3, true), - ]; -} + FireflyIII\Models\Category::class, + function (Faker\Generator $faker) { + return [ + 'id' => $faker->numberBetween(1, 10), + 'name' => $faker->words(3, true), + ]; + } ); $factory->define( - FireflyIII\Models\PiggyBankEvent::class, function (Faker\Generator $faker) { - return [ - 'id' => $faker->numberBetween(1, 10), - 'piggy_bank_id' => $faker->numberBetween(1, 10), - 'transaction_journal_id' => $faker->numberBetween(1, 10), - 'date' => $faker->date('Y-m-d'), - 'amount' => '100', - ]; -} + FireflyIII\Models\Budget::class, + function (Faker\Generator $faker) { + return [ + 'id' => $faker->numberBetween(1, 10), + 'name' => $faker->words(3, true), + ]; + } ); $factory->define( - FireflyIII\Models\BudgetLimit::class, function (Faker\Generator $faker) { - return [ - 'id' => $faker->numberBetween(1, 10), - 'start_date' => '2017-01-01', - 'end_date' => '2017-01-31', - 'amount' => '300', - 'budget_id' => $faker->numberBetween(1, 6), - - ]; -} + FireflyIII\Models\PiggyBankEvent::class, + function (Faker\Generator $faker) { + return [ + 'id' => $faker->numberBetween(1, 10), + 'piggy_bank_id' => $faker->numberBetween(1, 10), + 'transaction_journal_id' => $faker->numberBetween(1, 10), + 'date' => $faker->date('Y-m-d'), + 'amount' => '100', + ]; + } ); $factory->define( - FireflyIII\Models\Account::class, function (Faker\Generator $faker) { - return [ - 'id' => $faker->unique()->numberBetween(1000, 10000), - 'name' => $faker->words(3, true), - 'account_type_id' => 1, - 'active' => true, - ]; -} + FireflyIII\Models\BudgetLimit::class, + function (Faker\Generator $faker) { + return [ + 'id' => $faker->numberBetween(1, 10), + 'start_date' => '2017-01-01', + 'end_date' => '2017-01-31', + 'amount' => '300', + 'budget_id' => $faker->numberBetween(1, 6), + ]; + } ); $factory->define( - FireflyIII\Models\Transaction::class, function (Faker\Generator $faker) { - return [ - 'transaction_amount' => strval($faker->randomFloat(2, -100, 100)), - 'destination_amount' => strval($faker->randomFloat(2, -100, 100)), - 'opposing_account_id' => $faker->numberBetween(1, 10), - 'source_account_id' => $faker->numberBetween(1, 10), - 'opposing_account_name' => $faker->words(3, true), - 'description' => $faker->words(3, true), - 'source_account_name' => $faker->words(3, true), - 'destination_account_id' => $faker->numberBetween(1, 10), - 'date' => new Carbon, - 'destination_account_name' => $faker->words(3, true), - 'amount' => strval($faker->randomFloat(2, -100, 100)), - 'budget_id' => 0, - 'category' => $faker->words(3, true), - 'transaction_journal_id' => $faker->numberBetween(1, 10), - 'journal_id' => $faker->numberBetween(1, 10), - 'transaction_currency_code' => 'EUR', - 'transaction_type_type' => 'Withdrawal', - 'account_encrypted' => 0, - 'account_name' => 'Some name', - 'transaction_currency_id' => 1, - 'transaction_currency_symbol' => '€', - 'foreign_destination_amount' => null, - 'foreign_currency_id' => null, - 'foreign_currency_code' => null, - 'foreign_currency_symbol' => null, - ]; -} + FireflyIII\Models\Account::class, + function (Faker\Generator $faker) { + return [ + 'id' => $faker->unique()->numberBetween(1000, 10000), + 'name' => $faker->words(3, true), + 'account_type_id' => 1, + 'active' => true, + ]; + } +); + +$factory->define( + FireflyIII\Models\Transaction::class, + function (Faker\Generator $faker) { + return [ + 'transaction_amount' => strval($faker->randomFloat(2, -100, 100)), + 'destination_amount' => strval($faker->randomFloat(2, -100, 100)), + 'opposing_account_id' => $faker->numberBetween(1, 10), + 'source_account_id' => $faker->numberBetween(1, 10), + 'opposing_account_name' => $faker->words(3, true), + 'description' => $faker->words(3, true), + 'source_account_name' => $faker->words(3, true), + 'destination_account_id' => $faker->numberBetween(1, 10), + 'date' => new Carbon, + 'destination_account_name' => $faker->words(3, true), + 'amount' => strval($faker->randomFloat(2, -100, 100)), + 'budget_id' => 0, + 'category' => $faker->words(3, true), + 'transaction_journal_id' => $faker->numberBetween(1, 10), + 'journal_id' => $faker->numberBetween(1, 10), + 'transaction_currency_code' => 'EUR', + 'transaction_type_type' => 'Withdrawal', + 'account_encrypted' => 0, + 'account_name' => 'Some name', + 'transaction_currency_id' => 1, + 'transaction_currency_symbol' => '€', + 'foreign_destination_amount' => null, + 'foreign_currency_id' => null, + 'foreign_currency_code' => null, + 'foreign_currency_symbol' => null, + ]; + } ); diff --git a/database/migrations/2016_06_16_000000_create_support_tables.php b/database/migrations/2016_06_16_000000_create_support_tables.php index cd16910972..b47de14d0b 100644 --- a/database/migrations/2016_06_16_000000_create_support_tables.php +++ b/database/migrations/2016_06_16_000000_create_support_tables.php @@ -20,11 +20,9 @@ class CreateSupportTables extends Migration { /** * Reverse the migrations. - * */ public function down() { - Schema::drop('account_types'); Schema::drop('transaction_currencies'); Schema::drop('transaction_types'); @@ -35,7 +33,6 @@ class CreateSupportTables extends Migration Schema::drop('roles'); Schema::drop('sessions'); Schema::drop('configuration'); - } /** @@ -64,14 +61,15 @@ class CreateSupportTables extends Migration { if (!Schema::hasTable('account_types')) { Schema::create( - 'account_types', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->string('type', 50); + 'account_types', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->string('type', 50); - // type must be unique. - $table->unique(['type']); - } + // type must be unique. + $table->unique(['type']); + } ); } } @@ -80,15 +78,15 @@ class CreateSupportTables extends Migration { if (!Schema::hasTable('configuration')) { Schema::create( - 'configuration', function (Blueprint $table) { - - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->string('name', 50); - $table->text('data'); - $table->unique(['name']); - } + 'configuration', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->string('name', 50); + $table->text('data'); + $table->unique(['name']); + } ); } } @@ -100,18 +98,18 @@ class CreateSupportTables extends Migration { if (!Schema::hasTable('transaction_currencies')) { Schema::create( - 'transaction_currencies', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->string('code', 3); - $table->string('name', 255); - $table->string('symbol', 12); + 'transaction_currencies', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->string('code', 3); + $table->string('name', 255); + $table->string('symbol', 12); - // code must be unique. - $table->unique(['code']); - - } + // code must be unique. + $table->unique(['code']); + } ); } } @@ -123,20 +121,19 @@ class CreateSupportTables extends Migration { if (!Schema::hasTable('jobs')) { Schema::create( - 'jobs', function (Blueprint $table) { - - // straight from Laravel - $table->bigIncrements('id'); - $table->string('queue'); - $table->longText('payload'); - $table->tinyInteger('attempts')->unsigned(); - $table->tinyInteger('reserved')->unsigned(); - $table->unsignedInteger('reserved_at')->nullable(); - $table->unsignedInteger('available_at'); - $table->unsignedInteger('created_at'); - $table->index(['queue', 'reserved', 'reserved_at']); - - } + 'jobs', + function (Blueprint $table) { + // straight from Laravel + $table->bigIncrements('id'); + $table->string('queue'); + $table->longText('payload'); + $table->tinyInteger('attempts')->unsigned(); + $table->tinyInteger('reserved')->unsigned(); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + $table->index(['queue', 'reserved', 'reserved_at']); + } ); } } @@ -148,13 +145,13 @@ class CreateSupportTables extends Migration { if (!Schema::hasTable('password_resets')) { Schema::create( - 'password_resets', function (Blueprint $table) { - // straight from laravel - $table->string('email')->index(); - $table->string('token')->index(); - $table->timestamp('created_at'); - - } + 'password_resets', + function (Blueprint $table) { + // straight from laravel + $table->string('email')->index(); + $table->string('token')->index(); + $table->timestamp('created_at'); + } ); } } @@ -166,15 +163,16 @@ class CreateSupportTables extends Migration { if (!Schema::hasTable('permission_role')) { Schema::create( - 'permission_role', function (Blueprint $table) { - $table->integer('permission_id')->unsigned(); - $table->integer('role_id')->unsigned(); + 'permission_role', + function (Blueprint $table) { + $table->integer('permission_id')->unsigned(); + $table->integer('role_id')->unsigned(); - $table->foreign('permission_id')->references('id')->on('permissions')->onUpdate('cascade')->onDelete('cascade'); - $table->foreign('role_id')->references('id')->on('roles')->onUpdate('cascade')->onDelete('cascade'); + $table->foreign('permission_id')->references('id')->on('permissions')->onUpdate('cascade')->onDelete('cascade'); + $table->foreign('role_id')->references('id')->on('roles')->onUpdate('cascade')->onDelete('cascade'); - $table->primary(['permission_id', 'role_id']); - } + $table->primary(['permission_id', 'role_id']); + } ); } } @@ -186,13 +184,14 @@ class CreateSupportTables extends Migration { if (!Schema::hasTable('permissions')) { Schema::create( - 'permissions', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->string('name')->unique(); - $table->string('display_name')->nullable(); - $table->string('description')->nullable(); - } + 'permissions', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->string('name')->unique(); + $table->string('display_name')->nullable(); + $table->string('description')->nullable(); + } ); } } @@ -204,13 +203,14 @@ class CreateSupportTables extends Migration { if (!Schema::hasTable('roles')) { Schema::create( - 'roles', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->string('name')->unique(); - $table->string('display_name')->nullable(); - $table->string('description')->nullable(); - } + 'roles', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->string('name')->unique(); + $table->string('display_name')->nullable(); + $table->string('description')->nullable(); + } ); } } @@ -220,17 +220,17 @@ class CreateSupportTables extends Migration */ private function createSessionsTable() { - if (!Schema::hasTable('sessions')) { Schema::create( - 'sessions', function (Blueprint $table) { - $table->string('id')->unique(); - $table->integer('user_id')->nullable(); - $table->string('ip_address', 45)->nullable(); - $table->text('user_agent')->nullable(); - $table->text('payload'); - $table->integer('last_activity'); - } + 'sessions', + function (Blueprint $table) { + $table->string('id')->unique(); + $table->integer('user_id')->nullable(); + $table->string('ip_address', 45)->nullable(); + $table->text('user_agent')->nullable(); + $table->text('payload'); + $table->integer('last_activity'); + } ); } } @@ -242,16 +242,16 @@ class CreateSupportTables extends Migration { if (!Schema::hasTable('transaction_types')) { Schema::create( - 'transaction_types', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->string('type', 50); + 'transaction_types', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->string('type', 50); - // type must be unique. - $table->unique(['type']); - - } + // type must be unique. + $table->unique(['type']); + } ); } } diff --git a/database/migrations/2016_06_16_000001_create_users_table.php b/database/migrations/2016_06_16_000001_create_users_table.php index 563fbd1584..52573e8b1f 100644 --- a/database/migrations/2016_06_16_000001_create_users_table.php +++ b/database/migrations/2016_06_16_000001_create_users_table.php @@ -35,16 +35,17 @@ class CreateUsersTable extends Migration { if (!Schema::hasTable('users')) { Schema::create( - 'users', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->string('email', 255); - $table->string('password', 60); - $table->string('remember_token', 100)->nullable(); - $table->string('reset', 32)->nullable(); - $table->tinyInteger('blocked', false, true)->default('0'); - $table->string('blocked_code', 25)->nullable(); - } + 'users', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->string('email', 255); + $table->string('password', 60); + $table->string('remember_token', 100)->nullable(); + $table->string('reset', 32)->nullable(); + $table->tinyInteger('blocked', false, true)->default('0'); + $table->string('blocked_code', 25)->nullable(); + } ); } } diff --git a/database/migrations/2016_06_16_000002_create_main_tables.php b/database/migrations/2016_06_16_000002_create_main_tables.php index 300024918a..edc7eb3b36 100644 --- a/database/migrations/2016_06_16_000002_create_main_tables.php +++ b/database/migrations/2016_06_16_000002_create_main_tables.php @@ -60,7 +60,6 @@ class CreateMainTables extends Migration */ public function up() { - // $this->createAccountTables(); $this->createPiggyBanksTable(); $this->createAttachmentsTable(); @@ -82,33 +81,35 @@ class CreateMainTables extends Migration { if (!Schema::hasTable('accounts')) { Schema::create( - 'accounts', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('user_id', false, true); - $table->integer('account_type_id', false, true); - $table->string('name', 1024); - $table->decimal('virtual_balance', 22, 12)->nullable(); - $table->string('iban', 255)->nullable(); - $table->boolean('active')->default(1); - $table->boolean('encrypted')->default(0); - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - $table->foreign('account_type_id')->references('id')->on('account_types')->onDelete('cascade'); - } + 'accounts', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->integer('user_id', false, true); + $table->integer('account_type_id', false, true); + $table->string('name', 1024); + $table->decimal('virtual_balance', 22, 12)->nullable(); + $table->string('iban', 255)->nullable(); + $table->boolean('active')->default(1); + $table->boolean('encrypted')->default(0); + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + $table->foreign('account_type_id')->references('id')->on('account_types')->onDelete('cascade'); + } ); } if (!Schema::hasTable('account_meta')) { Schema::create( - 'account_meta', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->integer('account_id', false, true); - $table->string('name'); - $table->text('data'); - $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); - } + 'account_meta', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->integer('account_id', false, true); + $table->string('name'); + $table->text('data'); + $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); + } ); } } @@ -118,30 +119,28 @@ class CreateMainTables extends Migration */ private function createAttachmentsTable() { - if (!Schema::hasTable('attachments')) { Schema::create( - 'attachments', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('user_id', false, true); - $table->integer('attachable_id', false, true); - $table->string('attachable_type', 255); - $table->string('md5', 32); - $table->string('filename', 1024); - $table->string('title', 1024)->nullable(); - $table->text('description')->nullable(); - $table->text('notes')->nullable(); - $table->string('mime', 1024); - $table->integer('size', false, true); - $table->boolean('uploaded')->default(1); + 'attachments', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->integer('user_id', false, true); + $table->integer('attachable_id', false, true); + $table->string('attachable_type', 255); + $table->string('md5', 32); + $table->string('filename', 1024); + $table->string('title', 1024)->nullable(); + $table->text('description')->nullable(); + $table->text('notes')->nullable(); + $table->string('mime', 1024); + $table->integer('size', false, true); + $table->boolean('uploaded')->default(1); - // link user id to users table - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - - - } + // link user id to users table + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + } ); } } @@ -153,26 +152,27 @@ class CreateMainTables extends Migration { if (!Schema::hasTable('bills')) { Schema::create( - 'bills', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('user_id', false, true); - $table->string('name', 1024); - $table->string('match', 1024); - $table->decimal('amount_min', 22, 12); - $table->decimal('amount_max', 22, 12); - $table->date('date'); - $table->string('repeat_freq', 30); - $table->smallInteger('skip', false, true)->default(0); - $table->boolean('automatch')->default(1); - $table->boolean('active')->default(1); - $table->boolean('name_encrypted')->default(0); - $table->boolean('match_encrypted')->default(0); + 'bills', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->integer('user_id', false, true); + $table->string('name', 1024); + $table->string('match', 1024); + $table->decimal('amount_min', 22, 12); + $table->decimal('amount_max', 22, 12); + $table->date('date'); + $table->string('repeat_freq', 30); + $table->smallInteger('skip', false, true)->default(0); + $table->boolean('automatch')->default(1); + $table->boolean('active')->default(1); + $table->boolean('name_encrypted')->default(0); + $table->boolean('match_encrypted')->default(0); - // link user id to users table - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - } + // link user id to users table + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + } ); } } @@ -184,46 +184,46 @@ class CreateMainTables extends Migration { if (!Schema::hasTable('budgets')) { Schema::create( - 'budgets', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('user_id', false, true); - $table->string('name', 1024); - $table->boolean('active')->default(1); - $table->boolean('encrypted')->default(0); - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - - - } + 'budgets', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->integer('user_id', false, true); + $table->string('name', 1024); + $table->boolean('active')->default(1); + $table->boolean('encrypted')->default(0); + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + } ); } if (!Schema::hasTable('budget_limits')) { Schema::create( - 'budget_limits', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->integer('budget_id', false, true); - $table->date('startdate'); - $table->decimal('amount', 22, 12); - $table->string('repeat_freq', 30); - $table->boolean('repeats')->default(0); - $table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade'); - - } + 'budget_limits', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->integer('budget_id', false, true); + $table->date('startdate'); + $table->decimal('amount', 22, 12); + $table->string('repeat_freq', 30); + $table->boolean('repeats')->default(0); + $table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade'); + } ); } if (!Schema::hasTable('limit_repetitions')) { Schema::create( - 'limit_repetitions', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->integer('budget_limit_id', false, true); - $table->date('startdate'); - $table->date('enddate'); - $table->decimal('amount', 22, 12); - $table->foreign('budget_limit_id')->references('id')->on('budget_limits')->onDelete('cascade'); - } + 'limit_repetitions', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->integer('budget_limit_id', false, true); + $table->date('startdate'); + $table->date('enddate'); + $table->decimal('amount', 22, 12); + $table->foreign('budget_limit_id')->references('id')->on('budget_limits')->onDelete('cascade'); + } ); } } @@ -235,18 +235,18 @@ class CreateMainTables extends Migration { if (!Schema::hasTable('categories')) { Schema::create( - 'categories', function (Blueprint $table) { + 'categories', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->integer('user_id', false, true); + $table->string('name', 1024); + $table->boolean('encrypted')->default(0); - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('user_id', false, true); - $table->string('name', 1024); - $table->boolean('encrypted')->default(0); - - // link user id to users table - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - } + // link user id to users table + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + } ); } } @@ -258,32 +258,33 @@ class CreateMainTables extends Migration { if (!Schema::hasTable('export_jobs')) { Schema::create( - 'export_jobs', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->integer('user_id', false, true); - $table->string('key', 12); - $table->string('status', 255); - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - } + 'export_jobs', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->integer('user_id', false, true); + $table->string('key', 12); + $table->string('status', 255); + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + } ); } if (!Schema::hasTable('import_jobs')) { Schema::create( - 'import_jobs', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->integer('user_id')->unsigned(); - $table->string('key', 12)->unique(); - $table->string('file_type', 12); - $table->string('status', 45); - $table->text('configuration')->nullable(); - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - } + 'import_jobs', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->integer('user_id')->unsigned(); + $table->string('key', 12)->unique(); + $table->string('file_type', 12); + $table->string('status', 45); + $table->text('configuration')->nullable(); + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + } ); } - } /** @@ -293,34 +294,36 @@ class CreateMainTables extends Migration { if (!Schema::hasTable('piggy_banks')) { Schema::create( - 'piggy_banks', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('account_id', false, true); - $table->string('name', 1024); - $table->decimal('targetamount', 22, 12); - $table->date('startdate')->nullable(); - $table->date('targetdate')->nullable(); - $table->integer('order', false, true)->default(0); - $table->boolean('active')->default(0); - $table->boolean('encrypted')->default(1); - $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); - } + 'piggy_banks', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->integer('account_id', false, true); + $table->string('name', 1024); + $table->decimal('targetamount', 22, 12); + $table->date('startdate')->nullable(); + $table->date('targetdate')->nullable(); + $table->integer('order', false, true)->default(0); + $table->boolean('active')->default(0); + $table->boolean('encrypted')->default(1); + $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); + } ); } if (!Schema::hasTable('piggy_bank_repetitions')) { Schema::create( - 'piggy_bank_repetitions', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->integer('piggy_bank_id', false, true); - $table->date('startdate')->nullable(); - $table->date('targetdate')->nullable(); - $table->decimal('currentamount', 22, 12); - $table->foreign('piggy_bank_id')->references('id')->on('piggy_banks')->onDelete('cascade'); - } + 'piggy_bank_repetitions', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->integer('piggy_bank_id', false, true); + $table->date('startdate')->nullable(); + $table->date('targetdate')->nullable(); + $table->decimal('currentamount', 22, 12); + $table->foreign('piggy_bank_id')->references('id')->on('piggy_banks')->onDelete('cascade'); + } ); } } @@ -332,15 +335,16 @@ class CreateMainTables extends Migration { if (!Schema::hasTable('preferences')) { Schema::create( - 'preferences', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->integer('user_id', false, true); - $table->string('name', 1024); - $table->text('data'); + 'preferences', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->integer('user_id', false, true); + $table->string('name', 1024); + $table->text('data'); - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - } + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + } ); } } @@ -350,22 +354,20 @@ class CreateMainTables extends Migration */ private function createRoleTable() { - if (!Schema::hasTable('role_user')) { Schema::create( - 'role_user', function (Blueprint $table) { - $table->integer('user_id', false, true); - $table->integer('role_id', false, true); + 'role_user', + function (Blueprint $table) { + $table->integer('user_id', false, true); + $table->integer('role_id', false, true); - $table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade')->onDelete('cascade'); - $table->foreign('role_id')->references('id')->on('roles')->onUpdate('cascade')->onDelete('cascade'); + $table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade')->onDelete('cascade'); + $table->foreign('role_id')->references('id')->on('roles')->onUpdate('cascade')->onDelete('cascade'); - $table->primary(['user_id', 'role_id']); - - } + $table->primary(['user_id', 'role_id']); + } ); } - } /** @@ -376,81 +378,83 @@ class CreateMainTables extends Migration { if (!Schema::hasTable('rule_groups')) { Schema::create( - 'rule_groups', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('user_id', false, true); - $table->string('title', 255); - $table->text('description')->nullable(); - $table->integer('order', false, true)->default(0); - $table->boolean('active')->default(1); + 'rule_groups', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->integer('user_id', false, true); + $table->string('title', 255); + $table->text('description')->nullable(); + $table->integer('order', false, true)->default(0); + $table->boolean('active')->default(1); - // link user id to users table - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - } + // link user id to users table + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + } ); } if (!Schema::hasTable('rules')) { Schema::create( - 'rules', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('user_id', false, true); - $table->integer('rule_group_id', false, true); - $table->string('title', 255); - $table->text('description')->nullable(); - $table->integer('order', false, true)->default(0); - $table->boolean('active')->default(1); - $table->boolean('stop_processing')->default(0); + 'rules', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->integer('user_id', false, true); + $table->integer('rule_group_id', false, true); + $table->string('title', 255); + $table->text('description')->nullable(); + $table->integer('order', false, true)->default(0); + $table->boolean('active')->default(1); + $table->boolean('stop_processing')->default(0); - // link user id to users table - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + // link user id to users table + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - // link rule group id to rule group table - $table->foreign('rule_group_id')->references('id')->on('rule_groups')->onDelete('cascade'); - } + // link rule group id to rule group table + $table->foreign('rule_group_id')->references('id')->on('rule_groups')->onDelete('cascade'); + } ); } if (!Schema::hasTable('rule_actions')) { Schema::create( - 'rule_actions', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->integer('rule_id', false, true); + 'rule_actions', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->integer('rule_id', false, true); - $table->string('action_type', 50); - $table->string('action_value', 255); + $table->string('action_type', 50); + $table->string('action_value', 255); - $table->integer('order', false, true)->default(0); - $table->boolean('active')->default(1); - $table->boolean('stop_processing')->default(0); + $table->integer('order', false, true)->default(0); + $table->boolean('active')->default(1); + $table->boolean('stop_processing')->default(0); - - // link rule id to rules table - $table->foreign('rule_id')->references('id')->on('rules')->onDelete('cascade'); - } + // link rule id to rules table + $table->foreign('rule_id')->references('id')->on('rules')->onDelete('cascade'); + } ); } if (!Schema::hasTable('rule_triggers')) { Schema::create( - 'rule_triggers', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->integer('rule_id', false, true); + 'rule_triggers', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->integer('rule_id', false, true); - $table->string('trigger_type', 50); - $table->string('trigger_value', 255); + $table->string('trigger_type', 50); + $table->string('trigger_value', 255); - $table->integer('order', false, true)->default(0); - $table->boolean('active')->default(1); - $table->boolean('stop_processing')->default(0); + $table->integer('order', false, true)->default(0); + $table->boolean('active')->default(1); + $table->boolean('stop_processing')->default(0); - - // link rule id to rules table - $table->foreign('rule_id')->references('id')->on('rules')->onDelete('cascade'); - } + // link rule id to rules table + $table->foreign('rule_id')->references('id')->on('rules')->onDelete('cascade'); + } ); } } @@ -462,24 +466,24 @@ class CreateMainTables extends Migration { if (!Schema::hasTable('tags')) { Schema::create( - 'tags', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('user_id', false, true); + 'tags', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->integer('user_id', false, true); - $table->string('tag', 1024); - $table->string('tagMode', 1024); - $table->date('date')->nullable(); - $table->text('description')->nullable(); - $table->decimal('latitude', 24, 12)->nullable(); - $table->decimal('longitude', 24, 12)->nullable(); - $table->smallInteger('zoomLevel', false, true)->nullable(); + $table->string('tag', 1024); + $table->string('tagMode', 1024); + $table->date('date')->nullable(); + $table->text('description')->nullable(); + $table->decimal('latitude', 24, 12)->nullable(); + $table->decimal('longitude', 24, 12)->nullable(); + $table->smallInteger('zoomLevel', false, true)->nullable(); - // link user id to users table - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - - } + // link user id to users table + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + } ); } } @@ -493,141 +497,149 @@ class CreateMainTables extends Migration { if (!Schema::hasTable('transaction_journals')) { Schema::create( - 'transaction_journals', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('user_id', false, true); - $table->integer('transaction_type_id', false, true); - $table->integer('bill_id', false, true)->nullable(); - $table->integer('transaction_currency_id', false, true); - $table->string('description', 1024); - $table->date('date'); - $table->date('interest_date')->nullable(); - $table->date('book_date')->nullable(); - $table->date('process_date')->nullable(); - $table->integer('order', false, true)->default(0); - $table->integer('tag_count', false, true); - $table->boolean('encrypted')->default(1); - $table->boolean('completed')->default(1); - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - $table->foreign('transaction_type_id')->references('id')->on('transaction_types')->onDelete('cascade'); - $table->foreign('bill_id')->references('id')->on('bills')->onDelete('set null'); - $table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade'); - } + 'transaction_journals', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->integer('user_id', false, true); + $table->integer('transaction_type_id', false, true); + $table->integer('bill_id', false, true)->nullable(); + $table->integer('transaction_currency_id', false, true); + $table->string('description', 1024); + $table->date('date'); + $table->date('interest_date')->nullable(); + $table->date('book_date')->nullable(); + $table->date('process_date')->nullable(); + $table->integer('order', false, true)->default(0); + $table->integer('tag_count', false, true); + $table->boolean('encrypted')->default(1); + $table->boolean('completed')->default(1); + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + $table->foreign('transaction_type_id')->references('id')->on('transaction_types')->onDelete('cascade'); + $table->foreign('bill_id')->references('id')->on('bills')->onDelete('set null'); + $table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade'); + } ); } if (!Schema::hasTable('journal_meta')) { Schema::create( - 'journal_meta', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->integer('transaction_journal_id', false, true); - $table->string('name', 255); - $table->text('data'); - $table->string('hash', 64); - $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade'); - } + 'journal_meta', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->integer('transaction_journal_id', false, true); + $table->string('name', 255); + $table->text('data'); + $table->string('hash', 64); + $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade'); + } ); } if (!Schema::hasTable('tag_transaction_journal')) { Schema::create( - 'tag_transaction_journal', function (Blueprint $table) { - $table->increments('id'); - $table->integer('tag_id', false, true); - $table->integer('transaction_journal_id', false, true); - $table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade'); - $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade'); + 'tag_transaction_journal', + function (Blueprint $table) { + $table->increments('id'); + $table->integer('tag_id', false, true); + $table->integer('transaction_journal_id', false, true); + $table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade'); + $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade'); - - } + // unique combi: + $table->unique(['tag_id', 'transaction_journal_id']); + } ); } if (!Schema::hasTable('budget_transaction_journal')) { Schema::create( - 'budget_transaction_journal', function (Blueprint $table) { - $table->increments('id'); - $table->integer('budget_id', false, true); - $table->integer('transaction_journal_id', false, true); - $table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade'); - $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade'); - } + 'budget_transaction_journal', + function (Blueprint $table) { + $table->increments('id'); + $table->integer('budget_id', false, true); + $table->integer('transaction_journal_id', false, true); + $table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade'); + $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade'); + } ); } if (!Schema::hasTable('category_transaction_journal')) { Schema::create( - 'category_transaction_journal', function (Blueprint $table) { - $table->increments('id'); - $table->integer('category_id', false, true); - $table->integer('transaction_journal_id', false, true); - $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade'); - $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade'); - } + 'category_transaction_journal', + function (Blueprint $table) { + $table->increments('id'); + $table->integer('category_id', false, true); + $table->integer('transaction_journal_id', false, true); + $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade'); + $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade'); + } ); } - if (!Schema::hasTable('piggy_bank_events')) { Schema::create( - 'piggy_bank_events', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->integer('piggy_bank_id', false, true); - $table->integer('transaction_journal_id', false, true)->nullable(); - $table->date('date'); - $table->decimal('amount', 22, 12); + 'piggy_bank_events', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->integer('piggy_bank_id', false, true); + $table->integer('transaction_journal_id', false, true)->nullable(); + $table->date('date'); + $table->decimal('amount', 22, 12); - $table->foreign('piggy_bank_id')->references('id')->on('piggy_banks')->onDelete('cascade'); - $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('set null'); - } + $table->foreign('piggy_bank_id')->references('id')->on('piggy_banks')->onDelete('cascade'); + $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('set null'); + } ); } if (!Schema::hasTable('transactions')) { Schema::create( - 'transactions', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('account_id', false, true); - $table->integer('transaction_journal_id', false, true); - $table->string('description', 1024)->nullable(); - $table->decimal('amount', 22, 12); + 'transactions', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->integer('account_id', false, true); + $table->integer('transaction_journal_id', false, true); + $table->string('description', 1024)->nullable(); + $table->decimal('amount', 22, 12); - $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); - $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade'); - - } + $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); + $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade'); + } ); } if (!Schema::hasTable('budget_transaction')) { Schema::create( - 'budget_transaction', function (Blueprint $table) { - $table->increments('id'); - $table->integer('budget_id', false, true); - $table->integer('transaction_id', false, true); + 'budget_transaction', + function (Blueprint $table) { + $table->increments('id'); + $table->integer('budget_id', false, true); + $table->integer('transaction_id', false, true); - $table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade'); - $table->foreign('transaction_id')->references('id')->on('transactions')->onDelete('cascade'); - } + $table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade'); + $table->foreign('transaction_id')->references('id')->on('transactions')->onDelete('cascade'); + } ); } if (!Schema::hasTable('category_transaction')) { Schema::create( - 'category_transaction', function (Blueprint $table) { - $table->increments('id'); - $table->integer('category_id', false, true); - $table->integer('transaction_id', false, true); + 'category_transaction', + function (Blueprint $table) { + $table->increments('id'); + $table->integer('category_id', false, true); + $table->integer('transaction_id', false, true); - $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade'); - $table->foreign('transaction_id')->references('id')->on('transactions')->onDelete('cascade'); - } + $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade'); + $table->foreign('transaction_id')->references('id')->on('transactions')->onDelete('cascade'); + } ); } } diff --git a/database/migrations/2016_08_25_091522_changes_for_3101.php b/database/migrations/2016_08_25_091522_changes_for_3101.php index b317ef163c..4a9c2a33ec 100644 --- a/database/migrations/2016_08_25_091522_changes_for_3101.php +++ b/database/migrations/2016_08_25_091522_changes_for_3101.php @@ -23,7 +23,6 @@ class ChangesFor3101 extends Migration */ public function down() { - // } /** @@ -34,9 +33,10 @@ class ChangesFor3101 extends Migration public function up() { Schema::table( - 'import_jobs', function (Blueprint $table) { - $table->text('extended_status')->nullable(); - } + 'import_jobs', + function (Blueprint $table) { + $table->text('extended_status')->nullable(); + } ); } } diff --git a/database/migrations/2016_09_12_121359_fix_nullables.php b/database/migrations/2016_09_12_121359_fix_nullables.php index ba037d328b..164e3e5236 100644 --- a/database/migrations/2016_09_12_121359_fix_nullables.php +++ b/database/migrations/2016_09_12_121359_fix_nullables.php @@ -18,13 +18,11 @@ use Illuminate\Database\Schema\Blueprint; */ class FixNullables extends Migration { - /** * Reverse the migrations. */ public function down() { - } /** @@ -35,15 +33,17 @@ class FixNullables extends Migration public function up() { Schema::table( - 'rule_groups', function (Blueprint $table) { - $table->text('description')->nullable()->change(); - } + 'rule_groups', + function (Blueprint $table) { + $table->text('description')->nullable()->change(); + } ); Schema::table( - 'rules', function (Blueprint $table) { - $table->text('description')->nullable()->change(); - } + 'rules', + function (Blueprint $table) { + $table->text('description')->nullable()->change(); + } ); } } diff --git a/database/migrations/2016_10_09_150037_expand_transactions_table.php b/database/migrations/2016_10_09_150037_expand_transactions_table.php index 6909aaa2a5..2e33905fd8 100644 --- a/database/migrations/2016_10_09_150037_expand_transactions_table.php +++ b/database/migrations/2016_10_09_150037_expand_transactions_table.php @@ -8,7 +8,6 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); use Illuminate\Database\Migrations\Migration; @@ -24,7 +23,6 @@ class ExpandTransactionsTable extends Migration */ public function down() { - // } /** @@ -35,9 +33,10 @@ class ExpandTransactionsTable extends Migration public function up() { Schema::table( - 'transactions', function (Blueprint $table) { - $table->smallInteger('identifier', false, true)->default(0); - } + 'transactions', + function (Blueprint $table) { + $table->smallInteger('identifier', false, true)->default(0); + } ); } } diff --git a/database/migrations/2016_10_22_075804_changes_for_v410.php b/database/migrations/2016_10_22_075804_changes_for_v410.php index 0714fb32e5..b3931aeb78 100644 --- a/database/migrations/2016_10_22_075804_changes_for_v410.php +++ b/database/migrations/2016_10_22_075804_changes_for_v410.php @@ -8,13 +8,11 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; - /** * Class ChangesForV410 */ @@ -36,15 +34,16 @@ class ChangesForV410 extends Migration public function up() { Schema::create( - 'notes', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('noteable_id', false, true); - $table->string('noteable_type'); - $table->string('title')->nullable(); - $table->text('text')->nullable(); - } + 'notes', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->integer('noteable_id', false, true); + $table->string('noteable_type'); + $table->string('title')->nullable(); + $table->text('text')->nullable(); + } ); } } diff --git a/database/migrations/2016_11_24_210552_changes_for_v420.php b/database/migrations/2016_11_24_210552_changes_for_v420.php index 1d0a57e940..1ca2c5b652 100644 --- a/database/migrations/2016_11_24_210552_changes_for_v420.php +++ b/database/migrations/2016_11_24_210552_changes_for_v420.php @@ -8,7 +8,6 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); use Illuminate\Database\Migrations\Migration; @@ -24,7 +23,6 @@ class ChangesForV420 extends Migration */ public function down() { - // } /** @@ -35,9 +33,10 @@ class ChangesForV420 extends Migration public function up() { Schema::table( - 'journal_meta', function (Blueprint $table) { - $table->softDeletes(); - } + 'journal_meta', + function (Blueprint $table) { + $table->softDeletes(); + } ); } } diff --git a/database/migrations/2016_12_22_150431_changes_for_v430.php b/database/migrations/2016_12_22_150431_changes_for_v430.php index ef0747e4f4..57be784576 100644 --- a/database/migrations/2016_12_22_150431_changes_for_v430.php +++ b/database/migrations/2016_12_22_150431_changes_for_v430.php @@ -8,10 +8,8 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); - use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; @@ -36,20 +34,20 @@ class ChangesForV430 extends Migration public function up() { Schema::create( - 'available_budgets', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('user_id', false, true); - $table->integer('transaction_currency_id', false, true); - $table->decimal('amount', 22, 12); - $table->date('start_date'); - $table->date('end_date'); + 'available_budgets', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->integer('user_id', false, true); + $table->integer('transaction_currency_id', false, true); + $table->decimal('amount', 22, 12); + $table->date('start_date'); + $table->date('end_date'); - - $table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade'); - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - } + $table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade'); + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + } ); } } diff --git a/database/migrations/2016_12_28_203205_changes_for_v431.php b/database/migrations/2016_12_28_203205_changes_for_v431.php index 1bac0f7924..9beb9fd9f6 100644 --- a/database/migrations/2016_12_28_203205_changes_for_v431.php +++ b/database/migrations/2016_12_28_203205_changes_for_v431.php @@ -8,7 +8,6 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); use Illuminate\Database\Migrations\Migration; @@ -21,31 +20,30 @@ class ChangesForV431 extends Migration { /** * Reverse the migrations. - * - * @return void */ public function down() { // reinstate "repeats" and "repeat_freq". Schema::table( - 'budget_limits', function (Blueprint $table) { - $table->string('repeat_freq', 30)->nullable(); - } + 'budget_limits', + function (Blueprint $table) { + $table->string('repeat_freq', 30)->nullable(); + } ); Schema::table( - 'budget_limits', function (Blueprint $table) { - $table->boolean('repeats')->default(0); - } + 'budget_limits', + function (Blueprint $table) { + $table->boolean('repeats')->default(0); + } ); - // remove date field "end_date" Schema::table( - 'budget_limits', function (Blueprint $table) { - $table->dropColumn('end_date'); - } + 'budget_limits', + function (Blueprint $table) { + $table->dropColumn('end_date'); + } ); - } /** @@ -57,38 +55,40 @@ class ChangesForV431 extends Migration { // add decimal places to "transaction currencies". Schema::table( - 'transaction_currencies', function (Blueprint $table) { - $table->smallInteger('decimal_places', false, true)->default(2); - } + 'transaction_currencies', + function (Blueprint $table) { + $table->smallInteger('decimal_places', false, true)->default(2); + } ); // change field "startdate" to "start_date" Schema::table( - 'budget_limits', function (Blueprint $table) { - $table->renameColumn('startdate', 'start_date'); - } + 'budget_limits', + function (Blueprint $table) { + $table->renameColumn('startdate', 'start_date'); + } ); // add date field "end_date" after "start_date" Schema::table( - 'budget_limits', function (Blueprint $table) { - $table->date('end_date')->nullable()->after('start_date'); - } + 'budget_limits', + function (Blueprint $table) { + $table->date('end_date')->nullable()->after('start_date'); + } ); // drop "repeats" and "repeat_freq". Schema::table( - 'budget_limits', function (Blueprint $table) { - $table->dropColumn('repeats'); - - } + 'budget_limits', + function (Blueprint $table) { + $table->dropColumn('repeats'); + } ); Schema::table( - 'budget_limits', function (Blueprint $table) { - $table->dropColumn('repeat_freq'); - } + 'budget_limits', + function (Blueprint $table) { + $table->dropColumn('repeat_freq'); + } ); - - } } diff --git a/database/migrations/2017_04_13_163623_changes_for_v440.php b/database/migrations/2017_04_13_163623_changes_for_v440.php index 8293836751..be6aa0e697 100644 --- a/database/migrations/2017_04_13_163623_changes_for_v440.php +++ b/database/migrations/2017_04_13_163623_changes_for_v440.php @@ -8,10 +8,8 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); - use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; @@ -22,8 +20,6 @@ class ChangesForV440 extends Migration { /** * Reverse the migrations. - * - * @return void */ public function down() { @@ -36,36 +32,36 @@ class ChangesForV440 extends Migration * Run the migrations. * * @SuppressWarnings(PHPMD.ShortMethodName) - * @return void */ public function up() { if (!Schema::hasTable('currency_exchange_rates')) { Schema::create( - 'currency_exchange_rates', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('user_id', false, true); - $table->integer('from_currency_id', false, true); - $table->integer('to_currency_id', false, true); - $table->date('date'); - $table->decimal('rate', 22, 12); - $table->decimal('user_rate', 22, 12)->nullable(); + 'currency_exchange_rates', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->integer('user_id', false, true); + $table->integer('from_currency_id', false, true); + $table->integer('to_currency_id', false, true); + $table->date('date'); + $table->decimal('rate', 22, 12); + $table->decimal('user_rate', 22, 12)->nullable(); - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - $table->foreign('from_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade'); - $table->foreign('to_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade'); - } + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + $table->foreign('from_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade'); + $table->foreign('to_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade'); + } ); } - // - Schema::table( - 'transactions', function (Blueprint $table) { - $table->integer('transaction_currency_id', false, true)->after('description')->nullable(); - $table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('set null'); - } - ); + Schema::table( + 'transactions', + function (Blueprint $table) { + $table->integer('transaction_currency_id', false, true)->after('description')->nullable(); + $table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('set null'); + } + ); } } diff --git a/database/migrations/2017_06_02_105232_changes_for_v450.php b/database/migrations/2017_06_02_105232_changes_for_v450.php index 44c2a04dc4..dbc92fe4da 100644 --- a/database/migrations/2017_06_02_105232_changes_for_v450.php +++ b/database/migrations/2017_06_02_105232_changes_for_v450.php @@ -8,10 +8,8 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); - use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; @@ -22,8 +20,6 @@ class ChangesForV450 extends Migration { /** * Reverse the migrations. - * - * @return void */ public function down() { @@ -33,23 +29,24 @@ class ChangesForV450 extends Migration * Run the migrations. * * @SuppressWarnings(PHPMD.ShortMethodName) - * @return void */ public function up() { // add "foreign_amount" to transactions Schema::table( - 'transactions', function (Blueprint $table) { - $table->decimal('foreign_amount', 22, 12)->nullable()->after('amount'); - } + 'transactions', + function (Blueprint $table) { + $table->decimal('foreign_amount', 22, 12)->nullable()->after('amount'); + } ); // add foreign transaction currency id to transactions (is nullable): Schema::table( - 'transactions', function (Blueprint $table) { - $table->integer('foreign_currency_id', false, true)->default(null)->after('foreign_amount')->nullable(); - $table->foreign('foreign_currency_id')->references('id')->on('transaction_currencies')->onDelete('set null'); - } + 'transactions', + function (Blueprint $table) { + $table->integer('foreign_currency_id', false, true)->default(null)->after('foreign_amount')->nullable(); + $table->foreign('foreign_currency_id')->references('id')->on('transaction_currencies')->onDelete('set null'); + } ); } } diff --git a/database/migrations/2017_08_20_062014_changes_for_v470.php b/database/migrations/2017_08_20_062014_changes_for_v470.php index 942ef5e788..0f1173a17f 100644 --- a/database/migrations/2017_08_20_062014_changes_for_v470.php +++ b/database/migrations/2017_08_20_062014_changes_for_v470.php @@ -1,6 +1,6 @@ increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->string('name'); - $table->string('outward'); - $table->string('inward'); - $table->boolean('editable'); + 'link_types', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->string('name'); + $table->string('outward'); + $table->string('inward'); + $table->boolean('editable'); - $table->unique(['name', 'outward','inward']); - } + $table->unique(['name', 'outward', 'inward']); + } ); } if (!Schema::hasTable('journal_links')) { Schema::create( - 'journal_links', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->integer('link_type_id', false, true); - $table->integer('source_id', false, true); - $table->integer('destination_id', false, true); - $table->text('comment')->nullable(); + 'journal_links', + function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->integer('link_type_id', false, true); + $table->integer('source_id', false, true); + $table->integer('destination_id', false, true); + $table->text('comment')->nullable(); - $table->foreign('link_type_id')->references('id')->on('link_types')->onDelete('cascade'); - $table->foreign('source_id')->references('id')->on('transaction_journals')->onDelete('cascade'); - $table->foreign('destination_id')->references('id')->on('transaction_journals')->onDelete('cascade'); + $table->foreign('link_type_id')->references('id')->on('link_types')->onDelete('cascade'); + $table->foreign('source_id')->references('id')->on('transaction_journals')->onDelete('cascade'); + $table->foreign('destination_id')->references('id')->on('transaction_journals')->onDelete('cascade'); - $table->unique(['link_type_id','source_id','destination_id']); - - - } + $table->unique(['link_type_id', 'source_id', 'destination_id']); + } ); } } diff --git a/database/migrations/2017_11_04_170844_changes_for_v470a.php b/database/migrations/2017_11_04_170844_changes_for_v470a.php new file mode 100644 index 0000000000..6ebbdb0a23 --- /dev/null +++ b/database/migrations/2017_11_04_170844_changes_for_v470a.php @@ -0,0 +1,32 @@ +boolean('reconciled')->after('deleted_at')->default(0); + } + ); + } +} diff --git a/database/seeds/AccountTypeSeeder.php b/database/seeds/AccountTypeSeeder.php index e98b6b8db7..2a1b072141 100644 --- a/database/seeds/AccountTypeSeeder.php +++ b/database/seeds/AccountTypeSeeder.php @@ -8,7 +8,6 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); use FireflyIII\Models\AccountType; @@ -21,16 +20,15 @@ class AccountTypeSeeder extends Seeder { public function run() { - AccountType::create(['type' => 'Default account']); - AccountType::create(['type' => 'Cash account']); - AccountType::create(['type' => 'Asset account']); - AccountType::create(['type' => 'Expense account']); - AccountType::create(['type' => 'Revenue account']); - AccountType::create(['type' => 'Initial balance account']); - AccountType::create(['type' => 'Beneficiary account']); - AccountType::create(['type' => 'Import account']); - AccountType::create(['type' => 'Loan']); + AccountType::create(['type' => AccountType::DEFAULT]); + AccountType::create(['type' => AccountType::CASH]); + AccountType::create(['type' => AccountType::ASSET]); + AccountType::create(['type' => AccountType::EXPENSE]); + AccountType::create(['type' => AccountType::REVENUE]); + AccountType::create(['type' => AccountType::INITIAL_BALANCE]); + AccountType::create(['type' => AccountType::BENEFICIARY]); + AccountType::create(['type' => AccountType::IMPORT]); + AccountType::create(['type' => AccountType::LOAN]); + AccountType::create(['type' => AccountType::RECONCILIATION]); } - - -} +} diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 03adb0669e..11505d148a 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -19,8 +19,6 @@ class DatabaseSeeder extends Seeder { /** * Run the database seeds. - * - * @return void */ public function run() { @@ -29,6 +27,5 @@ class DatabaseSeeder extends Seeder $this->call(TransactionTypeSeeder::class); $this->call(PermissionSeeder::class); $this->call(LinkTypeSeeder::class); - } } diff --git a/database/seeds/LinkTypeSeeder.php b/database/seeds/LinkTypeSeeder.php index 3b872e4588..4662d0820c 100644 --- a/database/seeds/LinkTypeSeeder.php +++ b/database/seeds/LinkTypeSeeder.php @@ -7,10 +7,8 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); - use FireflyIII\Models\LinkType; use Illuminate\Database\Seeder; @@ -51,7 +49,5 @@ class LinkTypeSeeder extends Seeder $link->outward = '(partially) reimburses'; $link->editable = false; $link->save(); - } - } diff --git a/database/seeds/PermissionSeeder.php b/database/seeds/PermissionSeeder.php index 94b3e48afa..f24ef6b1c0 100644 --- a/database/seeds/PermissionSeeder.php +++ b/database/seeds/PermissionSeeder.php @@ -8,10 +8,8 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); - use FireflyIII\Models\Role; use Illuminate\Database\Seeder; @@ -33,7 +31,5 @@ class PermissionSeeder extends Seeder $demo->display_name = 'Demo User'; $demo->description = 'User is a demo user'; $demo->save(); - } - } diff --git a/database/seeds/TransactionCurrencySeeder.php b/database/seeds/TransactionCurrencySeeder.php index 0d7732e80b..31b3650681 100644 --- a/database/seeds/TransactionCurrencySeeder.php +++ b/database/seeds/TransactionCurrencySeeder.php @@ -8,7 +8,6 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); use FireflyIII\Models\TransactionCurrency; @@ -21,14 +20,34 @@ class TransactionCurrencySeeder extends Seeder { public function run() { + // european currencies TransactionCurrency::create(['code' => 'EUR', 'name' => 'Euro', 'symbol' => '€', 'decimal_places' => 2]); - TransactionCurrency::create(['code' => 'USD', 'name' => 'US Dollar', 'symbol' => '$', 'decimal_places' => 2]); TransactionCurrency::create(['code' => 'HUF', 'name' => 'Hungarian forint', 'symbol' => 'Ft', 'decimal_places' => 2]); - TransactionCurrency::create(['code' => 'BRL', 'name' => 'Real', 'symbol' => 'R$', 'decimal_places' => 2]); TransactionCurrency::create(['code' => 'GBP', 'name' => 'British Pound', 'symbol' => '£', 'decimal_places' => 2]); - TransactionCurrency::create(['code' => 'IDR', 'name' => 'Indonesian rupiah', 'symbol' => 'Rp', 'decimal_places' => 2]); - TransactionCurrency::create(['code' => 'XBT', 'name' => 'Bitcoin', 'symbol' => 'B', 'decimal_places' => 8]); - TransactionCurrency::create(['code' => 'JPY', 'name' => 'Japanese yen', 'symbol' => '¥', 'decimal_places' => 2]); - } -} + // american currencies + TransactionCurrency::create(['code' => 'USD', 'name' => 'US Dollar', 'symbol' => '$', 'decimal_places' => 2]); + TransactionCurrency::create(['code' => 'BRL', 'name' => 'Brazilian real', 'symbol' => 'R$', 'decimal_places' => 2]); + TransactionCurrency::create(['code' => 'CAD', 'name' => 'Canadian dollar', 'symbol' => 'C$', 'decimal_places' => 2]); + + // oceanian currencies + TransactionCurrency::create(['code' => 'IDR', 'name' => 'Indonesian rupiah', 'symbol' => 'Rp', 'decimal_places' => 2]); + TransactionCurrency::create(['code' => 'AUD', 'name' => 'Australian dollar', 'symbol' => 'A$', 'decimal_places' => 2]); + TransactionCurrency::create(['code' => 'NZD', 'name' => 'New Zealand dollar', 'symbol' => 'NZ$', 'decimal_places' => 2]); + + // african currencies + TransactionCurrency::create(['code' => 'EGP', 'name' => 'Egyptian pound', 'symbol' => 'E£', 'decimal_places' => 2]); + TransactionCurrency::create(['code' => 'MAD', 'name' => 'Moroccan dirham', 'symbol' => 'DH', 'decimal_places' => 2]); + TransactionCurrency::create(['code' => 'ZAR', 'name' => 'South African rand', 'symbol' => 'R', 'decimal_places' => 2]); + + // asian currencies + TransactionCurrency::create(['code' => 'JPY', 'name' => 'Japanese yen', 'symbol' => '¥', 'decimal_places' => 2]); + TransactionCurrency::create(['code' => 'RMB', 'name' => 'Chinese yuan', 'symbol' => '元', 'decimal_places' => 2]); + TransactionCurrency::create(['code' => 'RUB', 'name' => 'Russian ruble ', 'symbol' => '₽', 'decimal_places' => 2]); + + // international currencies + TransactionCurrency::create(['code' => 'XBT', 'name' => 'Bitcoin', 'symbol' => '₿', 'decimal_places' => 8]); + TransactionCurrency::create(['code' => 'BCH', 'name' => 'Bitcoin cash', 'symbol' => '₿C', 'decimal_places' => 8]); + TransactionCurrency::create(['code' => 'ETH', 'name' => 'Ethereum', 'symbol' => 'Ξ', 'decimal_places' => 12]); + } +} diff --git a/database/seeds/TransactionTypeSeeder.php b/database/seeds/TransactionTypeSeeder.php index 6c1a709bb3..f12c118758 100644 --- a/database/seeds/TransactionTypeSeeder.php +++ b/database/seeds/TransactionTypeSeeder.php @@ -8,7 +8,6 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); use FireflyIII\Models\TransactionType; @@ -25,6 +24,6 @@ class TransactionTypeSeeder extends Seeder TransactionType::create(['type' => TransactionType::DEPOSIT]); TransactionType::create(['type' => TransactionType::TRANSFER]); TransactionType::create(['type' => TransactionType::OPENING_BALANCE]); + TransactionType::create(['type' => TransactionType::RECONCILIATION]); } - -} +} diff --git a/docker-compose.dockerhub.yml b/docker-compose.dockerhub.yml index adad39769f..9efec01696 100644 --- a/docker-compose.dockerhub.yml +++ b/docker-compose.dockerhub.yml @@ -1,7 +1,7 @@ version: '2' services: firefly-db: - image: 'mysql:8' + image: mysql:8 environment: - MYSQL_DATABASE=firefly_db - MYSQL_USER=firefly_db diff --git a/nginx_app.conf b/nginx_app.conf index b0a4d0ee32..97bdb62378 100644 --- a/nginx_app.conf +++ b/nginx_app.conf @@ -1,7 +1,12 @@ +# prevent HTTPoxy vulnerability +fastcgi_param HTTP_PROXY ""; + location / { + # try to serve file directly, fallback to rewrite try_files $uri @rewriteapp; } location @rewriteapp { + # rewrite all to index.php rewrite ^(.*)$ /index.php$1 last; } \ No newline at end of file diff --git a/public/css/firefly.css b/public/css/firefly.css index 87489e2b14..b1224ebcdc 100644 --- a/public/css/firefly.css +++ b/public/css/firefly.css @@ -28,7 +28,7 @@ } p.tagcloud .label { - line-height:2; + line-height: 2; } .handle { @@ -126,4 +126,10 @@ span.info-box-icon a { span.info-box-text a:hover, span.info-box-number a:hover { color: #000; text-decoration: underline; +} + +.dropdown-menu { + max-height: 300px; + overflow-y: auto; + overflow-x: hidden; } \ No newline at end of file diff --git a/public/css/google-fonts.css b/public/css/google-fonts.css index ad3e4c6983..3647aa35a3 100644 --- a/public/css/google-fonts.css +++ b/public/css/google-fonts.css @@ -26,6 +26,7 @@ src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightItalic'), url('../fonts/SourceSansPro-LightItalic-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; } + /* cyrillic */ @font-face { font-family: 'Source Sans Pro'; @@ -34,6 +35,7 @@ src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightItalic'), url('../fonts/SourceSansPro-LightItalic-cyrillic.woff2') format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } + /* greek-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -42,6 +44,7 @@ src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightItalic'), url('../fonts/SourceSansPro-LightItalic-greek-ext.woff2') format('woff2'); unicode-range: U+1F00-1FFF; } + /* greek */ @font-face { font-family: 'Source Sans Pro'; @@ -50,6 +53,7 @@ src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightItalic'), url('../fonts/SourceSansPro-LightItalic-greek.woff2') format('woff2'); unicode-range: U+0370-03FF; } + /* vietnamese */ @font-face { font-family: 'Source Sans Pro'; @@ -58,6 +62,7 @@ src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightItalic'), url('../fonts/SourceSansPro-LightItalic-vietnamese.woff2') format('woff2'); unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; } + /* latin-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -66,6 +71,7 @@ src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightItalic'), url('../fonts/SourceSansPro-LightItalic-latin-ext.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; } + /* latin */ @font-face { font-family: 'Source Sans Pro'; @@ -74,6 +80,7 @@ src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightItalic'), url('../fonts/SourceSansPro-LightItalic-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; } + /* cyrillic-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -82,6 +89,7 @@ src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url('../fonts/SourceSansPro-Italic-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; } + /* cyrillic */ @font-face { font-family: 'Source Sans Pro'; @@ -90,6 +98,7 @@ src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url('../fonts/SourceSansPro-Italic-cyrillic.woff2') format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } + /* greek-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -98,6 +107,7 @@ src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url('../fonts/SourceSansPro-Italic-greek-ext.woff2') format('woff2'); unicode-range: U+1F00-1FFF; } + /* greek */ @font-face { font-family: 'Source Sans Pro'; @@ -106,6 +116,7 @@ src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url('../fonts/SourceSansPro-Italic-greek.woff2') format('woff2'); unicode-range: U+0370-03FF; } + /* vietnamese */ @font-face { font-family: 'Source Sans Pro'; @@ -114,6 +125,7 @@ src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url('../fonts/SourceSansPro-Italic-vietnamese.woff2') format('woff2'); unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; } + /* latin-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -122,6 +134,7 @@ src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url('../fonts/SourceSansPro-Italic-latin-ext.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; } + /* latin */ @font-face { font-family: 'Source Sans Pro'; @@ -130,6 +143,7 @@ src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url('../fonts/SourceSansPro-Italic-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; } + /* cyrillic-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -138,6 +152,7 @@ src: local('Source Sans Pro SemiBold Italic'), local('SourceSansPro-SemiBoldItalic'), url('../fonts/SourceSansPro-SemiBoldItalic-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; } + /* cyrillic */ @font-face { font-family: 'Source Sans Pro'; @@ -146,6 +161,7 @@ src: local('Source Sans Pro SemiBold Italic'), local('SourceSansPro-SemiBoldItalic'), url('../fonts/SourceSansPro-SemiBoldItalic-cyrillic.woff2') format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } + /* greek-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -154,6 +170,7 @@ src: local('Source Sans Pro SemiBold Italic'), local('SourceSansPro-SemiBoldItalic'), url('../fonts/SourceSansPro-SemiBoldItalic-greek-ext.woff2') format('woff2'); unicode-range: U+1F00-1FFF; } + /* greek */ @font-face { font-family: 'Source Sans Pro'; @@ -162,6 +179,7 @@ src: local('Source Sans Pro SemiBold Italic'), local('SourceSansPro-SemiBoldItalic'), url('../fonts/SourceSansPro-SemiBoldItalic-greek.woff2') format('woff2'); unicode-range: U+0370-03FF; } + /* vietnamese */ @font-face { font-family: 'Source Sans Pro'; @@ -170,6 +188,7 @@ src: local('Source Sans Pro SemiBold Italic'), local('SourceSansPro-SemiBoldItalic'), url('../fonts/SourceSansPro-SemiBoldItalic-vietnamese.woff2') format('woff2'); unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; } + /* latin-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -178,6 +197,7 @@ src: local('Source Sans Pro SemiBold Italic'), local('SourceSansPro-SemiBoldItalic'), url('../fonts/SourceSansPro-SemiBoldItalic-latin-ext.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; } + /* latin */ @font-face { font-family: 'Source Sans Pro'; @@ -186,6 +206,7 @@ src: local('Source Sans Pro SemiBold Italic'), local('SourceSansPro-SemiBoldItalic'), url('../fonts/SourceSansPro-SemiBoldItalic-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; } + /* cyrillic-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -194,6 +215,7 @@ src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url('../fonts/SourceSansPro-Light-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; } + /* cyrillic */ @font-face { font-family: 'Source Sans Pro'; @@ -202,6 +224,7 @@ src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url('../fonts/SourceSansPro-Light-cyrillic.woff2') format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } + /* greek-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -210,6 +233,7 @@ src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url('../fonts/SourceSansPro-Light-greek-ext.woff2') format('woff2'); unicode-range: U+1F00-1FFF; } + /* greek */ @font-face { font-family: 'Source Sans Pro'; @@ -218,6 +242,7 @@ src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url('../fonts/SourceSansPro-Light-greek.woff2') format('woff2'); unicode-range: U+0370-03FF; } + /* vietnamese */ @font-face { font-family: 'Source Sans Pro'; @@ -226,6 +251,7 @@ src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url('../fonts/SourceSansPro-Light-vietnamese.woff2') format('woff2'); unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; } + /* latin-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -234,6 +260,7 @@ src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url('../fonts/SourceSansPro-Light-latin-ext.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; } + /* latin */ @font-face { font-family: 'Source Sans Pro'; @@ -242,6 +269,7 @@ src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url('../fonts/SourceSansPro-Light-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; } + /* cyrillic-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -250,6 +278,7 @@ src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url('../fonts/SourceSansPro-Regular-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; } + /* cyrillic */ @font-face { font-family: 'Source Sans Pro'; @@ -258,6 +287,7 @@ src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url('../fonts/SourceSansPro-Regular-cyrillic.woff2') format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } + /* greek-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -266,6 +296,7 @@ src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url('../fonts/SourceSansPro-Regular-greek-ext.woff2') format('woff2'); unicode-range: U+1F00-1FFF; } + /* greek */ @font-face { font-family: 'Source Sans Pro'; @@ -274,6 +305,7 @@ src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url('../fonts/SourceSansPro-Regular-greek.woff2') format('woff2'); unicode-range: U+0370-03FF; } + /* vietnamese */ @font-face { font-family: 'Source Sans Pro'; @@ -282,6 +314,7 @@ src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url('../fonts/SourceSansPro-Regular-vietnamese.woff2') format('woff2'); unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; } + /* latin-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -290,6 +323,7 @@ src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url('../fonts/SourceSansPro-Regular-latin-ext.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; } + /* latin */ @font-face { font-family: 'Source Sans Pro'; @@ -298,6 +332,7 @@ src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url('../fonts/SourceSansPro-Regular-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; } + /* cyrillic-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -306,6 +341,7 @@ src: local('Source Sans Pro SemiBold'), local('SourceSansPro-SemiBold'), url('../fonts/SourceSansPro-SemiBold-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; } + /* cyrillic */ @font-face { font-family: 'Source Sans Pro'; @@ -314,6 +350,7 @@ src: local('Source Sans Pro SemiBold'), local('SourceSansPro-SemiBold'), url('../fonts/SourceSansPro-SemiBold-cyrillic.woff2') format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } + /* greek-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -322,6 +359,7 @@ src: local('Source Sans Pro SemiBold'), local('SourceSansPro-SemiBold'), url('../fonts/SourceSansPro-SemiBold-greek-ext.woff2') format('woff2'); unicode-range: U+1F00-1FFF; } + /* greek */ @font-face { font-family: 'Source Sans Pro'; @@ -330,6 +368,7 @@ src: local('Source Sans Pro SemiBold'), local('SourceSansPro-SemiBold'), url('../fonts/SourceSansPro-SemiBold-greek.woff2') format('woff2'); unicode-range: U+0370-03FF; } + /* vietnamese */ @font-face { font-family: 'Source Sans Pro'; @@ -338,6 +377,7 @@ src: local('Source Sans Pro SemiBold'), local('SourceSansPro-SemiBold'), url('../fonts/SourceSansPro-SemiBold-vietnamese.woff2') format('woff2'); unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; } + /* latin-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -346,6 +386,7 @@ src: local('Source Sans Pro SemiBold'), local('SourceSansPro-SemiBold'), url('../fonts/SourceSansPro-SemiBold-latin-ext.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; } + /* latin */ @font-face { font-family: 'Source Sans Pro'; @@ -354,6 +395,7 @@ src: local('Source Sans Pro SemiBold'), local('SourceSansPro-SemiBold'), url('../fonts/SourceSansPro-SemiBold-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; } + /* cyrillic-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -362,6 +404,7 @@ src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url('../fonts/SourceSansPro-Bold-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; } + /* cyrillic */ @font-face { font-family: 'Source Sans Pro'; @@ -370,6 +413,7 @@ src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url('../fonts/SourceSansPro-Bold-cyrillic.woff2') format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } + /* greek-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -378,6 +422,7 @@ src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url('../fonts/SourceSansPro-Bold-greek-ext.woff2') format('woff2'); unicode-range: U+1F00-1FFF; } + /* greek */ @font-face { font-family: 'Source Sans Pro'; @@ -386,6 +431,7 @@ src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url('../fonts/SourceSansPro-Bold-greek.woff2') format('woff2'); unicode-range: U+0370-03FF; } + /* vietnamese */ @font-face { font-family: 'Source Sans Pro'; @@ -394,6 +440,7 @@ src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url('../fonts/SourceSansPro-Bold-vietnamese.woff2') format('woff2'); unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; } + /* latin-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -402,6 +449,7 @@ src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url('../fonts/SourceSansPro-Bold-latin-ext.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; } + /* latin */ @font-face { font-family: 'Source Sans Pro'; diff --git a/public/index.php b/public/index.php index fee61b0b1d..abea8072d8 100644 --- a/public/index.php +++ b/public/index.php @@ -40,7 +40,7 @@ define('LARAVEL_START', microtime(true)); | */ -require __DIR__.'/../vendor/autoload.php'; +require __DIR__ . '/../vendor/autoload.php'; /* |-------------------------------------------------------------------------- @@ -54,7 +54,7 @@ require __DIR__.'/../vendor/autoload.php'; | */ -$app = require_once __DIR__.'/../bootstrap/app.php'; +$app = require_once __DIR__ . '/../bootstrap/app.php'; /* |-------------------------------------------------------------------------- diff --git a/public/js/ff/accounts/edit-reconciliation.js b/public/js/ff/accounts/edit-reconciliation.js new file mode 100644 index 0000000000..cbcbcd7e42 --- /dev/null +++ b/public/js/ff/accounts/edit-reconciliation.js @@ -0,0 +1,52 @@ +/* + * edit-reconciliation.js + * Copyright (c) 2017 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 . + */ + +/** global: what, Modernizr, selectsForeignCurrency, convertForeignToNative, validateCurrencyForTransfer, convertSourceToDestination, journalData, journal, accountInfo, exchangeRateInstructions, currencyInfo */ + +$(document).ready(function () { + "use strict"; + setAutocompletes(); + +}); + +/** + * Set the auto-complete JSON things. + */ +function setAutocompletes() { + + $.getJSON('json/categories').done(function (data) { + $('input[name="category"]').typeahead({source: data}); + }); + + $.getJSON('json/tags').done(function (data) { + var opt = { + typeahead: { + source: data, + afterSelect: function () { + this.$element.val(""); + } + } + }; + $('input[name="tags"]').tagsinput( + opt + ); + }); +} + diff --git a/public/js/ff/accounts/reconcile.js b/public/js/ff/accounts/reconcile.js new file mode 100644 index 0000000000..6609efd287 --- /dev/null +++ b/public/js/ff/accounts/reconcile.js @@ -0,0 +1,224 @@ +/* + * reconcile.js + * Copyright (c) 2017 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 . + */ + +/** global: overviewUri, transactionsUri, indexUri,accounting */ + +var balanceDifference = 0; +var difference = 0; +var selectedAmount = 0; +var reconcileStarted = false; +var changedBalances = false; + +/** + * + */ +$(function () { + "use strict"; + + /* + Respond to changes in balance statements. + */ + $('input[type="number"]').on('change', function () { + if (reconcileStarted) { + calculateBalanceDifference(); + difference = balanceDifference - selectedAmount; + updateDifference(); + } + changedBalances = true; + }); + + /* + Respond to changes in the date range. + */ + $('input[type="date"]').on('change', function () { + if (reconcileStarted) { + // hide original instructions. + $('.select_transactions_instruction').hide(); + + // show date-change warning + $('.date_change_warning').show(); + + // show update button + $('.change_date_button').show(); + } + }); + + $('.change_date_button').click(startReconcile); + $('.start_reconcile').click(startReconcile); + $('.store_reconcile').click(storeReconcile); + +}); + +function storeReconcile() { + // get modal HTML: + var ids = []; + $.each($('.reconcile_checkbox:checked'), function (i, v) { + ids.push($(v).data('id')); + }); + var cleared = []; + $.each($('input[class="cleared"]'), function (i, v) { + var obj = $(v); + cleared.push(obj.data('id')); + }); + + var variables = { + startBalance: parseFloat($('input[name="start_balance"]').val()), + endBalance: parseFloat($('input[name="end_balance"]').val()), + startDate: $('input[name="start_date"]').val(), + startEnd: $('input[name="end_date"]').val(), + transactions: ids, + cleared: cleared, + }; + var uri = overviewUri.replace('%start%', $('input[name="start_date"]').val()).replace('%end%', $('input[name="end_date"]').val()); + + + $.getJSON(uri, variables).done(function (data) { + if (data.is_zero === false) { + $('#defaultModal').empty().html(data.html).modal('show'); + } + }); +} + +/** + * What happens when you check a checkbox: + * @param e + */ +function checkReconciledBox(e) { + var el = $(e.target); + var amount = parseFloat(el.val()); + // if checked, add to selected amount + if (el.prop('checked') === true && el.data('younger') === false) { + selectedAmount = selectedAmount - amount; + } + if (el.prop('checked') === false && el.data('younger') === false) { + selectedAmount = selectedAmount + amount; + } + difference = balanceDifference - selectedAmount; + updateDifference(); +} + + +/** + * Calculate the difference between given start and end balance + * and put it in balanceDifference. + */ +function calculateBalanceDifference() { + var startBalance = parseFloat($('input[name="start_balance"]').val()); + var endBalance = parseFloat($('input[name="end_balance"]').val()); + balanceDifference = startBalance - endBalance; + //if (balanceDifference < 0) { + // balanceDifference = balanceDifference * -1; + //} +} + +/** + * Grab all transactions, update the URL and place the set of transactions in the box. + * This more or less resets the reconciliation. + */ +function getTransactionsForRange() { + // clear out the box: + $('#transactions_holder').empty().append($('

').addClass('text-center').html('')); + var uri = transactionsUri.replace('%start%', $('input[name="start_date"]').val()).replace('%end%', $('input[name="end_date"]').val()); + var index = indexUri.replace('%start%', $('input[name="start_date"]').val()).replace('%end%', $('input[name="end_date"]').val()); + window.history.pushState('object or string', "Reconcile account", index); + + $.getJSON(uri).done(placeTransactions); +} + +/** + * Loop over all transactions that have already been cleared (in the range) and add this to the selectedAmount. + * + */ +function includeClearedTransactions() { + $.each($('input[class="cleared"]'), function (i, v) { + var obj = $(v); + if (obj.data('younger') === false) { + selectedAmount = selectedAmount - parseFloat(obj.val()); + } + }); +} + +/** + * Place the HTML for the transactions within the date range and update the balance difference. + * @param data + */ +function placeTransactions(data) { + $('#transactions_holder').empty().html(data.html); + selectedAmount = 0; + // update start + end balance when user has not touched them. + if (!changedBalances) { + $('input[name="start_balance"]').val(data.startBalance); + $('input[name="end_balance"]').val(data.endBalance); + } + + // as long as the dates are equal, changing the balance does not matter. + calculateBalanceDifference(); + + // any already cleared transactions must be added to / removed from selectedAmount. + includeClearedTransactions(); + + difference = balanceDifference; + updateDifference(); + + // enable the check buttons: + $('.reconcile_checkbox').prop('disabled', false).unbind('change').change(checkReconciledBox); + + // show the other instruction: + $('.select_transactions_instruction').show(); + + $('.store_reconcile').prop('disabled', false); +} + +/** + * + * @returns {boolean} + */ +function startReconcile() { + + reconcileStarted = true; + + // hide the start button. + $('.start_reconcile').hide(); + + // hide the start instructions: + $('.update_balance_instruction').hide(); + + // hide date-change warning + $('.date_change_warning').hide(); + + // hide update button + $('.change_date_button').hide(); + + getTransactionsForRange(); + + + return false; +} + +function updateDifference() { + var addClass = 'text-info'; + if (difference > 0) { + addClass = 'text-success'; + } + if (difference < 0) { + addClass = 'text-danger'; + } + $('#difference').addClass(addClass).text(accounting.formatMoney(difference)); +} \ No newline at end of file diff --git a/public/js/ff/budgets/index.js b/public/js/ff/budgets/index.js index e4b31c615e..0fc5f64cc6 100644 --- a/public/js/ff/budgets/index.js +++ b/public/js/ff/budgets/index.js @@ -18,8 +18,7 @@ * along with Firefly III. If not, see . */ -/** global: spent, budgeted, available, currencySymbol, budgetIndexUri, updateIncomeUri, periodStart, periodEnd, budgetAmountUri, accounting */ - +/** global: infoIncomeUri, spent, budgeted, available, currencySymbol, budgetIndexUri, updateIncomeUri, periodStart, periodEnd, budgetAmountUri, accounting */ /** * */ @@ -38,7 +37,7 @@ $(function () { /* When the input changes, update the percentages for the budgeted bar: */ - $('input[type="number"]').on('input', updateBudgetedAmounts); + $('input[type="number"]').on('change', updateBudgetedAmounts); // $('.selectPeriod').change(function (e) { @@ -104,46 +103,52 @@ function updateBudgetedAmounts(e) { "use strict"; var target = $(e.target); var id = target.data('id'); - + var leftCell = $('td[class$="left"][data-id="' + id + '"]'); + var link = $('a[data-id="'+id+'"][class="budget-link"]'); var value = target.val(); var original = target.data('original'); - var difference = value - original; - var spentCell = $('td[class="spent"][data-id="' + id + '"]'); - var leftCell = $('td[class="left"][data-id="' + id + '"]'); - var spentAmount = parseFloat(spentCell.data('spent')); - var newAmountLeft = spentAmount + parseFloat(value); - var amountLeftString = accounting.formatMoney(newAmountLeft); - if (newAmountLeft < 0) { - leftCell.html('' + amountLeftString + ''); - } - if (newAmountLeft > 0) { - leftCell.html('' + amountLeftString + ''); - } - if (newAmountLeft === 0.0) { - leftCell.html('' + amountLeftString + ''); - } + // disable input + target.prop('disabled', true); - if (difference !== 0) { - // add difference to 'budgeted' var + // replace link (for now) + link.attr('href','#'); + + // replace "left" with spinner. + leftCell.empty().html(''); + + // send a post to Firefly to update the amount: + var newUri = budgetAmountUri.replace("REPLACE", id); + + $.post(newUri, {amount: value, start: periodStart, end: periodEnd}).done(function (data) { + + // difference between new value and original value + var difference = value - original; + + // update budgeted value budgeted = budgeted + difference; - // update original: - target.data('original', value); + // fill in "left" value: + leftCell.html(data.left); + + // update "budgeted" input: + target.val(data.amount); + + // enable thing again + target.prop('disabled', false); + + // set new original value: + target.data('original', data.amount); + // run drawBudgetedBar() again: drawBudgetedBar(); - // send a post to Firefly to update the amount: - var newUri = budgetAmountUri.replace("REPLACE", id); - $.post(newUri, {amount: value, start: periodStart, end: periodEnd}).done(function (data) { - // update the link if relevant: - if (data.repetition > 0) { - $('.budget-link[data-id="' + id + '"]').attr('href', 'budgets/show/' + id + '/' + data.repetition); - } else { - $('.budget-link[data-id="' + id + '"]').attr('href', 'budgets/show/' + id); - } - }); - } + // update the link if relevant: + link.attr('href', 'budgets/show/' + id); + if (data.limit > 0) { + link.attr('href', 'budgets/show/' + id + '/' + data.limit); + } + }); } /** diff --git a/public/js/ff/charts.js b/public/js/ff/charts.js index 9b59ab1db4..d69efc3f66 100644 --- a/public/js/ff/charts.js +++ b/public/js/ff/charts.js @@ -17,9 +17,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ -/** global: Chart, defaultChartOptions, accounting, defaultPieOptions, noDataForChart */ +/** global: Chart, defaultChartOptions, accounting, defaultPieOptions, noDataForChart, todayText */ var allCharts = {}; + /* Make some colours: */ @@ -58,6 +59,42 @@ Chart.defaults.global.responsive = true; Chart.defaults.global.maintainAspectRatio = false; +/** + * Chart line thing + */ +const verticalLinePlugin = { + getLinePosition: function (chart, pointIndex) { + const meta = chart.getDatasetMeta(0); // first dataset is used to discover X coordinate of a point + const data = meta.data; + return data[pointIndex]._model.x; + }, + renderVerticalLine: function (chartInstance, pointIndex) { + const lineLeftOffset = this.getLinePosition(chartInstance, pointIndex); + const scale = chartInstance.scales['y-axis-0']; + const context = chartInstance.chart.ctx; + + // render vertical line + context.beginPath(); + context.strokeStyle = fillColors[3]; + context.moveTo(lineLeftOffset, scale.top); + context.lineTo(lineLeftOffset, scale.bottom); + context.stroke(); + + // write label + context.fillStyle = "#444444"; + context.textAlign = 'left'; + context.fillText(todayText, lineLeftOffset, scale.top * 3); // (scale.bottom - scale.top) / 2 + scale.top + }, + + afterDatasetsDraw: function (chart, easing) { + if (chart.config.lineAtIndex) { + chart.config.lineAtIndex.forEach(pointIndex => this.renderVerticalLine(chart, pointIndex)); + } + } +}; + +Chart.plugins.register(verticalLinePlugin); + /** * * @param data @@ -89,7 +126,16 @@ function lineChart(URI, container) { var options = $.extend(true, {}, defaultChartOptions); var chartType = 'line'; - drawAChart(URI, container, chartType, options, colorData); + drawAChart(URI, container, chartType, options, colorData, -1); +} + +function lineChartWithDay(URI, container, today) { + "use strict"; + var colorData = true; + var options = $.extend(true, {}, defaultChartOptions); + var chartType = 'line'; + + drawAChart(URI, container, chartType, options, colorData, today); } /** @@ -248,8 +294,9 @@ function pieChart(URI, container) { * @param chartType * @param options * @param colorData + * @param today */ -function drawAChart(URI, container, chartType, options, colorData) { +function drawAChart(URI, container, chartType, options, colorData, today) { var containerObj = $('#' + container); if (containerObj.length === 0) { return; @@ -286,11 +333,16 @@ function drawAChart(URI, container, chartType, options, colorData) { } else { // new chart! var ctx = document.getElementById(container).getContext("2d"); - allCharts[container] = new Chart(ctx, { + var chartOpts = { type: chartType, data: data, - options: options - }); + options: options, + lineAtIndex: [] + }; + if (today >= 0) { + chartOpts.lineAtIndex.push(today - 1); + } + allCharts[container] = new Chart(ctx, chartOpts); } }).fail(function () { diff --git a/public/js/ff/export/index.js b/public/js/ff/export/index.js index 97bfd5bf67..b446b20f03 100644 --- a/public/js/ff/export/index.js +++ b/public/js/ff/export/index.js @@ -120,7 +120,7 @@ function callExport() { var response = jqXHR.responseJSON; var errorText = 'The export failed. Please check the log files to find out why.'; if (typeof response === 'object') { - errorText =response.message; + errorText = response.message; } showError(errorText); diff --git a/public/js/ff/firefly.js b/public/js/ff/firefly.js index c852f35bf4..855ccff7d3 100644 --- a/public/js/ff/firefly.js +++ b/public/js/ff/firefly.js @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ -/** global: moment, dateRangeMeta,dateRangeConfig, accountingConfig, accounting, currencySymbol, mon_decimal_point, frac_digits, showFullList, showOnlyTop, mon_thousands_sep */ +/** global: moment, token, dateRangeMeta,dateRangeConfig, accountingConfig, accounting, currencySymbol, mon_decimal_point, frac_digits, showFullList, showOnlyTop, mon_thousands_sep */ $(function () { diff --git a/public/js/ff/index.js b/public/js/ff/index.js index 60b906cc0d..1d9ac6739d 100644 --- a/public/js/ff/index.js +++ b/public/js/ff/index.js @@ -18,7 +18,7 @@ * along with Firefly III. If not, see . */ -/** global: accountFrontpageUri, token, billCount, accountExpenseUri, accountRevenueUri */ +/** global: accountFrontpageUri, today, piggyInfoUri, token, billCount, accountExpenseUri, accountRevenueUri */ $(function () { "use strict"; @@ -29,7 +29,12 @@ $(function () { function drawChart() { "use strict"; - lineChart(accountFrontpageUri, 'accounts-chart'); + if (today >= 0) { + lineChartWithDay(accountFrontpageUri, 'accounts-chart', today); + } else { + lineChart(accountFrontpageUri, 'accounts-chart'); + } + if (billCount > 0) { pieChart('chart/bill/frontpage', 'bills-chart'); } diff --git a/public/js/ff/intro/intro.js b/public/js/ff/intro/intro.js index d4406076fa..65cd7cf005 100644 --- a/public/js/ff/intro/intro.js +++ b/public/js/ff/intro/intro.js @@ -18,7 +18,7 @@ * along with Firefly III. If not, see . */ -/** global: routeForTour, routeStepsUri, routeForFinishedTour, forceDemoOff */ +/** global: routeForTour, token, routeStepsUri, routeForFinishedTour, forceDemoOff */ $(function () { "use strict"; @@ -42,5 +42,5 @@ function setupIntro(steps) { } function reportIntroFinished() { - $.post(routeForFinishedTour, {_token:token}); + $.post(routeForFinishedTour, {_token: token}); } \ No newline at end of file diff --git a/public/js/ff/rules/index.js b/public/js/ff/rules/index.js index 3c975859ea..7e74c5edbc 100644 --- a/public/js/ff/rules/index.js +++ b/public/js/ff/rules/index.js @@ -58,7 +58,7 @@ function testRuleTriggers(e) { var obj = $(e.target); var ruleId = parseInt(obj.data('id')); var icon = obj; - if(obj.prop("tagName") === 'A') { + if (obj.prop("tagName") === 'A') { icon = $('i', obj); } // change icon: diff --git a/public/js/ff/tags/show.js b/public/js/ff/tags/show.js index a8dffd046d..d51d3ef920 100644 --- a/public/js/ff/tags/show.js +++ b/public/js/ff/tags/show.js @@ -18,7 +18,7 @@ * along with Firefly III. If not, see . */ -/** global: zoomLevel, latitude, longitude, google, doPlaceMarker */ +/** global: zoomLevel, latitude, longitude, L, mapboxToken, doPlaceMarker */ /* Some vars as prep for the map: @@ -31,7 +31,14 @@ $(function () { */ // make map: - var mymap = L.map('tag_location_map', {zoomControl: false, touchZoom: false, doubleClickZoom: false, scrollWheelZoom: false, boxZoom: false, dragging: false}).setView([latitude, longitude], zoomLevel); + var mymap = L.map('tag_location_map', { + zoomControl: false, + touchZoom: false, + doubleClickZoom: false, + scrollWheelZoom: false, + boxZoom: false, + dragging: false + }).setView([latitude, longitude], zoomLevel); L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', { attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox', @@ -40,7 +47,7 @@ $(function () { accessToken: mapboxToken }).addTo(mymap); - if(doPlaceMarker) { + if (doPlaceMarker) { var marker = L.marker([latitude, longitude]).addTo(mymap); } } diff --git a/public/js/ff/transactions/list.js b/public/js/ff/transactions/list.js index 58729480ef..8d6b67152c 100644 --- a/public/js/ff/transactions/list.js +++ b/public/js/ff/transactions/list.js @@ -20,6 +20,9 @@ /** global: edit_selected_txt, delete_selected_txt */ +/** + * + */ $(document).ready(function () { "use strict"; $('.mass_edit_all').show(); @@ -44,8 +47,43 @@ $(document).ready(function () { $('.mass_edit').click(goToMassEdit); // click the delete button: $('.mass_delete').click(goToMassDelete); + // click reconcile button + // $('.mass_reconcile').click(goToReconcile); }); +/** + * + * @returns {boolean} + */ +function goToReconcile() { + + var checked = $('.select_all_single:checked'); + var ids = []; + $.each(checked, function (i, v) { + ids.push(parseInt($(v).data('transaction'))); + }); + + // go to specially crafted URL: + var bases = document.getElementsByTagName('base'); + var baseHref = null; + + if (bases.length > 0) { + baseHref = bases[0].href; + } + + $.post(baseHref + 'transactions/reconcile', {transactions: ids}).done(function () { + window.location.reload(true); + }).fail(function () { + alert('Could not reconcile transactions: please check the logs and try again later.'); + }); + + return false; +} + +/** + * + * @returns {boolean} + */ function goToMassEdit() { "use strict"; var checkedArray = getCheckboxes(); @@ -62,6 +100,10 @@ function goToMassEdit() { return false; } +/** + * + * @returns {boolean} + */ function goToMassDelete() { "use strict"; var checkedArray = getCheckboxes(); @@ -77,6 +119,10 @@ function goToMassDelete() { return false; } +/** + * + * @returns {Array} + */ function getCheckboxes() { "use strict"; var list = []; @@ -90,13 +136,19 @@ function getCheckboxes() { return list; } - +/** + * + */ function countChecked() { "use strict"; var checked = $('.select_all_single:checked').length; if (checked > 0) { $('.mass_edit span').text(edit_selected_txt + ' (' + checked + ')'); $('.mass_delete span').text(delete_selected_txt + ' (' + checked + ')'); + + // get amount for the transactions: + //getAmounts(); + $('.mass_button_options').show(); } else { @@ -104,17 +156,26 @@ function countChecked() { } } - +/** + * + */ function checkAll() { "use strict"; $('.select_all_single').prop('checked', true); } +/** + * + */ function uncheckAll() { "use strict"; $('.select_all_single').prop('checked', false); } +/** + * + * @returns {boolean} + */ function stopMassSelect() { "use strict"; @@ -142,9 +203,16 @@ function stopMassSelect() { // hide the stop button $('.mass_stop_select').hide(); + // show reconcile account button, if present + $('.mass_reconcile').show(); + return false; } +/** + * + * @returns {boolean} + */ function startMassSelect() { "use strict"; // show "select all" box in table header. @@ -165,5 +233,8 @@ function startMassSelect() { // show the stop button $('.mass_stop_select').show(); + // hide reconcile account button, if present + $('.mass_reconcile').hide(); + return false; } \ No newline at end of file diff --git a/public/js/ff/transactions/show.js b/public/js/ff/transactions/show.js index f3dfc8cb31..093703bcdb 100644 --- a/public/js/ff/transactions/show.js +++ b/public/js/ff/transactions/show.js @@ -30,7 +30,7 @@ $(function () { source: data, autoSelect: true }); - $input.change(function() { + $input.change(function () { var current = $input.typeahead("getActive"); if (current) { // Some item from your model is active! diff --git a/public/js/ff/transactions/single/common.js b/public/js/ff/transactions/single/common.js index 61599512ad..eed4fbea7c 100644 --- a/public/js/ff/transactions/single/common.js +++ b/public/js/ff/transactions/single/common.js @@ -107,6 +107,10 @@ function selectsForeignCurrency() { if (foreignCurrencyId === nativeCurrencyId) { $('#exchange_rate_instruction_holder').hide(); $('#native_amount_holder').hide(); + + // make all other inputs empty + $('input[name="destination_amount"]').val(""); + $('input[name="native_amount"]').val(""); } return false; diff --git a/public/lib/adminlte/css/AdminLTE.css b/public/lib/adminlte/css/AdminLTE.css index c8158d0d10..1b9c78398d 100755 --- a/public/lib/adminlte/css/AdminLTE.css +++ b/public/lib/adminlte/css/AdminLTE.css @@ -1,178 +1,181 @@ -@import url('../../../css/google-fonts.css'); +/* + * AdminLTE.css + * Copyright (c) 2017 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 . + */ /*! - * AdminLTE v2.3.7 + * AdminLTE v2.4.0 * Author: Almsaeed Studio - * Website: Almsaeed Studio + * Website: Almsaeed Studio * License: Open source - MIT * Please visit http://opensource.org/licenses/MIT for more information -!*/ + */ /* * Core: General Layout Style * ------------------------- */ + +@import url('../../../css/google-fonts.css'); + html, body { - min-height: 100%; + height: 100%; } - .layout-boxed html, .layout-boxed body { - height: 100%; + height: 100%; } - body { - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; - font-weight: 400; - overflow-x: hidden; - overflow-y: auto; + font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; + font-weight: 400; + overflow-x: hidden; + overflow-y: auto; } - /* Layout */ .wrapper { - min-height: 100%; - position: relative; - overflow: hidden; + height: 100%; + position: relative; + overflow-x: hidden; + overflow-y: auto; } - .wrapper:before, .wrapper:after { - content: " "; - display: table; + content: " "; + display: table; } - .wrapper:after { - clear: both; + clear: both; +} +.wrapper:before, +.wrapper:after { + content: " "; + display: table; +} +.wrapper:after { + clear: both; } - .layout-boxed .wrapper { - max-width: 1250px; - margin: 0 auto; - min-height: 100%; - box-shadow: 0 0 8px rgba(0, 0, 0, 0.5); - position: relative; + max-width: 1250px; + margin: 0 auto; + min-height: 100%; + box-shadow: 0 0 8px rgba(0, 0, 0, 0.5); + position: relative; } - .layout-boxed { - background: url('../img/boxed-bg.jpg') repeat fixed; + background: url('../img/boxed-bg.jpg') repeat fixed; } - /* * Content Wrapper - contains the main content - * ```.right-side has been deprecated as of v2.0.0 in favor of .content-wrapper ``` */ .content-wrapper, -.right-side, .main-footer { - -webkit-transition: -webkit-transform 0.3s ease-in-out, margin 0.3s ease-in-out; - -moz-transition: -moz-transform 0.3s ease-in-out, margin 0.3s ease-in-out; - -o-transition: -o-transform 0.3s ease-in-out, margin 0.3s ease-in-out; - transition: transform 0.3s ease-in-out, margin 0.3s ease-in-out; - margin-left: 230px; - z-index: 820; + -webkit-transition: -webkit-transform 0.3s ease-in-out, margin 0.3s ease-in-out; + -moz-transition: -moz-transform 0.3s ease-in-out, margin 0.3s ease-in-out; + -o-transition: -o-transform 0.3s ease-in-out, margin 0.3s ease-in-out; + transition: transform 0.3s ease-in-out, margin 0.3s ease-in-out; + margin-left: 230px; + z-index: 820; } - .layout-top-nav .content-wrapper, -.layout-top-nav .right-side, .layout-top-nav .main-footer { + margin-left: 0; +} +@media (max-width: 767px) { + .content-wrapper, + .main-footer { margin-left: 0; + } } - -@media (max-width: 767px) { - .content-wrapper, - .right-side, - .main-footer { - margin-left: 0; - } -} - @media (min-width: 768px) { - .sidebar-collapse .content-wrapper, - .sidebar-collapse .right-side, - .sidebar-collapse .main-footer { - margin-left: 0; - } + .sidebar-collapse .content-wrapper, + .sidebar-collapse .main-footer { + margin-left: 0; + } } - @media (max-width: 767px) { - .sidebar-open .content-wrapper, - .sidebar-open .right-side, - .sidebar-open .main-footer { - -webkit-transform: translate(230px, 0); - -ms-transform: translate(230px, 0); - -o-transform: translate(230px, 0); - transform: translate(230px, 0); - } + .sidebar-open .content-wrapper, + .sidebar-open .main-footer { + -webkit-transform: translate(230px, 0); + -ms-transform: translate(230px, 0); + -o-transform: translate(230px, 0); + transform: translate(230px, 0); + } } - -.content-wrapper, -.right-side { - min-height: 100%; - background-color: #ecf0f5; - z-index: 800; +.content-wrapper { + min-height: 100%; + background-color: #ecf0f5; + z-index: 800; } - .main-footer { - background: #fff; - padding: 15px; - color: #444; - border-top: 1px solid #d2d6de; + background: #fff; + padding: 15px; + color: #444; + border-top: 1px solid #d2d6de; } - /* Fixed layout */ .fixed .main-header, .fixed .main-sidebar, .fixed .left-side { - position: fixed; + position: fixed; } - .fixed .main-header { - top: 0; - right: 0; - left: 0; + top: 0; + right: 0; + left: 0; } - .fixed .content-wrapper, .fixed .right-side { - padding-top: 50px; + padding-top: 50px; } - @media (max-width: 767px) { - .fixed .content-wrapper, - .fixed .right-side { - padding-top: 100px; - } + .fixed .content-wrapper, + .fixed .right-side { + padding-top: 100px; + } } - .fixed.layout-boxed .wrapper { - max-width: 100%; + max-width: 100%; } - -body.hold-transition .content-wrapper, -body.hold-transition .right-side, -body.hold-transition .main-footer, -body.hold-transition .main-sidebar, -body.hold-transition .left-side, -body.hold-transition .main-header .navbar, -body.hold-transition .main-header .logo { - /* Fix for IE */ - -webkit-transition: none; - -o-transition: none; - transition: none; +.fixed .wrapper { + overflow: hidden; +} +.hold-transition .content-wrapper, +.hold-transition .right-side, +.hold-transition .main-footer, +.hold-transition .main-sidebar, +.hold-transition .left-side, +.hold-transition .main-header .navbar, +.hold-transition .main-header .logo, +.hold-transition .menu-open .fa-angle-left { + /* Fix for IE */ + -webkit-transition: none; + -o-transition: none; + transition: none; } - /* Content */ .content { - min-height: 250px; - padding: 15px; - margin-right: auto; - margin-left: auto; - padding-left: 15px; - padding-right: 15px; + min-height: 250px; + padding: 15px; + margin-right: auto; + margin-left: auto; + padding-left: 15px; + padding-right: 15px; } - /* H1 - H6 font */ h1, h2, @@ -186,2710 +189,2373 @@ h6, .h4, .h5, .h6 { - font-family: 'Source Sans Pro', sans-serif; + font-family: 'Source Sans Pro', sans-serif; } - /* General Links */ a { - color: #3c8dbc; + color: #337ab7; } - a:hover, a:active, a:focus { - outline: none; - text-decoration: none; - color: #72afd2; + outline: none; + text-decoration: none; + color: #23527c; } - /* Page Header */ .page-header { - margin: 10px 0 20px 0; - font-size: 22px; + margin: 10px 0 20px 0; + font-size: 22px; } - .page-header > small { - color: #666; - display: block; - margin-top: 5px; + color: #666; + display: block; + margin-top: 5px; } - /* * Component: Main Header * ---------------------- */ .main-header { - position: relative; - max-height: 100px; - z-index: 1030; + position: relative; + max-height: 100px; + z-index: 1030; } - .main-header .navbar { - -webkit-transition: margin-left 0.3s ease-in-out; - -o-transition: margin-left 0.3s ease-in-out; - transition: margin-left 0.3s ease-in-out; - margin-bottom: 0; - margin-left: 230px; - border: none; - min-height: 50px; - border-radius: 0; + -webkit-transition: margin-left 0.3s ease-in-out; + -o-transition: margin-left 0.3s ease-in-out; + transition: margin-left 0.3s ease-in-out; + margin-bottom: 0; + margin-left: 230px; + border: none; + min-height: 50px; + border-radius: 0; } - .layout-top-nav .main-header .navbar { - margin-left: 0; + margin-left: 0; } - .main-header #navbar-search-input.form-control { - background: rgba(255, 255, 255, 0.2); - border-color: transparent; + background: rgba(255, 255, 255, 0.2); + border-color: transparent; } - .main-header #navbar-search-input.form-control:focus, .main-header #navbar-search-input.form-control:active { - border-color: rgba(0, 0, 0, 0.1); - background: rgba(255, 255, 255, 0.9); + border-color: rgba(0, 0, 0, 0.1); + background: rgba(255, 255, 255, 0.9); } - .main-header #navbar-search-input.form-control::-moz-placeholder { - color: #ccc; - opacity: 1; + color: #ccc; + opacity: 1; } - .main-header #navbar-search-input.form-control:-ms-input-placeholder { - color: #ccc; + color: #ccc; } - .main-header #navbar-search-input.form-control::-webkit-input-placeholder { - color: #ccc; + color: #ccc; } - .main-header .navbar-custom-menu, .main-header .navbar-right { - float: right; + float: right; } - @media (max-width: 991px) { - .main-header .navbar-custom-menu a, - .main-header .navbar-right a { - color: inherit; - background: transparent; - } + .main-header .navbar-custom-menu a, + .main-header .navbar-right a { + color: inherit; + background: transparent; + } } - @media (max-width: 767px) { - .main-header .navbar-right { - float: none; - } - - .navbar-collapse .main-header .navbar-right { - margin: 7.5px -15px; - } - - .main-header .navbar-right > li { - color: inherit; - border: 0; - } + .main-header .navbar-right { + float: none; + } + .navbar-collapse .main-header .navbar-right { + margin: 7.5px -15px; + } + .main-header .navbar-right > li { + color: inherit; + border: 0; + } } - .main-header .sidebar-toggle { - float: left; - background-color: transparent; - background-image: none; - padding: 15px 15px; - font-family: fontAwesome; + float: left; + background-color: transparent; + background-image: none; + padding: 15px 15px; + font-family: fontAwesome; } - .main-header .sidebar-toggle:before { - content: "\f0c9"; + content: "\f0c9"; } - .main-header .sidebar-toggle:hover { - color: #fff; + color: #fff; } - .main-header .sidebar-toggle:focus, .main-header .sidebar-toggle:active { - background: transparent; + background: transparent; } - .main-header .sidebar-toggle .icon-bar { - display: none; + display: none; } - .main-header .navbar .nav > li.user > a > .fa, .main-header .navbar .nav > li.user > a > .glyphicon, .main-header .navbar .nav > li.user > a > .ion { - margin-right: 5px; + margin-right: 5px; } - .main-header .navbar .nav > li > a > .label { - position: absolute; - top: 9px; - right: 7px; - text-align: center; - font-size: 9px; - padding: 2px 3px; - line-height: .9; + position: absolute; + top: 9px; + right: 7px; + text-align: center; + font-size: 9px; + padding: 2px 3px; + line-height: .9; } - .main-header .logo { - -webkit-transition: width 0.3s ease-in-out; - -o-transition: width 0.3s ease-in-out; - transition: width 0.3s ease-in-out; - display: block; - float: left; - height: 50px; - font-size: 20px; - line-height: 50px; - text-align: center; - width: 230px; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - padding: 0 15px; - font-weight: 300; - overflow: hidden; + -webkit-transition: width 0.3s ease-in-out; + -o-transition: width 0.3s ease-in-out; + transition: width 0.3s ease-in-out; + display: block; + float: left; + height: 50px; + font-size: 20px; + line-height: 50px; + text-align: center; + width: 230px; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + padding: 0 15px; + font-weight: 300; + overflow: hidden; } - .main-header .logo .logo-lg { - display: block; + display: block; } - .main-header .logo .logo-mini { - display: none; + display: none; } - .main-header .navbar-brand { - color: #fff; + color: #fff; } - .content-header { - position: relative; - padding: 15px 15px 0 15px; + position: relative; + padding: 15px 15px 0 15px; } - .content-header > h1 { - margin: 0; - font-size: 24px; + margin: 0; + font-size: 24px; } - .content-header > h1 > small { - font-size: 15px; - display: inline-block; - padding-left: 4px; - font-weight: 300; + font-size: 15px; + display: inline-block; + padding-left: 4px; + font-weight: 300; } - .content-header > .breadcrumb { - float: right; - background: transparent; - margin-top: 0; - margin-bottom: 0; - font-size: 12px; - padding: 7px 5px; - position: absolute; - top: 15px; - right: 10px; - border-radius: 2px; + float: right; + background: transparent; + margin-top: 0; + margin-bottom: 0; + font-size: 12px; + padding: 7px 5px; + position: absolute; + top: 15px; + right: 10px; + border-radius: 2px; } - .content-header > .breadcrumb > li > a { - color: #444; - text-decoration: none; - display: inline-block; + color: #444; + text-decoration: none; + display: inline-block; } - .content-header > .breadcrumb > li > a > .fa, .content-header > .breadcrumb > li > a > .glyphicon, .content-header > .breadcrumb > li > a > .ion { - margin-right: 5px; + margin-right: 5px; } - .content-header > .breadcrumb > li + li:before { - content: '>\00a0'; + content: '>\00a0'; } - @media (max-width: 991px) { - .content-header > .breadcrumb { - position: relative; - margin-top: 5px; - top: 0; - right: 0; - float: none; - background: #d2d6de; - padding-left: 10px; - } - - .content-header > .breadcrumb li:before { - color: #97a0b3; - } + .content-header > .breadcrumb { + position: relative; + margin-top: 5px; + top: 0; + right: 0; + float: none; + background: #d2d6de; + padding-left: 10px; + } + .content-header > .breadcrumb li:before { + color: #97a0b3; + } } - .navbar-toggle { - color: #fff; - border: 0; + color: #fff; + border: 0; + margin: 0; + padding: 15px 15px; +} +@media (max-width: 991px) { + .navbar-custom-menu .navbar-nav > li { + float: left; + } + .navbar-custom-menu .navbar-nav { margin: 0; - padding: 15px 15px; + float: left; + } + .navbar-custom-menu .navbar-nav > li > a { + padding-top: 15px; + padding-bottom: 15px; + line-height: 20px; + } } - -@media (max-width: 991px) { - .navbar-custom-menu .navbar-nav > li { - float: left; - } - - .navbar-custom-menu .navbar-nav { - margin: 0; - float: left; - } - - .navbar-custom-menu .navbar-nav > li > a { - padding-top: 15px; - padding-bottom: 15px; - line-height: 20px; - } -} - @media (max-width: 767px) { - .main-header { - position: relative; - } - - .main-header .logo, - .main-header .navbar { - width: 100%; - float: none; - } - - .main-header .navbar { - margin: 0; - } - - .main-header .navbar-custom-menu { - float: right; - } + .main-header { + position: relative; + } + .main-header .logo, + .main-header .navbar { + width: 100%; + float: none; + } + .main-header .navbar { + margin: 0; + } + .main-header .navbar-custom-menu { + float: right; + } } - @media (max-width: 991px) { - .navbar-collapse.pull-left { - float: none !important; - } - - .navbar-collapse.pull-left + .navbar-custom-menu { - display: block; - position: absolute; - top: 0; - right: 40px; - } + .navbar-collapse.pull-left { + float: none !important; + } + .navbar-collapse.pull-left + .navbar-custom-menu { + display: block; + position: absolute; + top: 0; + right: 40px; + } } - /* * Component: Sidebar * ------------------ */ -.main-sidebar, -.left-side { - position: absolute; - top: 0; - left: 0; - padding-top: 50px; - min-height: 100%; - width: 230px; - z-index: 810; - -webkit-transition: -webkit-transform 0.3s ease-in-out, width 0.3s ease-in-out; - -moz-transition: -moz-transform 0.3s ease-in-out, width 0.3s ease-in-out; - -o-transition: -o-transform 0.3s ease-in-out, width 0.3s ease-in-out; - transition: transform 0.3s ease-in-out, width 0.3s ease-in-out; +.main-sidebar { + position: absolute; + top: 0; + left: 0; + padding-top: 50px; + min-height: 100%; + width: 230px; + z-index: 810; + -webkit-transition: -webkit-transform 0.3s ease-in-out, width 0.3s ease-in-out; + -moz-transition: -moz-transform 0.3s ease-in-out, width 0.3s ease-in-out; + -o-transition: -o-transform 0.3s ease-in-out, width 0.3s ease-in-out; + transition: transform 0.3s ease-in-out, width 0.3s ease-in-out; } - @media (max-width: 767px) { - .main-sidebar, - .left-side { - padding-top: 100px; - } + .main-sidebar { + padding-top: 100px; + } } - @media (max-width: 767px) { - .main-sidebar, - .left-side { - -webkit-transform: translate(-230px, 0); - -ms-transform: translate(-230px, 0); - -o-transform: translate(-230px, 0); - transform: translate(-230px, 0); - } + .main-sidebar { + -webkit-transform: translate(-230px, 0); + -ms-transform: translate(-230px, 0); + -o-transform: translate(-230px, 0); + transform: translate(-230px, 0); + } } - @media (min-width: 768px) { - .sidebar-collapse .main-sidebar, - .sidebar-collapse .left-side { - -webkit-transform: translate(-230px, 0); - -ms-transform: translate(-230px, 0); - -o-transform: translate(-230px, 0); - transform: translate(-230px, 0); - } + .sidebar-collapse .main-sidebar { + -webkit-transform: translate(-230px, 0); + -ms-transform: translate(-230px, 0); + -o-transform: translate(-230px, 0); + transform: translate(-230px, 0); + } } - @media (max-width: 767px) { - .sidebar-open .main-sidebar, - .sidebar-open .left-side { - -webkit-transform: translate(0, 0); - -ms-transform: translate(0, 0); - -o-transform: translate(0, 0); - transform: translate(0, 0); - } + .sidebar-open .main-sidebar { + -webkit-transform: translate(0, 0); + -ms-transform: translate(0, 0); + -o-transform: translate(0, 0); + transform: translate(0, 0); + } } - .sidebar { - padding-bottom: 10px; + padding-bottom: 10px; } - .sidebar-form input:focus { - border-color: transparent; + border-color: transparent; } - .user-panel { - position: relative; - width: 100%; - padding: 10px; - overflow: hidden; + position: relative; + width: 100%; + padding: 10px; + overflow: hidden; } - .user-panel:before, .user-panel:after { - content: " "; - display: table; + content: " "; + display: table; } - .user-panel:after { - clear: both; + clear: both; +} +.user-panel:before, +.user-panel:after { + content: " "; + display: table; +} +.user-panel:after { + clear: both; } - .user-panel > .image > img { - width: 100%; - max-width: 45px; - height: auto; + width: 100%; + max-width: 45px; + height: auto; } - .user-panel > .info { - padding: 5px 5px 5px 15px; - line-height: 1; - position: absolute; - left: 55px; + padding: 5px 5px 5px 15px; + line-height: 1; + position: absolute; + left: 55px; } - .user-panel > .info > p { - font-weight: 600; - margin-bottom: 9px; + font-weight: 600; + margin-bottom: 9px; } - .user-panel > .info > a { - text-decoration: none; - padding-right: 5px; - margin-top: 3px; - font-size: 11px; + text-decoration: none; + padding-right: 5px; + margin-top: 3px; + font-size: 11px; } - .user-panel > .info > a > .fa, .user-panel > .info > a > .ion, .user-panel > .info > a > .glyphicon { - margin-right: 3px; + margin-right: 3px; } - .sidebar-menu { - list-style: none; - margin: 0; - padding: 0; + list-style: none; + margin: 0; + padding: 0; } - .sidebar-menu > li { - position: relative; - margin: 0; - padding: 0; + position: relative; + margin: 0; + padding: 0; } - .sidebar-menu > li > a { - padding: 12px 5px 12px 15px; - display: block; + padding: 12px 5px 12px 15px; + display: block; } - .sidebar-menu > li > a > .fa, .sidebar-menu > li > a > .glyphicon, .sidebar-menu > li > a > .ion { - width: 20px; + width: 20px; } - .sidebar-menu > li .label, .sidebar-menu > li .badge { - margin-right: 5px; + margin-right: 5px; } - .sidebar-menu > li .badge { - margin-top: 3px; + margin-top: 3px; } - .sidebar-menu li.header { - padding: 10px 25px 10px 15px; - font-size: 12px; + padding: 10px 25px 10px 15px; + font-size: 12px; } - .sidebar-menu li > a > .fa-angle-left, .sidebar-menu li > a > .pull-right-container > .fa-angle-left { - width: auto; - height: auto; - padding: 0; - margin-right: 10px; + width: auto; + height: auto; + padding: 0; + margin-right: 10px; + -webkit-transition: transform 0.5s ease; + -o-transition: transform 0.5s ease; + transition: transform 0.5s ease; } - -.sidebar-menu li.active > a > .fa-angle-left, -.sidebar-menu li.active > a > .pull-right-container > .fa-angle-left { - -webkit-transform: rotate(-90deg); - -ms-transform: rotate(-90deg); - -o-transform: rotate(-90deg); - transform: rotate(-90deg); +.sidebar-menu li > a > .fa-angle-left { + position: absolute; + top: 50%; + right: 10px; + margin-top: -8px; } - -.sidebar-menu li.active > .treeview-menu { - display: block; +.sidebar-menu .menu-open > a > .fa-angle-left, +.sidebar-menu .menu-open > a > .pull-right-container > .fa-angle-left { + -webkit-transform: rotate(-90deg); + -ms-transform: rotate(-90deg); + -o-transform: rotate(-90deg); + transform: rotate(-90deg); } - -.sidebar-menu .treeview-menu { - display: none; - list-style: none; - padding: 0; - margin: 0; - padding-left: 5px; +.sidebar-menu .active > .treeview-menu { + display: block; } - -.sidebar-menu .treeview-menu .treeview-menu { - padding-left: 20px; -} - -.sidebar-menu .treeview-menu > li { - margin: 0; -} - -.sidebar-menu .treeview-menu > li > a { - padding: 5px 5px 5px 15px; - display: block; - font-size: 14px; -} - -.sidebar-menu .treeview-menu > li > a > .fa, -.sidebar-menu .treeview-menu > li > a > .glyphicon, -.sidebar-menu .treeview-menu > li > a > .ion { - width: 20px; -} - -.sidebar-menu .treeview-menu > li > a > .pull-right-container > .fa-angle-left, -.sidebar-menu .treeview-menu > li > a > .pull-right-container > .fa-angle-down, -.sidebar-menu .treeview-menu > li > a > .fa-angle-left, -.sidebar-menu .treeview-menu > li > a > .fa-angle-down { - width: auto; -} - /* * Component: Sidebar Mini */ @media (min-width: 768px) { - .sidebar-mini.sidebar-collapse .content-wrapper, - .sidebar-mini.sidebar-collapse .right-side, - .sidebar-mini.sidebar-collapse .main-footer { - margin-left: 50px !important; - z-index: 840; - } - - .sidebar-mini.sidebar-collapse .main-sidebar { - -webkit-transform: translate(0, 0); - -ms-transform: translate(0, 0); - -o-transform: translate(0, 0); - transform: translate(0, 0); - width: 50px !important; - z-index: 850; - } - - .sidebar-mini.sidebar-collapse .sidebar-menu > li { - position: relative; - } - - .sidebar-mini.sidebar-collapse .sidebar-menu > li > a { - margin-right: 0; - } - - .sidebar-mini.sidebar-collapse .sidebar-menu > li > a > span { - border-top-right-radius: 4px; - } - - .sidebar-mini.sidebar-collapse .sidebar-menu > li:not(.treeview) > a > span { - border-bottom-right-radius: 4px; - } - - .sidebar-mini.sidebar-collapse .sidebar-menu > li > .treeview-menu { - padding-top: 5px; - padding-bottom: 5px; - border-bottom-right-radius: 4px; - } - - .sidebar-mini.sidebar-collapse .sidebar-menu > li:hover > a > span:not(.pull-right), - .sidebar-mini.sidebar-collapse .sidebar-menu > li:hover > .treeview-menu { - display: block !important; - position: absolute; - width: 180px; - left: 50px; - } - - .sidebar-mini.sidebar-collapse .sidebar-menu > li:hover > a > span { - top: 0; - margin-left: -3px; - padding: 12px 5px 12px 20px; - background-color: inherit; - } - - .sidebar-mini.sidebar-collapse .sidebar-menu > li:hover > a > .pull-right-container { - float: right; - width: auto !important; - left: 200px !important; - top: 10px !important; - } - - .sidebar-mini.sidebar-collapse .sidebar-menu > li:hover > a > .pull-right-container > .label:not(:first-of-type) { - display: none; - } - - .sidebar-mini.sidebar-collapse .sidebar-menu > li:hover > .treeview-menu { - top: 44px; - margin-left: 0; - } - - .sidebar-mini.sidebar-collapse .main-sidebar .user-panel > .info, - .sidebar-mini.sidebar-collapse .sidebar-form, - .sidebar-mini.sidebar-collapse .sidebar-menu > li > a > span, - .sidebar-mini.sidebar-collapse .sidebar-menu > li > .treeview-menu, - .sidebar-mini.sidebar-collapse .sidebar-menu > li > a > .pull-right, - .sidebar-mini.sidebar-collapse .sidebar-menu li.header { - display: none !important; - -webkit-transform: translateZ(0); - } - - .sidebar-mini.sidebar-collapse .main-header .logo { - width: 50px; - } - - .sidebar-mini.sidebar-collapse .main-header .logo > .logo-mini { - display: block; - margin-left: -15px; - margin-right: -15px; - font-size: 18px; - } - - .sidebar-mini.sidebar-collapse .main-header .logo > .logo-lg { - display: none; - } - - .sidebar-mini.sidebar-collapse .main-header .navbar { - margin-left: 50px; - } + .sidebar-mini.sidebar-collapse .content-wrapper, + .sidebar-mini.sidebar-collapse .right-side, + .sidebar-mini.sidebar-collapse .main-footer { + margin-left: 50px !important; + z-index: 840; + } + .sidebar-mini.sidebar-collapse .main-sidebar { + -webkit-transform: translate(0, 0); + -ms-transform: translate(0, 0); + -o-transform: translate(0, 0); + transform: translate(0, 0); + width: 50px !important; + z-index: 850; + } + .sidebar-mini.sidebar-collapse .sidebar-menu > li { + position: relative; + } + .sidebar-mini.sidebar-collapse .sidebar-menu > li > a { + margin-right: 0; + } + .sidebar-mini.sidebar-collapse .sidebar-menu > li > a > span { + border-top-right-radius: 4px; + } + .sidebar-mini.sidebar-collapse .sidebar-menu > li:not(.treeview) > a > span { + border-bottom-right-radius: 4px; + } + .sidebar-mini.sidebar-collapse .sidebar-menu > li > .treeview-menu { + padding-top: 5px; + padding-bottom: 5px; + border-bottom-right-radius: 4px; + } + .sidebar-mini.sidebar-collapse .main-sidebar .user-panel > .info, + .sidebar-mini.sidebar-collapse .sidebar-form, + .sidebar-mini.sidebar-collapse .sidebar-menu > li > a > span, + .sidebar-mini.sidebar-collapse .sidebar-menu > li > .treeview-menu, + .sidebar-mini.sidebar-collapse .sidebar-menu > li > a > .pull-right, + .sidebar-mini.sidebar-collapse .sidebar-menu li.header { + display: none !important; + -webkit-transform: translateZ(0); + } + .sidebar-mini.sidebar-collapse .main-header .logo { + width: 50px; + } + .sidebar-mini.sidebar-collapse .main-header .logo > .logo-mini { + display: block; + margin-left: -15px; + margin-right: -15px; + font-size: 18px; + } + .sidebar-mini.sidebar-collapse .main-header .logo > .logo-lg { + display: none; + } + .sidebar-mini.sidebar-collapse .main-header .navbar { + margin-left: 50px; + } +} +.sidebar-mini:not(.sidebar-mini-expand-feature).sidebar-collapse .sidebar-menu > li:hover > a > span:not(.pull-right), +.sidebar-mini:not(.sidebar-mini-expand-feature).sidebar-collapse .sidebar-menu > li:hover > .treeview-menu { + display: block !important; + position: absolute; + width: 180px; + left: 50px; +} +.sidebar-mini:not(.sidebar-mini-expand-feature).sidebar-collapse .sidebar-menu > li:hover > a > span { + top: 0; + margin-left: -3px; + padding: 12px 5px 12px 20px; + background-color: inherit; +} +.sidebar-mini:not(.sidebar-mini-expand-feature).sidebar-collapse .sidebar-menu > li:hover > a > .pull-right-container { + position: relative !important; + float: right; + width: auto !important; + left: 180px !important; + top: -22px !important; + z-index: 900; +} +.sidebar-mini:not(.sidebar-mini-expand-feature).sidebar-collapse .sidebar-menu > li:hover > a > .pull-right-container > .label:not(:first-of-type) { + display: none; +} +.sidebar-mini:not(.sidebar-mini-expand-feature).sidebar-collapse .sidebar-menu > li:hover > .treeview-menu { + top: 44px; + margin-left: 0; +} +.sidebar-expanded-on-hover .main-footer, +.sidebar-expanded-on-hover .content-wrapper { + margin-left: 50px; +} +.sidebar-expanded-on-hover .main-sidebar { + box-shadow: 3px 0 8px rgba(0, 0, 0, 0.125); } - .sidebar-menu, .main-sidebar .user-panel, .sidebar-menu > li.header { - white-space: nowrap; - overflow: hidden; + white-space: nowrap; + overflow: hidden; } - .sidebar-menu:hover { - overflow: visible; + overflow: visible; } - .sidebar-form, .sidebar-menu > li.header { - overflow: hidden; - text-overflow: clip; + overflow: hidden; + text-overflow: clip; } - .sidebar-menu li > a { - position: relative; + position: relative; } - .sidebar-menu li > a > .pull-right-container { - position: absolute; - right: 10px; - top: 50%; - margin-top: -7px; + position: absolute; + right: 10px; + top: 50%; + margin-top: -7px; } - /* * Component: Control sidebar. By default, this is the right sidebar. */ .control-sidebar-bg { - position: fixed; - z-index: 1000; - bottom: 0; + position: fixed; + z-index: 1000; + bottom: 0; } - .control-sidebar-bg, .control-sidebar { - top: 0; - right: -230px; - width: 230px; - -webkit-transition: right 0.3s ease-in-out; - -o-transition: right 0.3s ease-in-out; - transition: right 0.3s ease-in-out; + top: 0; + right: -230px; + width: 230px; + -webkit-transition: right 0.3s ease-in-out; + -o-transition: right 0.3s ease-in-out; + transition: right 0.3s ease-in-out; } - .control-sidebar { - position: absolute; - padding-top: 50px; - z-index: 1010; + position: absolute; + padding-top: 50px; + z-index: 1010; } - @media (max-width: 768px) { - .control-sidebar { - padding-top: 100px; - } + .control-sidebar { + padding-top: 100px; + } } - .control-sidebar > .tab-content { - padding: 10px 15px; + padding: 10px 15px; } - .control-sidebar.control-sidebar-open, .control-sidebar.control-sidebar-open + .control-sidebar-bg { - right: 0; + right: 0; } - .control-sidebar-open .control-sidebar-bg, .control-sidebar-open .control-sidebar { - right: 0; + right: 0; } - @media (min-width: 768px) { - .control-sidebar-open .content-wrapper, - .control-sidebar-open .right-side, - .control-sidebar-open .main-footer { - margin-right: 230px; - } + .control-sidebar-open .content-wrapper, + .control-sidebar-open .right-side, + .control-sidebar-open .main-footer { + margin-right: 230px; + } +} +.fixed .control-sidebar { + position: fixed; + height: 100%; + overflow-y: auto; + padding-bottom: 50px; } - .nav-tabs.control-sidebar-tabs > li:first-of-type > a, .nav-tabs.control-sidebar-tabs > li:first-of-type > a:hover, .nav-tabs.control-sidebar-tabs > li:first-of-type > a:focus { - border-left-width: 0; + border-left-width: 0; } - .nav-tabs.control-sidebar-tabs > li > a { - border-radius: 0; + border-radius: 0; } - .nav-tabs.control-sidebar-tabs > li > a, .nav-tabs.control-sidebar-tabs > li > a:hover { - border-top: none; - border-right: none; - border-left: 1px solid transparent; - border-bottom: 1px solid transparent; + border-top: none; + border-right: none; + border-left: 1px solid transparent; + border-bottom: 1px solid transparent; } - .nav-tabs.control-sidebar-tabs > li > a .icon { - font-size: 16px; + font-size: 16px; } - .nav-tabs.control-sidebar-tabs > li.active > a, .nav-tabs.control-sidebar-tabs > li.active > a:hover, .nav-tabs.control-sidebar-tabs > li.active > a:focus, .nav-tabs.control-sidebar-tabs > li.active > a:active { - border-top: none; - border-right: none; - border-bottom: none; + border-top: none; + border-right: none; + border-bottom: none; } - @media (max-width: 768px) { - .nav-tabs.control-sidebar-tabs { - display: table; - } - - .nav-tabs.control-sidebar-tabs > li { - display: table-cell; - } + .nav-tabs.control-sidebar-tabs { + display: table; + } + .nav-tabs.control-sidebar-tabs > li { + display: table-cell; + } } - .control-sidebar-heading { - font-weight: 400; - font-size: 16px; - padding: 10px 0; - margin-bottom: 10px; + font-weight: 400; + font-size: 16px; + padding: 10px 0; + margin-bottom: 10px; } - .control-sidebar-subheading { - display: block; - font-weight: 400; - font-size: 14px; + display: block; + font-weight: 400; + font-size: 14px; } - .control-sidebar-menu { - list-style: none; - padding: 0; - margin: 0 -15px; + list-style: none; + padding: 0; + margin: 0 -15px; } - .control-sidebar-menu > li > a { - display: block; - padding: 10px 15px; + display: block; + padding: 10px 15px; } - .control-sidebar-menu > li > a:before, .control-sidebar-menu > li > a:after { - content: " "; - display: table; + content: " "; + display: table; } - .control-sidebar-menu > li > a:after { - clear: both; + clear: both; +} +.control-sidebar-menu > li > a:before, +.control-sidebar-menu > li > a:after { + content: " "; + display: table; +} +.control-sidebar-menu > li > a:after { + clear: both; } - .control-sidebar-menu > li > a > .control-sidebar-subheading { - margin-top: 0; + margin-top: 0; } - .control-sidebar-menu .menu-icon { - float: left; - width: 35px; - height: 35px; - border-radius: 50%; - text-align: center; - line-height: 35px; + float: left; + width: 35px; + height: 35px; + border-radius: 50%; + text-align: center; + line-height: 35px; } - .control-sidebar-menu .menu-info { - margin-left: 45px; - margin-top: 3px; + margin-left: 45px; + margin-top: 3px; } - .control-sidebar-menu .menu-info > .control-sidebar-subheading { - margin: 0; + margin: 0; } - .control-sidebar-menu .menu-info > p { - margin: 0; - font-size: 11px; + margin: 0; + font-size: 11px; } - .control-sidebar-menu .progress { - margin: 0; + margin: 0; } - .control-sidebar-dark { - color: #b8c7ce; + color: #b8c7ce; } - .control-sidebar-dark, .control-sidebar-dark + .control-sidebar-bg { - background: #222d32; + background: #222d32; } - .control-sidebar-dark .nav-tabs.control-sidebar-tabs { - border-bottom: #1c2529; + border-bottom: #1c2529; } - .control-sidebar-dark .nav-tabs.control-sidebar-tabs > li > a { - background: #181f23; - color: #b8c7ce; + background: #181f23; + color: #b8c7ce; } - .control-sidebar-dark .nav-tabs.control-sidebar-tabs > li > a, .control-sidebar-dark .nav-tabs.control-sidebar-tabs > li > a:hover, .control-sidebar-dark .nav-tabs.control-sidebar-tabs > li > a:focus { - border-left-color: #141a1d; - border-bottom-color: #141a1d; + border-left-color: #141a1d; + border-bottom-color: #141a1d; } - .control-sidebar-dark .nav-tabs.control-sidebar-tabs > li > a:hover, .control-sidebar-dark .nav-tabs.control-sidebar-tabs > li > a:focus, .control-sidebar-dark .nav-tabs.control-sidebar-tabs > li > a:active { - background: #1c2529; + background: #1c2529; } - .control-sidebar-dark .nav-tabs.control-sidebar-tabs > li > a:hover { - color: #fff; + color: #fff; } - .control-sidebar-dark .nav-tabs.control-sidebar-tabs > li.active > a, .control-sidebar-dark .nav-tabs.control-sidebar-tabs > li.active > a:hover, .control-sidebar-dark .nav-tabs.control-sidebar-tabs > li.active > a:focus, .control-sidebar-dark .nav-tabs.control-sidebar-tabs > li.active > a:active { - background: #222d32; - color: #fff; + background: #222d32; + color: #fff; } - .control-sidebar-dark .control-sidebar-heading, .control-sidebar-dark .control-sidebar-subheading { - color: #fff; + color: #fff; } - .control-sidebar-dark .control-sidebar-menu > li > a:hover { - background: #1e282c; + background: #1e282c; } - .control-sidebar-dark .control-sidebar-menu > li > a .menu-info > p { - color: #b8c7ce; + color: #b8c7ce; } - .control-sidebar-light { - color: #5e5e5e; + color: #5e5e5e; } - .control-sidebar-light, .control-sidebar-light + .control-sidebar-bg { - background: #f9fafc; - border-left: 1px solid #d2d6de; + background: #f9fafc; + border-left: 1px solid #d2d6de; } - .control-sidebar-light .nav-tabs.control-sidebar-tabs { - border-bottom: #d2d6de; + border-bottom: #d2d6de; } - .control-sidebar-light .nav-tabs.control-sidebar-tabs > li > a { - background: #e8ecf4; - color: #444444; + background: #e8ecf4; + color: #444444; } - .control-sidebar-light .nav-tabs.control-sidebar-tabs > li > a, .control-sidebar-light .nav-tabs.control-sidebar-tabs > li > a:hover, .control-sidebar-light .nav-tabs.control-sidebar-tabs > li > a:focus { - border-left-color: #d2d6de; - border-bottom-color: #d2d6de; + border-left-color: #d2d6de; + border-bottom-color: #d2d6de; } - .control-sidebar-light .nav-tabs.control-sidebar-tabs > li > a:hover, .control-sidebar-light .nav-tabs.control-sidebar-tabs > li > a:focus, .control-sidebar-light .nav-tabs.control-sidebar-tabs > li > a:active { - background: #eff1f7; + background: #eff1f7; } - .control-sidebar-light .nav-tabs.control-sidebar-tabs > li.active > a, .control-sidebar-light .nav-tabs.control-sidebar-tabs > li.active > a:hover, .control-sidebar-light .nav-tabs.control-sidebar-tabs > li.active > a:focus, .control-sidebar-light .nav-tabs.control-sidebar-tabs > li.active > a:active { - background: #f9fafc; - color: #111; + background: #f9fafc; + color: #111; } - .control-sidebar-light .control-sidebar-heading, .control-sidebar-light .control-sidebar-subheading { - color: #111; + color: #111; } - .control-sidebar-light .control-sidebar-menu { - margin-left: -14px; + margin-left: -14px; } - .control-sidebar-light .control-sidebar-menu > li > a:hover { - background: #f4f4f5; + background: #f4f4f5; } - .control-sidebar-light .control-sidebar-menu > li > a .menu-info > p { - color: #5e5e5e; + color: #5e5e5e; } - /* * Component: Dropdown menus * ------------------------- */ /*Dropdowns in general*/ .dropdown-menu { - box-shadow: none; - border-color: #eee; + box-shadow: none; + border-color: #eee; } - .dropdown-menu > li > a { - color: #777; + color: #777; } - .dropdown-menu > li > a > .glyphicon, .dropdown-menu > li > a > .fa, .dropdown-menu > li > a > .ion { - margin-right: 10px; + margin-right: 10px; } - .dropdown-menu > li > a:hover { - background-color: #e1e3e9; - color: #333; + background-color: #e1e3e9; + color: #333; } - .dropdown-menu > .divider { - background-color: #eee; + background-color: #eee; } - .navbar-nav > .notifications-menu > .dropdown-menu, .navbar-nav > .messages-menu > .dropdown-menu, .navbar-nav > .tasks-menu > .dropdown-menu { - width: 280px; - padding: 0 0 0 0; - margin: 0; - top: 100%; + width: 280px; + padding: 0 0 0 0; + margin: 0; + top: 100%; } - .navbar-nav > .notifications-menu > .dropdown-menu > li, .navbar-nav > .messages-menu > .dropdown-menu > li, .navbar-nav > .tasks-menu > .dropdown-menu > li { - position: relative; + position: relative; } - .navbar-nav > .notifications-menu > .dropdown-menu > li.header, .navbar-nav > .messages-menu > .dropdown-menu > li.header, .navbar-nav > .tasks-menu > .dropdown-menu > li.header { - border-top-left-radius: 4px; - border-top-right-radius: 4px; - border-bottom-right-radius: 0; - border-bottom-left-radius: 0; - background-color: #ffffff; - padding: 7px 10px; - border-bottom: 1px solid #f4f4f4; - color: #444444; - font-size: 14px; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; + background-color: #ffffff; + padding: 7px 10px; + border-bottom: 1px solid #f4f4f4; + color: #444444; + font-size: 14px; } - .navbar-nav > .notifications-menu > .dropdown-menu > li.footer > a, .navbar-nav > .messages-menu > .dropdown-menu > li.footer > a, .navbar-nav > .tasks-menu > .dropdown-menu > li.footer > a { - border-top-left-radius: 0; - border-top-right-radius: 0; - border-bottom-right-radius: 4px; - border-bottom-left-radius: 4px; - font-size: 12px; - background-color: #fff; - padding: 7px 10px; - border-bottom: 1px solid #eeeeee; - color: #444 !important; - text-align: center; + border-top-left-radius: 0; + border-top-right-radius: 0; + border-bottom-right-radius: 4px; + border-bottom-left-radius: 4px; + font-size: 12px; + background-color: #fff; + padding: 7px 10px; + border-bottom: 1px solid #eeeeee; + color: #444 !important; + text-align: center; } - @media (max-width: 991px) { - .navbar-nav > .notifications-menu > .dropdown-menu > li.footer > a, - .navbar-nav > .messages-menu > .dropdown-menu > li.footer > a, - .navbar-nav > .tasks-menu > .dropdown-menu > li.footer > a { - background: #fff !important; - color: #444 !important; - } + .navbar-nav > .notifications-menu > .dropdown-menu > li.footer > a, + .navbar-nav > .messages-menu > .dropdown-menu > li.footer > a, + .navbar-nav > .tasks-menu > .dropdown-menu > li.footer > a { + background: #fff !important; + color: #444 !important; + } } - .navbar-nav > .notifications-menu > .dropdown-menu > li.footer > a:hover, .navbar-nav > .messages-menu > .dropdown-menu > li.footer > a:hover, .navbar-nav > .tasks-menu > .dropdown-menu > li.footer > a:hover { - text-decoration: none; - font-weight: normal; + text-decoration: none; + font-weight: normal; } - .navbar-nav > .notifications-menu > .dropdown-menu > li .menu, .navbar-nav > .messages-menu > .dropdown-menu > li .menu, .navbar-nav > .tasks-menu > .dropdown-menu > li .menu { - max-height: 200px; - margin: 0; - padding: 0; - list-style: none; - overflow-x: hidden; + max-height: 200px; + margin: 0; + padding: 0; + list-style: none; + overflow-x: hidden; } - .navbar-nav > .notifications-menu > .dropdown-menu > li .menu > li > a, .navbar-nav > .messages-menu > .dropdown-menu > li .menu > li > a, .navbar-nav > .tasks-menu > .dropdown-menu > li .menu > li > a { - display: block; - white-space: nowrap; - /* Prevent text from breaking */ - border-bottom: 1px solid #f4f4f4; + display: block; + white-space: nowrap; + /* Prevent text from breaking */ + border-bottom: 1px solid #f4f4f4; } - .navbar-nav > .notifications-menu > .dropdown-menu > li .menu > li > a:hover, .navbar-nav > .messages-menu > .dropdown-menu > li .menu > li > a:hover, .navbar-nav > .tasks-menu > .dropdown-menu > li .menu > li > a:hover { - background: #f4f4f4; - text-decoration: none; + background: #f4f4f4; + text-decoration: none; } - .navbar-nav > .notifications-menu > .dropdown-menu > li .menu > li > a { - color: #444444; - overflow: hidden; - text-overflow: ellipsis; - padding: 10px; + color: #444444; + overflow: hidden; + text-overflow: ellipsis; + padding: 10px; } - .navbar-nav > .notifications-menu > .dropdown-menu > li .menu > li > a > .glyphicon, .navbar-nav > .notifications-menu > .dropdown-menu > li .menu > li > a > .fa, .navbar-nav > .notifications-menu > .dropdown-menu > li .menu > li > a > .ion { - width: 20px; + width: 20px; } - .navbar-nav > .messages-menu > .dropdown-menu > li .menu > li > a { - margin: 0; - padding: 10px 10px; + margin: 0; + padding: 10px 10px; } - .navbar-nav > .messages-menu > .dropdown-menu > li .menu > li > a > div > img { - margin: auto 10px auto auto; - width: 40px; - height: 40px; + margin: auto 10px auto auto; + width: 40px; + height: 40px; } - .navbar-nav > .messages-menu > .dropdown-menu > li .menu > li > a > h4 { - padding: 0; - margin: 0 0 0 45px; - color: #444444; - font-size: 15px; - position: relative; + padding: 0; + margin: 0 0 0 45px; + color: #444444; + font-size: 15px; + position: relative; } - .navbar-nav > .messages-menu > .dropdown-menu > li .menu > li > a > h4 > small { - color: #999999; - font-size: 10px; - position: absolute; - top: 0; - right: 0; + color: #999999; + font-size: 10px; + position: absolute; + top: 0; + right: 0; } - .navbar-nav > .messages-menu > .dropdown-menu > li .menu > li > a > p { - margin: 0 0 0 45px; - font-size: 12px; - color: #888888; + margin: 0 0 0 45px; + font-size: 12px; + color: #888888; } - .navbar-nav > .messages-menu > .dropdown-menu > li .menu > li > a:before, .navbar-nav > .messages-menu > .dropdown-menu > li .menu > li > a:after { - content: " "; - display: table; + content: " "; + display: table; } - .navbar-nav > .messages-menu > .dropdown-menu > li .menu > li > a:after { - clear: both; + clear: both; +} +.navbar-nav > .messages-menu > .dropdown-menu > li .menu > li > a:before, +.navbar-nav > .messages-menu > .dropdown-menu > li .menu > li > a:after { + content: " "; + display: table; +} +.navbar-nav > .messages-menu > .dropdown-menu > li .menu > li > a:after { + clear: both; } - .navbar-nav > .tasks-menu > .dropdown-menu > li .menu > li > a { - padding: 10px; + padding: 10px; } - .navbar-nav > .tasks-menu > .dropdown-menu > li .menu > li > a > h3 { - font-size: 14px; - padding: 0; - margin: 0 0 10px 0; - color: #666666; + font-size: 14px; + padding: 0; + margin: 0 0 10px 0; + color: #666666; } - .navbar-nav > .tasks-menu > .dropdown-menu > li .menu > li > a > .progress { - padding: 0; - margin: 0; + padding: 0; + margin: 0; } - .navbar-nav > .user-menu > .dropdown-menu { - border-top-right-radius: 0; - border-top-left-radius: 0; - padding: 1px 0 0 0; - border-top-width: 0; - width: 280px; + border-top-right-radius: 0; + border-top-left-radius: 0; + padding: 1px 0 0 0; + border-top-width: 0; + width: 280px; } - .navbar-nav > .user-menu > .dropdown-menu, .navbar-nav > .user-menu > .dropdown-menu > .user-body { - border-bottom-right-radius: 4px; - border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + border-bottom-left-radius: 4px; } - .navbar-nav > .user-menu > .dropdown-menu > li.user-header { - height: 175px; - padding: 10px; - text-align: center; + height: 175px; + padding: 10px; + text-align: center; } - .navbar-nav > .user-menu > .dropdown-menu > li.user-header > img { - z-index: 5; - height: 90px; - width: 90px; - border: 3px solid; - border-color: transparent; - border-color: rgba(255, 255, 255, 0.2); + z-index: 5; + height: 90px; + width: 90px; + border: 3px solid; + border-color: transparent; + border-color: rgba(255, 255, 255, 0.2); } - .navbar-nav > .user-menu > .dropdown-menu > li.user-header > p { - z-index: 5; - color: #fff; - color: rgba(255, 255, 255, 0.8); - font-size: 17px; - margin-top: 10px; + z-index: 5; + color: #fff; + color: rgba(255, 255, 255, 0.8); + font-size: 17px; + margin-top: 10px; } - .navbar-nav > .user-menu > .dropdown-menu > li.user-header > p > small { - display: block; - font-size: 12px; + display: block; + font-size: 12px; } - .navbar-nav > .user-menu > .dropdown-menu > .user-body { - padding: 15px; - border-bottom: 1px solid #f4f4f4; - border-top: 1px solid #dddddd; + padding: 15px; + border-bottom: 1px solid #f4f4f4; + border-top: 1px solid #dddddd; } - .navbar-nav > .user-menu > .dropdown-menu > .user-body:before, .navbar-nav > .user-menu > .dropdown-menu > .user-body:after { - content: " "; - display: table; + content: " "; + display: table; } - .navbar-nav > .user-menu > .dropdown-menu > .user-body:after { - clear: both; + clear: both; +} +.navbar-nav > .user-menu > .dropdown-menu > .user-body:before, +.navbar-nav > .user-menu > .dropdown-menu > .user-body:after { + content: " "; + display: table; +} +.navbar-nav > .user-menu > .dropdown-menu > .user-body:after { + clear: both; } - .navbar-nav > .user-menu > .dropdown-menu > .user-body a { - color: #444 !important; + color: #444 !important; } - @media (max-width: 991px) { - .navbar-nav > .user-menu > .dropdown-menu > .user-body a { - background: #fff !important; - color: #444 !important; - } + .navbar-nav > .user-menu > .dropdown-menu > .user-body a { + background: #fff !important; + color: #444 !important; + } } - .navbar-nav > .user-menu > .dropdown-menu > .user-footer { - background-color: #f9f9f9; - padding: 10px; + background-color: #f9f9f9; + padding: 10px; } - .navbar-nav > .user-menu > .dropdown-menu > .user-footer:before, .navbar-nav > .user-menu > .dropdown-menu > .user-footer:after { - content: " "; - display: table; + content: " "; + display: table; } - .navbar-nav > .user-menu > .dropdown-menu > .user-footer:after { - clear: both; + clear: both; +} +.navbar-nav > .user-menu > .dropdown-menu > .user-footer:before, +.navbar-nav > .user-menu > .dropdown-menu > .user-footer:after { + content: " "; + display: table; +} +.navbar-nav > .user-menu > .dropdown-menu > .user-footer:after { + clear: both; } - .navbar-nav > .user-menu > .dropdown-menu > .user-footer .btn-default { - color: #666666; + color: #666666; } - @media (max-width: 991px) { - .navbar-nav > .user-menu > .dropdown-menu > .user-footer .btn-default:hover { - background-color: #f9f9f9; - } + .navbar-nav > .user-menu > .dropdown-menu > .user-footer .btn-default:hover { + background-color: #f9f9f9; + } } - .navbar-nav > .user-menu .user-image { - float: left; - width: 25px; - height: 25px; - border-radius: 50%; - margin-right: 10px; - margin-top: -2px; + float: left; + width: 25px; + height: 25px; + border-radius: 50%; + margin-right: 10px; + margin-top: -2px; } - @media (max-width: 767px) { - .navbar-nav > .user-menu .user-image { - float: none; - margin-right: 0; - margin-top: -8px; - line-height: 10px; - } + .navbar-nav > .user-menu .user-image { + float: none; + margin-right: 0; + margin-top: -8px; + line-height: 10px; + } } - /* Add fade animation to dropdown menus by appending the class .animated-dropdown-menu to the .dropdown-menu ul (or ol)*/ .open:not(.dropup) > .animated-dropdown-menu { - backface-visibility: visible !important; - -webkit-animation: flipInX 0.7s both; - -o-animation: flipInX 0.7s both; - animation: flipInX 0.7s both; + backface-visibility: visible !important; + -webkit-animation: flipInX 0.7s both; + -o-animation: flipInX 0.7s both; + animation: flipInX 0.7s both; } - @keyframes flipInX { - 0% { - transform: perspective(400px) rotate3d(1, 0, 0, 90deg); - transition-timing-function: ease-in; - opacity: 0; - } - 40% { - transform: perspective(400px) rotate3d(1, 0, 0, -20deg); - transition-timing-function: ease-in; - } - 60% { - transform: perspective(400px) rotate3d(1, 0, 0, 10deg); - opacity: 1; - } - 80% { - transform: perspective(400px) rotate3d(1, 0, 0, -5deg); - } - 100% { - transform: perspective(400px); - } + 0% { + transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + transition-timing-function: ease-in; + opacity: 0; + } + 40% { + transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + transition-timing-function: ease-in; + } + 60% { + transform: perspective(400px) rotate3d(1, 0, 0, 10deg); + opacity: 1; + } + 80% { + transform: perspective(400px) rotate3d(1, 0, 0, -5deg); + } + 100% { + transform: perspective(400px); + } } - @-webkit-keyframes flipInX { - 0% { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); - -webkit-transition-timing-function: ease-in; - opacity: 0; - } - 40% { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); - -webkit-transition-timing-function: ease-in; - } - 60% { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg); - opacity: 1; - } - 80% { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg); - } - 100% { - -webkit-transform: perspective(400px); - } + 0% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + -webkit-transition-timing-function: ease-in; + opacity: 0; + } + 40% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + -webkit-transition-timing-function: ease-in; + } + 60% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg); + opacity: 1; + } + 80% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg); + } + 100% { + -webkit-transform: perspective(400px); + } } - /* Fix dropdown menu in navbars */ .navbar-custom-menu > .navbar-nav > li { - position: relative; + position: relative; } - .navbar-custom-menu > .navbar-nav > li > .dropdown-menu { - position: absolute; - right: 0; - left: auto; + position: absolute; + right: 0; + left: auto; } - @media (max-width: 991px) { - .navbar-custom-menu > .navbar-nav { - float: right; - } - - .navbar-custom-menu > .navbar-nav > li { - position: static; - } - - .navbar-custom-menu > .navbar-nav > li > .dropdown-menu { - position: absolute; - right: 5%; - left: auto; - border: 1px solid #ddd; - background: #fff; - } + .navbar-custom-menu > .navbar-nav { + float: right; + } + .navbar-custom-menu > .navbar-nav > li { + position: static; + } + .navbar-custom-menu > .navbar-nav > li > .dropdown-menu { + position: absolute; + right: 5%; + left: auto; + border: 1px solid #ddd; + background: #fff; + } } - /* * Component: Form * --------------- */ .form-control { - border-radius: 0; - box-shadow: none; - border-color: #d2d6de; + border-radius: 0; + box-shadow: none; + border-color: #d2d6de; } - .form-control:focus { - border-color: #3c8dbc; - box-shadow: none; + border-color: #3c8dbc; + box-shadow: none; } - .form-control::-moz-placeholder, .form-control:-ms-input-placeholder, .form-control::-webkit-input-placeholder { - color: #bbb; - opacity: 1; + color: #bbb; + opacity: 1; } - .form-control:not(select) { - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; } - .form-group.has-success label { - color: #00a65a; + color: #00a65a; } - .form-group.has-success .form-control, .form-group.has-success .input-group-addon { - border-color: #00a65a; - box-shadow: none; + border-color: #00a65a; + box-shadow: none; } - .form-group.has-success .help-block { - color: #00a65a; + color: #00a65a; } - .form-group.has-warning label { - color: #f39c12; + color: #f39c12; } - .form-group.has-warning .form-control, .form-group.has-warning .input-group-addon { - border-color: #f39c12; - box-shadow: none; + border-color: #f39c12; + box-shadow: none; } - .form-group.has-warning .help-block { - color: #f39c12; + color: #f39c12; } - .form-group.has-error label { - color: #dd4b39; + color: #dd4b39; } - .form-group.has-error .form-control, .form-group.has-error .input-group-addon { - border-color: #dd4b39; - box-shadow: none; + border-color: #dd4b39; + box-shadow: none; } - .form-group.has-error .help-block { - color: #dd4b39; + color: #dd4b39; } - /* Input group */ .input-group .input-group-addon { - border-radius: 0; - border-color: #d2d6de; - background-color: #fff; + border-radius: 0; + border-color: #d2d6de; + background-color: #fff; } - /* button groups */ .btn-group-vertical .btn.btn-flat:first-of-type, .btn-group-vertical .btn.btn-flat:last-of-type { - border-radius: 0; + border-radius: 0; } - .icheck > label { - padding-left: 0; + padding-left: 0; } - /* support Font Awesome icons in form-control */ .form-control-feedback.fa { - line-height: 34px; + line-height: 34px; } - .input-lg + .form-control-feedback.fa, .input-group-lg + .form-control-feedback.fa, .form-group-lg .form-control + .form-control-feedback.fa { - line-height: 46px; + line-height: 46px; } - .input-sm + .form-control-feedback.fa, .input-group-sm + .form-control-feedback.fa, .form-group-sm .form-control + .form-control-feedback.fa { - line-height: 30px; + line-height: 30px; } - /* * Component: Progress Bar * ----------------------- */ .progress, .progress > .progress-bar { - -webkit-box-shadow: none; - box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; } - .progress, .progress > .progress-bar, .progress .progress-bar, .progress > .progress-bar .progress-bar { - border-radius: 1px; + border-radius: 1px; } - /* size variation */ .progress.sm, .progress-sm { - height: 10px; + height: 10px; } - .progress.sm, .progress-sm, .progress.sm .progress-bar, .progress-sm .progress-bar { - border-radius: 1px; + border-radius: 1px; } - .progress.xs, .progress-xs { - height: 7px; + height: 7px; } - .progress.xs, .progress-xs, .progress.xs .progress-bar, .progress-xs .progress-bar { - border-radius: 1px; + border-radius: 1px; } - .progress.xxs, .progress-xxs { - height: 3px; + height: 3px; } - .progress.xxs, .progress-xxs, .progress.xxs .progress-bar, .progress-xxs .progress-bar { - border-radius: 1px; + border-radius: 1px; } - /* Vertical bars */ .progress.vertical { - position: relative; - width: 30px; - height: 200px; - display: inline-block; - margin-right: 10px; + position: relative; + width: 30px; + height: 200px; + display: inline-block; + margin-right: 10px; } - .progress.vertical > .progress-bar { - width: 100%; - position: absolute; - bottom: 0; + width: 100%; + position: absolute; + bottom: 0; } - .progress.vertical.sm, .progress.vertical.progress-sm { - width: 20px; + width: 20px; } - .progress.vertical.xs, .progress.vertical.progress-xs { - width: 10px; + width: 10px; } - .progress.vertical.xxs, .progress.vertical.progress-xxs { - width: 3px; + width: 3px; } - .progress-group .progress-text { - font-weight: 600; + font-weight: 600; } - .progress-group .progress-number { - float: right; + float: right; } - /* Remove margins from progress bars when put in a table */ .table tr > td .progress { - margin: 0; + margin: 0; } - .progress-bar-light-blue, .progress-bar-primary { - background-color: #3c8dbc; + background-color: #3c8dbc; } - .progress-striped .progress-bar-light-blue, .progress-striped .progress-bar-primary { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} +.progress-striped .progress-bar-light-blue, +.progress-striped .progress-bar-primary { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } - .progress-bar-green, .progress-bar-success { - background-color: #00a65a; + background-color: #00a65a; } - .progress-striped .progress-bar-green, .progress-striped .progress-bar-success { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} +.progress-striped .progress-bar-green, +.progress-striped .progress-bar-success { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } - .progress-bar-aqua, .progress-bar-info { - background-color: #00c0ef; + background-color: #00c0ef; } - .progress-striped .progress-bar-aqua, .progress-striped .progress-bar-info { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} +.progress-striped .progress-bar-aqua, +.progress-striped .progress-bar-info { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } - .progress-bar-yellow, .progress-bar-warning { - background-color: #f39c12; + background-color: #f39c12; } - .progress-striped .progress-bar-yellow, .progress-striped .progress-bar-warning { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} +.progress-striped .progress-bar-yellow, +.progress-striped .progress-bar-warning { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } - .progress-bar-red, .progress-bar-danger { - background-color: #dd4b39; + background-color: #dd4b39; } - .progress-striped .progress-bar-red, .progress-striped .progress-bar-danger { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} +.progress-striped .progress-bar-red, +.progress-striped .progress-bar-danger { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } - /* * Component: Small Box * -------------------- */ .small-box { - border-radius: 2px; - position: relative; - display: block; - margin-bottom: 20px; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + border-radius: 2px; + position: relative; + display: block; + margin-bottom: 20px; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); } - .small-box > .inner { - padding: 10px; + padding: 10px; } - .small-box > .small-box-footer { - position: relative; - text-align: center; - padding: 3px 0; - color: #fff; - color: rgba(255, 255, 255, 0.8); - display: block; - z-index: 10; - background: rgba(0, 0, 0, 0.1); - text-decoration: none; + position: relative; + text-align: center; + padding: 3px 0; + color: #fff; + color: rgba(255, 255, 255, 0.8); + display: block; + z-index: 10; + background: rgba(0, 0, 0, 0.1); + text-decoration: none; } - .small-box > .small-box-footer:hover { - color: #fff; - background: rgba(0, 0, 0, 0.15); + color: #fff; + background: rgba(0, 0, 0, 0.15); } - .small-box h3 { - font-size: 38px; - font-weight: bold; - margin: 0 0 10px 0; - white-space: nowrap; - padding: 0; + font-size: 38px; + font-weight: bold; + margin: 0 0 10px 0; + white-space: nowrap; + padding: 0; } - .small-box p { - font-size: 15px; + font-size: 15px; } - .small-box p > small { - display: block; - color: #f9f9f9; - font-size: 13px; - margin-top: 5px; + display: block; + color: #f9f9f9; + font-size: 13px; + margin-top: 5px; } - .small-box h3, .small-box p { - z-index: 5; + z-index: 5; } - .small-box .icon { - -webkit-transition: all 0.3s linear; - -o-transition: all 0.3s linear; - transition: all 0.3s linear; - position: absolute; - top: -10px; - right: 10px; - z-index: 0; - font-size: 90px; - color: rgba(0, 0, 0, 0.15); + -webkit-transition: all 0.3s linear; + -o-transition: all 0.3s linear; + transition: all 0.3s linear; + position: absolute; + top: -10px; + right: 10px; + z-index: 0; + font-size: 90px; + color: rgba(0, 0, 0, 0.15); } - .small-box:hover { - text-decoration: none; - color: #f9f9f9; + text-decoration: none; + color: #f9f9f9; } - .small-box:hover .icon { - font-size: 95px; + font-size: 95px; } - @media (max-width: 767px) { - .small-box { - text-align: center; - } - - .small-box .icon { - display: none; - } - - .small-box p { - font-size: 12px; - } + .small-box { + text-align: center; + } + .small-box .icon { + display: none; + } + .small-box p { + font-size: 12px; + } } - /* * Component: Box * -------------- */ .box { - position: relative; - border-radius: 3px; - background: #ffffff; - border-top: 3px solid #d2d6de; - margin-bottom: 20px; - width: 100%; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + position: relative; + border-radius: 3px; + background: #ffffff; + border-top: 3px solid #d2d6de; + margin-bottom: 20px; + width: 100%; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); } - .box.box-primary { - border-top-color: #3c8dbc; + border-top-color: #3c8dbc; } - .box.box-info { - border-top-color: #00c0ef; + border-top-color: #00c0ef; } - .box.box-danger { - border-top-color: #dd4b39; + border-top-color: #dd4b39; } - .box.box-warning { - border-top-color: #f39c12; + border-top-color: #f39c12; } - .box.box-success { - border-top-color: #00a65a; + border-top-color: #00a65a; } - .box.box-default { - border-top-color: #d2d6de; + border-top-color: #d2d6de; } - .box.collapsed-box .box-body, .box.collapsed-box .box-footer { - display: none; + display: none; } - .box .nav-stacked > li { - border-bottom: 1px solid #f4f4f4; - margin: 0; + border-bottom: 1px solid #f4f4f4; + margin: 0; } - .box .nav-stacked > li:last-of-type { - border-bottom: none; + border-bottom: none; } - .box.height-control .box-body { - max-height: 300px; - overflow: auto; + max-height: 300px; + overflow: auto; } - .box .border-right { - border-right: 1px solid #f4f4f4; + border-right: 1px solid #f4f4f4; } - .box .border-left { - border-left: 1px solid #f4f4f4; + border-left: 1px solid #f4f4f4; } - .box.box-solid { - border-top: 0; + border-top: 0; } - .box.box-solid > .box-header .btn.btn-default { - background: transparent; + background: transparent; } - .box.box-solid > .box-header .btn:hover, .box.box-solid > .box-header a:hover { - background: rgba(0, 0, 0, 0.1); + background: rgba(0, 0, 0, 0.1); } - .box.box-solid.box-default { - border: 1px solid #d2d6de; + border: 1px solid #d2d6de; } - .box.box-solid.box-default > .box-header { - color: #444444; - background: #d2d6de; - background-color: #d2d6de; + color: #444444; + background: #d2d6de; + background-color: #d2d6de; } - .box.box-solid.box-default > .box-header a, .box.box-solid.box-default > .box-header .btn { - color: #444444; + color: #444444; } - .box.box-solid.box-primary { - border: 1px solid #3c8dbc; + border: 1px solid #3c8dbc; } - .box.box-solid.box-primary > .box-header { - color: #ffffff; - background: #3c8dbc; - background-color: #3c8dbc; + color: #ffffff; + background: #3c8dbc; + background-color: #3c8dbc; } - .box.box-solid.box-primary > .box-header a, .box.box-solid.box-primary > .box-header .btn { - color: #ffffff; + color: #ffffff; } - .box.box-solid.box-info { - border: 1px solid #00c0ef; + border: 1px solid #00c0ef; } - .box.box-solid.box-info > .box-header { - color: #ffffff; - background: #00c0ef; - background-color: #00c0ef; + color: #ffffff; + background: #00c0ef; + background-color: #00c0ef; } - .box.box-solid.box-info > .box-header a, .box.box-solid.box-info > .box-header .btn { - color: #ffffff; + color: #ffffff; } - .box.box-solid.box-danger { - border: 1px solid #dd4b39; + border: 1px solid #dd4b39; } - .box.box-solid.box-danger > .box-header { - color: #ffffff; - background: #dd4b39; - background-color: #dd4b39; + color: #ffffff; + background: #dd4b39; + background-color: #dd4b39; } - .box.box-solid.box-danger > .box-header a, .box.box-solid.box-danger > .box-header .btn { - color: #ffffff; + color: #ffffff; } - .box.box-solid.box-warning { - border: 1px solid #f39c12; + border: 1px solid #f39c12; } - .box.box-solid.box-warning > .box-header { - color: #ffffff; - background: #f39c12; - background-color: #f39c12; + color: #ffffff; + background: #f39c12; + background-color: #f39c12; } - .box.box-solid.box-warning > .box-header a, .box.box-solid.box-warning > .box-header .btn { - color: #ffffff; + color: #ffffff; } - .box.box-solid.box-success { - border: 1px solid #00a65a; + border: 1px solid #00a65a; } - .box.box-solid.box-success > .box-header { - color: #ffffff; - background: #00a65a; - background-color: #00a65a; + color: #ffffff; + background: #00a65a; + background-color: #00a65a; } - .box.box-solid.box-success > .box-header a, .box.box-solid.box-success > .box-header .btn { - color: #ffffff; + color: #ffffff; } - .box.box-solid > .box-header > .box-tools .btn { - border: 0; - box-shadow: none; + border: 0; + box-shadow: none; } - .box.box-solid[class*='bg'] > .box-header { - color: #fff; + color: #fff; } - .box .box-group > .box { - margin-bottom: 5px; + margin-bottom: 5px; } - .box .knob-label { - text-align: center; - color: #333; - font-weight: 100; - font-size: 12px; - margin-bottom: 0.3em; + text-align: center; + color: #333; + font-weight: 100; + font-size: 12px; + margin-bottom: 0.3em; } - .box > .overlay, .overlay-wrapper > .overlay, .box > .loading-img, .overlay-wrapper > .loading-img { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; } - .box .overlay, .overlay-wrapper .overlay { - z-index: 50; - background: rgba(255, 255, 255, 0.7); - border-radius: 3px; + z-index: 50; + background: rgba(255, 255, 255, 0.7); + border-radius: 3px; } - .box .overlay > .fa, .overlay-wrapper .overlay > .fa { - position: absolute; - top: 50%; - left: 50%; - margin-left: -15px; - margin-top: -15px; - color: #000; - font-size: 30px; + position: absolute; + top: 50%; + left: 50%; + margin-left: -15px; + margin-top: -15px; + color: #000; + font-size: 30px; } - .box .overlay.dark, .overlay-wrapper .overlay.dark { - background: rgba(0, 0, 0, 0.5); + background: rgba(0, 0, 0, 0.5); } - .box-header:before, .box-body:before, .box-footer:before, .box-header:after, .box-body:after, .box-footer:after { - content: " "; - display: table; + content: " "; + display: table; } - .box-header:after, .box-body:after, .box-footer:after { - clear: both; + clear: both; +} +.box-header:before, +.box-body:before, +.box-footer:before, +.box-header:after, +.box-body:after, +.box-footer:after { + content: " "; + display: table; +} +.box-header:after, +.box-body:after, +.box-footer:after { + clear: both; } - .box-header { - color: #444; - display: block; - padding: 10px; - position: relative; + color: #444; + display: block; + padding: 10px; + position: relative; } - .box-header.with-border { - border-bottom: 1px solid #f4f4f4; + border-bottom: 1px solid #f4f4f4; } - .collapsed-box .box-header.with-border { - border-bottom: none; + border-bottom: none; } - .box-header > .fa, .box-header > .glyphicon, .box-header > .ion, .box-header .box-title { - display: inline-block; - font-size: 18px; - margin: 0; - line-height: 1; + display: inline-block; + font-size: 18px; + margin: 0; + line-height: 1; } - .box-header > .fa, .box-header > .glyphicon, .box-header > .ion { - margin-right: 5px; + margin-right: 5px; } - .box-header > .box-tools { - position: absolute; - right: 10px; - top: 5px; + position: absolute; + right: 10px; + top: 5px; } - .box-header > .box-tools [data-toggle="tooltip"] { - position: relative; + position: relative; } - .box-header > .box-tools.pull-right .dropdown-menu { - right: 0; - left: auto; + right: 0; + left: auto; +} +.box-header > .box-tools .dropdown-menu > li > a { + color: #444!important; } - .btn-box-tool { - padding: 5px; - font-size: 12px; - background: transparent; - color: #97a0b3; + padding: 5px; + font-size: 12px; + background: transparent; + color: #97a0b3; } - .open .btn-box-tool, .btn-box-tool:hover { - color: #606c84; + color: #606c84; } - .btn-box-tool.btn:active { - box-shadow: none; + box-shadow: none; } - .box-body { - border-top-left-radius: 0; - border-top-right-radius: 0; - border-bottom-right-radius: 3px; - border-bottom-left-radius: 3px; - padding: 10px; + border-top-left-radius: 0; + border-top-right-radius: 0; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; + padding: 10px; } - .no-header .box-body { - border-top-right-radius: 3px; - border-top-left-radius: 3px; + border-top-right-radius: 3px; + border-top-left-radius: 3px; } - .box-body > .table { - margin-bottom: 0; + margin-bottom: 0; } - .box-body .fc { - margin-top: 5px; + margin-top: 5px; } - .box-body .full-width-chart { - margin: -19px; + margin: -19px; } - .box-body.no-padding .full-width-chart { - margin: -9px; + margin: -9px; } - .box-body .box-pane { - border-top-left-radius: 0; - border-top-right-radius: 0; - border-bottom-right-radius: 0; - border-bottom-left-radius: 3px; + border-top-left-radius: 0; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + border-bottom-left-radius: 3px; } - .box-body .box-pane-right { - border-top-left-radius: 0; - border-top-right-radius: 0; - border-bottom-right-radius: 3px; - border-bottom-left-radius: 0; + border-top-left-radius: 0; + border-top-right-radius: 0; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 0; } - .box-footer { - border-top-left-radius: 0; - border-top-right-radius: 0; - border-bottom-right-radius: 3px; - border-bottom-left-radius: 3px; - border-top: 1px solid #f4f4f4; - padding: 10px; - background-color: #ffffff; + border-top-left-radius: 0; + border-top-right-radius: 0; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; + border-top: 1px solid #f4f4f4; + padding: 10px; + background-color: #ffffff; } - .chart-legend { - margin: 10px 0; + margin: 10px 0; } - @media (max-width: 991px) { - .chart-legend > li { - float: left; - margin-right: 10px; - } + .chart-legend > li { + float: left; + margin-right: 10px; + } } - .box-comments { - background: #f7f7f7; + background: #f7f7f7; } - .box-comments .box-comment { - padding: 8px 0; - border-bottom: 1px solid #eee; + padding: 8px 0; + border-bottom: 1px solid #eee; } - .box-comments .box-comment:before, .box-comments .box-comment:after { - content: " "; - display: table; + content: " "; + display: table; } - .box-comments .box-comment:after { - clear: both; + clear: both; +} +.box-comments .box-comment:before, +.box-comments .box-comment:after { + content: " "; + display: table; +} +.box-comments .box-comment:after { + clear: both; } - .box-comments .box-comment:last-of-type { - border-bottom: 0; + border-bottom: 0; } - .box-comments .box-comment:first-of-type { - padding-top: 0; + padding-top: 0; } - .box-comments .box-comment img { - float: left; + float: left; } - .box-comments .comment-text { - margin-left: 40px; - color: #555; + margin-left: 40px; + color: #555; } - .box-comments .username { - color: #444; - display: block; - font-weight: 600; + color: #444; + display: block; + font-weight: 600; } - .box-comments .text-muted { - font-weight: 400; - font-size: 12px; + font-weight: 400; + font-size: 12px; } - /* Widget: TODO LIST */ .todo-list { - margin: 0; - padding: 0; - list-style: none; - overflow: auto; + margin: 0; + padding: 0; + list-style: none; + overflow: auto; } - .todo-list > li { - border-radius: 2px; - padding: 10px; - background: #f4f4f4; - margin-bottom: 2px; - border-left: 2px solid #e6e7e8; - color: #444; + border-radius: 2px; + padding: 10px; + background: #f4f4f4; + margin-bottom: 2px; + border-left: 2px solid #e6e7e8; + color: #444; } - .todo-list > li:last-of-type { - margin-bottom: 0; + margin-bottom: 0; } - .todo-list > li > input[type='checkbox'] { - margin: 0 10px 0 5px; + margin: 0 10px 0 5px; } - .todo-list > li .text { - display: inline-block; - margin-left: 5px; - font-weight: 600; + display: inline-block; + margin-left: 5px; + font-weight: 600; } - .todo-list > li .label { - margin-left: 10px; - font-size: 9px; + margin-left: 10px; + font-size: 9px; } - .todo-list > li .tools { - display: none; - float: right; - color: #dd4b39; + display: none; + float: right; + color: #dd4b39; } - .todo-list > li .tools > .fa, .todo-list > li .tools > .glyphicon, .todo-list > li .tools > .ion { - margin-right: 5px; - cursor: pointer; + margin-right: 5px; + cursor: pointer; } - .todo-list > li:hover .tools { - display: inline-block; + display: inline-block; } - .todo-list > li.done { - color: #999; + color: #999; } - .todo-list > li.done .text { - text-decoration: line-through; - font-weight: 500; + text-decoration: line-through; + font-weight: 500; } - .todo-list > li.done .label { - background: #d2d6de !important; + background: #d2d6de !important; } - .todo-list .danger { - border-left-color: #dd4b39; + border-left-color: #dd4b39; } - .todo-list .warning { - border-left-color: #f39c12; + border-left-color: #f39c12; } - .todo-list .info { - border-left-color: #00c0ef; + border-left-color: #00c0ef; } - .todo-list .success { - border-left-color: #00a65a; + border-left-color: #00a65a; } - .todo-list .primary { - border-left-color: #3c8dbc; + border-left-color: #3c8dbc; } - .todo-list .handle { - display: inline-block; - cursor: move; - margin: 0 5px; + display: inline-block; + cursor: move; + margin: 0 5px; } - /* Chat widget (DEPRECATED - this will be removed in the next major release. Use Direct Chat instead)*/ .chat { - padding: 5px 20px 5px 10px; + padding: 5px 20px 5px 10px; } - .chat .item { - margin-bottom: 10px; + margin-bottom: 10px; } - .chat .item:before, .chat .item:after { - content: " "; - display: table; + content: " "; + display: table; } - .chat .item:after { - clear: both; + clear: both; +} +.chat .item:before, +.chat .item:after { + content: " "; + display: table; +} +.chat .item:after { + clear: both; } - .chat .item > img { - width: 40px; - height: 40px; - border: 2px solid transparent; - border-radius: 50%; + width: 40px; + height: 40px; + border: 2px solid transparent; + border-radius: 50%; } - .chat .item > .online { - border: 2px solid #00a65a; + border: 2px solid #00a65a; } - .chat .item > .offline { - border: 2px solid #dd4b39; + border: 2px solid #dd4b39; } - .chat .item > .message { - margin-left: 55px; - margin-top: -40px; + margin-left: 55px; + margin-top: -40px; } - .chat .item > .message > .name { - display: block; - font-weight: 600; + display: block; + font-weight: 600; } - .chat .item > .attachment { - border-radius: 3px; - background: #f4f4f4; - margin-left: 65px; - margin-right: 15px; - padding: 10px; + border-radius: 3px; + background: #f4f4f4; + margin-left: 65px; + margin-right: 15px; + padding: 10px; } - .chat .item > .attachment > h4 { - margin: 0 0 5px 0; - font-weight: 600; - font-size: 14px; + margin: 0 0 5px 0; + font-weight: 600; + font-size: 14px; } - .chat .item > .attachment > p, .chat .item > .attachment > .filename { - font-weight: 600; - font-size: 13px; - font-style: italic; - margin: 0; + font-weight: 600; + font-size: 13px; + font-style: italic; + margin: 0; } - .chat .item > .attachment:before, .chat .item > .attachment:after { - content: " "; - display: table; + content: " "; + display: table; } - .chat .item > .attachment:after { - clear: both; + clear: both; +} +.chat .item > .attachment:before, +.chat .item > .attachment:after { + content: " "; + display: table; +} +.chat .item > .attachment:after { + clear: both; } - .box-input { - max-width: 200px; + max-width: 200px; } - .modal .panel-body { - color: #444; + color: #444; } - /* * Component: Info Box * ------------------- */ .info-box { - display: block; - min-height: 90px; - background: #fff; - width: 100%; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); - border-radius: 2px; - margin-bottom: 15px; + display: block; + min-height: 90px; + background: #fff; + width: 100%; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + border-radius: 2px; + margin-bottom: 15px; } - .info-box small { - font-size: 14px; + font-size: 14px; } - .info-box .progress { - background: rgba(0, 0, 0, 0.2); - margin: 5px -10px 5px -10px; - height: 2px; + background: rgba(0, 0, 0, 0.2); + margin: 5px -10px 5px -10px; + height: 2px; } - .info-box .progress, .info-box .progress .progress-bar { - border-radius: 0; + border-radius: 0; } - .info-box .progress .progress-bar { - background: #fff; + background: #fff; } - .info-box-icon { - border-top-left-radius: 2px; - border-top-right-radius: 0; - border-bottom-right-radius: 0; - border-bottom-left-radius: 2px; - display: block; - float: left; - height: 90px; - width: 90px; - text-align: center; - font-size: 45px; - line-height: 90px; - background: rgba(0, 0, 0, 0.2); + border-top-left-radius: 2px; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + border-bottom-left-radius: 2px; + display: block; + float: left; + height: 90px; + width: 90px; + text-align: center; + font-size: 45px; + line-height: 90px; + background: rgba(0, 0, 0, 0.2); } - .info-box-icon > img { - max-width: 100%; + max-width: 100%; } - .info-box-content { - padding: 5px 10px; - margin-left: 90px; + padding: 5px 10px; + margin-left: 90px; } - .info-box-number { - display: block; - font-weight: bold; - font-size: 18px; + display: block; + font-weight: bold; + font-size: 18px; } - .progress-description, .info-box-text { - display: block; - font-size: 14px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + display: block; + font-size: 14px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } - .info-box-text { - text-transform: uppercase; + text-transform: uppercase; } - .info-box-more { - display: block; + display: block; } - .progress-description { - margin: 0; + margin: 0; } - /* * Component: Timeline * ------------------- */ .timeline { - position: relative; - margin: 0 0 30px 0; - padding: 0; - list-style: none; + position: relative; + margin: 0 0 30px 0; + padding: 0; + list-style: none; } - .timeline:before { - content: ''; - position: absolute; - top: 0; - bottom: 0; - width: 4px; - background: #ddd; - left: 31px; - margin: 0; - border-radius: 2px; + content: ''; + position: absolute; + top: 0; + bottom: 0; + width: 4px; + background: #ddd; + left: 31px; + margin: 0; + border-radius: 2px; } - .timeline > li { - position: relative; - margin-right: 10px; - margin-bottom: 15px; + position: relative; + margin-right: 10px; + margin-bottom: 15px; } - .timeline > li:before, .timeline > li:after { - content: " "; - display: table; + content: " "; + display: table; } - .timeline > li:after { - clear: both; + clear: both; +} +.timeline > li:before, +.timeline > li:after { + content: " "; + display: table; +} +.timeline > li:after { + clear: both; } - .timeline > li > .timeline-item { - -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); - border-radius: 3px; - margin-top: 0; - background: #fff; - color: #444; - margin-left: 60px; - margin-right: 15px; - padding: 0; - position: relative; + -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + border-radius: 3px; + margin-top: 0; + background: #fff; + color: #444; + margin-left: 60px; + margin-right: 15px; + padding: 0; + position: relative; } - .timeline > li > .timeline-item > .time { - color: #999; - float: right; - padding: 10px; - font-size: 12px; + color: #999; + float: right; + padding: 10px; + font-size: 12px; } - .timeline > li > .timeline-item > .timeline-header { - margin: 0; - color: #555; - border-bottom: 1px solid #f4f4f4; - padding: 10px; - font-size: 16px; - line-height: 1.1; + margin: 0; + color: #555; + border-bottom: 1px solid #f4f4f4; + padding: 10px; + font-size: 16px; + line-height: 1.1; } - .timeline > li > .timeline-item > .timeline-header > a { - font-weight: 600; + font-weight: 600; } - .timeline > li > .timeline-item > .timeline-body, .timeline > li > .timeline-item > .timeline-footer { - padding: 10px; + padding: 10px; } - .timeline > li > .fa, .timeline > li > .glyphicon, .timeline > li > .ion { - width: 30px; - height: 30px; - font-size: 15px; - line-height: 30px; - position: absolute; - color: #666; - background: #d2d6de; - border-radius: 50%; - text-align: center; - left: 18px; - top: 0; + width: 30px; + height: 30px; + font-size: 15px; + line-height: 30px; + position: absolute; + color: #666; + background: #d2d6de; + border-radius: 50%; + text-align: center; + left: 18px; + top: 0; } - .timeline > .time-label > span { - font-weight: 600; - padding: 5px; - display: inline-block; - background-color: #fff; - border-radius: 4px; + font-weight: 600; + padding: 5px; + display: inline-block; + background-color: #fff; + border-radius: 4px; } - .timeline-inverse > li > .timeline-item { - background: #f0f0f0; - border: 1px solid #ddd; - -webkit-box-shadow: none; - box-shadow: none; + background: #f0f0f0; + border: 1px solid #ddd; + -webkit-box-shadow: none; + box-shadow: none; } - .timeline-inverse > li > .timeline-item > .timeline-header { - border-bottom-color: #ddd; + border-bottom-color: #ddd; } - /* * Component: Button * ----------------- */ .btn { - border-radius: 3px; - -webkit-box-shadow: none; - box-shadow: none; - border: 1px solid transparent; + border-radius: 3px; + -webkit-box-shadow: none; + box-shadow: none; + border: 1px solid transparent; } - .btn.uppercase { - text-transform: uppercase; + text-transform: uppercase; } - .btn.btn-flat { - border-radius: 0; - -webkit-box-shadow: none; - -moz-box-shadow: none; - box-shadow: none; - border-width: 1px; + border-radius: 0; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; + border-width: 1px; } - .btn:active { - -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); - -moz-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); - box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + -moz-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); } - .btn:focus { - outline: none; + outline: none; } - .btn.btn-file { - position: relative; - overflow: hidden; + position: relative; + overflow: hidden; } - .btn.btn-file > input[type='file'] { - position: absolute; - top: 0; - right: 0; - min-width: 100%; - min-height: 100%; - font-size: 100px; - text-align: right; - opacity: 0; - filter: alpha(opacity=0); - outline: none; - background: white; - cursor: inherit; - display: block; + position: absolute; + top: 0; + right: 0; + min-width: 100%; + min-height: 100%; + font-size: 100px; + text-align: right; + opacity: 0; + filter: alpha(opacity=0); + outline: none; + background: white; + cursor: inherit; + display: block; } - .btn-default { - background-color: #f4f4f4; - color: #444; - border-color: #ddd; + background-color: #f4f4f4; + color: #444; + border-color: #ddd; } - .btn-default:hover, .btn-default:active, .btn-default.hover { - background-color: #e7e7e7; + background-color: #e7e7e7; } - .btn-primary { - background-color: #3c8dbc; - border-color: #367fa9; + background-color: #3c8dbc; + border-color: #367fa9; } - .btn-primary:hover, .btn-primary:active, .btn-primary.hover { - background-color: #367fa9; + background-color: #367fa9; } - .btn-success { - background-color: #00a65a; - border-color: #008d4c; + background-color: #00a65a; + border-color: #008d4c; } - .btn-success:hover, .btn-success:active, .btn-success.hover { - background-color: #008d4c; + background-color: #008d4c; } - .btn-info { - background-color: #00c0ef; - border-color: #00acd6; + background-color: #00c0ef; + border-color: #00acd6; } - .btn-info:hover, .btn-info:active, .btn-info.hover { - background-color: #00acd6; + background-color: #00acd6; } - .btn-danger { - background-color: #dd4b39; - border-color: #d73925; + background-color: #dd4b39; + border-color: #d73925; } - .btn-danger:hover, .btn-danger:active, .btn-danger.hover { - background-color: #d73925; + background-color: #d73925; } - .btn-warning { - background-color: #f39c12; - border-color: #e08e0b; + background-color: #f39c12; + border-color: #e08e0b; } - .btn-warning:hover, .btn-warning:active, .btn-warning.hover { - background-color: #e08e0b; + background-color: #e08e0b; } - .btn-outline { - border: 1px solid #fff; - background: transparent; - color: #fff; + border: 1px solid #fff; + background: transparent; + color: #fff; } - .btn-outline:hover, .btn-outline:focus, .btn-outline:active { - color: rgba(255, 255, 255, 0.7); - border-color: rgba(255, 255, 255, 0.7); + color: rgba(255, 255, 255, 0.7); + border-color: rgba(255, 255, 255, 0.7); } - .btn-link { - -webkit-box-shadow: none; - box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; } - .btn[class*='bg-']:hover { - -webkit-box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.2); - box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.2); + -webkit-box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.2); + box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.2); } - .btn-app { - border-radius: 3px; - position: relative; - padding: 15px 5px; - margin: 0 0 10px 10px; - min-width: 80px; - height: 60px; - text-align: center; - color: #666; - border: 1px solid #ddd; - background-color: #f4f4f4; - font-size: 12px; + border-radius: 3px; + position: relative; + padding: 15px 5px; + margin: 0 0 10px 10px; + min-width: 80px; + height: 60px; + text-align: center; + color: #666; + border: 1px solid #ddd; + background-color: #f4f4f4; + font-size: 12px; } - .btn-app > .fa, .btn-app > .glyphicon, .btn-app > .ion { - font-size: 20px; - display: block; + font-size: 20px; + display: block; } - .btn-app:hover { - background: #f4f4f4; - color: #444; - border-color: #aaa; + background: #f4f4f4; + color: #444; + border-color: #aaa; } - .btn-app:active, .btn-app:focus { - -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); - -moz-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); - box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + -moz-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); } - .btn-app > .badge { - position: absolute; - top: -3px; - right: -10px; - font-size: 10px; - font-weight: 400; + position: absolute; + top: -3px; + right: -10px; + font-size: 10px; + font-weight: 400; } - /* * Component: Callout * ------------------ */ .callout { - border-radius: 3px; - margin: 0 0 20px 0; - padding: 15px 30px 15px 15px; - border-left: 5px solid #eee; + border-radius: 3px; + margin: 0 0 20px 0; + padding: 15px 30px 15px 15px; + border-left: 5px solid #eee; } - .callout a { - color: #fff; - text-decoration: underline; + color: #fff; + text-decoration: underline; } - .callout a:hover { - color: #eee; + color: #eee; } - .callout h4 { - margin-top: 0; - font-weight: 600; + margin-top: 0; + font-weight: 600; } - .callout p:last-child { - margin-bottom: 0; + margin-bottom: 0; } - .callout code, .callout .highlight { - background-color: #fff; + background-color: #fff; } - .callout.callout-danger { - border-color: #c23321; + border-color: #c23321; } - .callout.callout-warning { - border-color: #c87f0a; + border-color: #c87f0a; } - .callout.callout-info { - border-color: #0097bc; + border-color: #0097bc; } - .callout.callout-success { - border-color: #00733e; + border-color: #00733e; } - /* * Component: alert * ---------------- */ .alert { - border-radius: 3px; + border-radius: 3px; } - .alert h4 { - font-weight: 600; + font-weight: 600; } - .alert .icon { - margin-right: 10px; + margin-right: 10px; } - .alert .close { - color: #000; - opacity: 0.2; - filter: alpha(opacity=20); + color: #000; + opacity: 0.2; + filter: alpha(opacity=20); } - .alert .close:hover { - opacity: 0.5; - filter: alpha(opacity=50); + opacity: 0.5; + filter: alpha(opacity=50); } - .alert a { - color: #fff; - text-decoration: underline; + color: #fff; + text-decoration: underline; } - .alert-success { - border-color: #008d4c; + border-color: #008d4c; } - .alert-danger, .alert-error { - border-color: #d73925; + border-color: #d73925; } - .alert-warning { - border-color: #e08e0b; + border-color: #e08e0b; } - .alert-info { - border-color: #00acd6; + border-color: #00acd6; } - /* * Component: Nav * -------------- @@ -2897,272 +2563,234 @@ a:focus { .nav > li > a:hover, .nav > li > a:active, .nav > li > a:focus { - color: #444; - background: #f7f7f7; + color: #444; + background: #f7f7f7; } - /* NAV PILLS */ .nav-pills > li > a { - border-radius: 0; - border-top: 3px solid transparent; - color: #444; + border-radius: 0; + border-top: 3px solid transparent; + color: #444; } - .nav-pills > li > a > .fa, .nav-pills > li > a > .glyphicon, .nav-pills > li > a > .ion { - margin-right: 5px; + margin-right: 5px; } - .nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus { - border-top-color: #3c8dbc; + border-top-color: #3c8dbc; } - .nav-pills > li.active > a { - font-weight: 600; + font-weight: 600; } - /* NAV STACKED */ .nav-stacked > li > a { - border-radius: 0; - border-top: 0; - border-left: 3px solid transparent; - color: #444; + border-radius: 0; + border-top: 0; + border-left: 3px solid transparent; + color: #444; } - .nav-stacked > li.active > a, .nav-stacked > li.active > a:hover { - background: transparent; - color: #444; - border-top: 0; - border-left-color: #3c8dbc; + background: transparent; + color: #444; + border-top: 0; + border-left-color: #3c8dbc; } - .nav-stacked > li.header { - border-bottom: 1px solid #ddd; - color: #777; - margin-bottom: 10px; - padding: 5px 10px; - text-transform: uppercase; + border-bottom: 1px solid #ddd; + color: #777; + margin-bottom: 10px; + padding: 5px 10px; + text-transform: uppercase; } - /* NAV TABS */ .nav-tabs-custom { - margin-bottom: 20px; - background: #fff; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); - border-radius: 3px; + margin-bottom: 20px; + background: #fff; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + border-radius: 3px; } - .nav-tabs-custom > .nav-tabs { - margin: 0; - border-bottom-color: #f4f4f4; - border-top-right-radius: 3px; - border-top-left-radius: 3px; + margin: 0; + border-bottom-color: #f4f4f4; + border-top-right-radius: 3px; + border-top-left-radius: 3px; } - .nav-tabs-custom > .nav-tabs > li { - border-top: 3px solid transparent; - margin-bottom: -2px; - margin-right: 5px; + border-top: 3px solid transparent; + margin-bottom: -2px; + margin-right: 5px; +} +.nav-tabs-custom > .nav-tabs > li.disabled > a { + color: #777; } - .nav-tabs-custom > .nav-tabs > li > a { - color: #444; - border-radius: 0; + color: #444; + border-radius: 0; } - .nav-tabs-custom > .nav-tabs > li > a.text-muted { - color: #999; + color: #999; } - .nav-tabs-custom > .nav-tabs > li > a, .nav-tabs-custom > .nav-tabs > li > a:hover { - background: transparent; - margin: 0; + background: transparent; + margin: 0; } - .nav-tabs-custom > .nav-tabs > li > a:hover { - color: #999; + color: #999; } - .nav-tabs-custom > .nav-tabs > li:not(.active) > a:hover, .nav-tabs-custom > .nav-tabs > li:not(.active) > a:focus, .nav-tabs-custom > .nav-tabs > li:not(.active) > a:active { - border-color: transparent; + border-color: transparent; } - .nav-tabs-custom > .nav-tabs > li.active { - border-top-color: #3c8dbc; + border-top-color: #3c8dbc; } - .nav-tabs-custom > .nav-tabs > li.active > a, .nav-tabs-custom > .nav-tabs > li.active:hover > a { - background-color: #fff; - color: #444; + background-color: #fff; + color: #444; } - .nav-tabs-custom > .nav-tabs > li.active > a { - border-top-color: transparent; - border-left-color: #f4f4f4; - border-right-color: #f4f4f4; + border-top-color: transparent; + border-left-color: #f4f4f4; + border-right-color: #f4f4f4; } - .nav-tabs-custom > .nav-tabs > li:first-of-type { - margin-left: 0; + margin-left: 0; } - .nav-tabs-custom > .nav-tabs > li:first-of-type.active > a { - border-left-color: transparent; + border-left-color: transparent; } - .nav-tabs-custom > .nav-tabs.pull-right { - float: none !important; + float: none !important; } - .nav-tabs-custom > .nav-tabs.pull-right > li { - float: right; + float: right; } - .nav-tabs-custom > .nav-tabs.pull-right > li:first-of-type { - margin-right: 0; + margin-right: 0; } - .nav-tabs-custom > .nav-tabs.pull-right > li:first-of-type > a { - border-left-width: 1px; + border-left-width: 1px; } - .nav-tabs-custom > .nav-tabs.pull-right > li:first-of-type.active > a { - border-left-color: #f4f4f4; - border-right-color: transparent; + border-left-color: #f4f4f4; + border-right-color: transparent; } - .nav-tabs-custom > .nav-tabs > li.header { - line-height: 35px; - padding: 0 10px; - font-size: 20px; - color: #444; + line-height: 35px; + padding: 0 10px; + font-size: 20px; + color: #444; } - .nav-tabs-custom > .nav-tabs > li.header > .fa, .nav-tabs-custom > .nav-tabs > li.header > .glyphicon, .nav-tabs-custom > .nav-tabs > li.header > .ion { - margin-right: 5px; + margin-right: 5px; } - .nav-tabs-custom > .tab-content { - background: #fff; - padding: 10px; - border-bottom-right-radius: 3px; - border-bottom-left-radius: 3px; + background: #fff; + padding: 10px; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; } - .nav-tabs-custom .dropdown.open > a:active, .nav-tabs-custom .dropdown.open > a:focus { - background: transparent; - color: #999; + background: transparent; + color: #999; } - .nav-tabs-custom.tab-primary > .nav-tabs > li.active { - border-top-color: #3c8dbc; + border-top-color: #3c8dbc; } - .nav-tabs-custom.tab-info > .nav-tabs > li.active { - border-top-color: #00c0ef; + border-top-color: #00c0ef; } - .nav-tabs-custom.tab-danger > .nav-tabs > li.active { - border-top-color: #dd4b39; + border-top-color: #dd4b39; } - .nav-tabs-custom.tab-warning > .nav-tabs > li.active { - border-top-color: #f39c12; + border-top-color: #f39c12; } - .nav-tabs-custom.tab-success > .nav-tabs > li.active { - border-top-color: #00a65a; + border-top-color: #00a65a; } - .nav-tabs-custom.tab-default > .nav-tabs > li.active { - border-top-color: #d2d6de; + border-top-color: #d2d6de; } - /* PAGINATION */ .pagination > li > a { - background: #fafafa; - color: #666; + background: #fafafa; + color: #666; } - .pagination.pagination-flat > li > a { - border-radius: 0 !important; + border-radius: 0 !important; } - /* * Component: Products List * ------------------------ */ .products-list { - list-style: none; - margin: 0; - padding: 0; + list-style: none; + margin: 0; + padding: 0; } - .products-list > .item { - border-radius: 3px; - -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); - padding: 10px 0; - background: #fff; + border-radius: 3px; + -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + padding: 10px 0; + background: #fff; } - .products-list > .item:before, .products-list > .item:after { - content: " "; - display: table; + content: " "; + display: table; } - .products-list > .item:after { - clear: both; + clear: both; +} +.products-list > .item:before, +.products-list > .item:after { + content: " "; + display: table; +} +.products-list > .item:after { + clear: both; } - .products-list .product-img { - float: left; + float: left; } - .products-list .product-img img { - width: 50px; - height: 50px; + width: 50px; + height: 50px; } - .products-list .product-info { - margin-left: 60px; + margin-left: 60px; } - .products-list .product-title { - font-weight: 600; + font-weight: 600; } - .products-list .product-description { - display: block; - color: #999; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; + display: block; + color: #999; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; } - .product-list-in-box > .item { - -webkit-box-shadow: none; - box-shadow: none; - border-radius: 0; - border-bottom: 1px solid #f4f4f4; + -webkit-box-shadow: none; + box-shadow: none; + border-radius: 0; + border-bottom: 1px solid #f4f4f4; } - .product-list-in-box > .item:last-of-type { - border-bottom-width: 0; + border-bottom-width: 0; } - /* * Component: Table * ---------------- @@ -3173,1841 +2801,2125 @@ a:focus { .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td { - border-top: 1px solid #f4f4f4; + border-top: 1px solid #f4f4f4; } - .table > thead > tr > th { - border-bottom: 2px solid #f4f4f4; + border-bottom: 2px solid #f4f4f4; } - .table tr td .progress { - margin-top: 5px; + margin-top: 5px; } - .table-bordered { - border: 1px solid #f4f4f4; + border: 1px solid #f4f4f4; } - .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td { - border: 1px solid #f4f4f4; + border: 1px solid #f4f4f4; } - .table-bordered > thead > tr > th, .table-bordered > thead > tr > td { - border-bottom-width: 2px; + border-bottom-width: 2px; } - .table.no-border, .table.no-border td, .table.no-border th { - border: 0; + border: 0; } - /* .text-center in tables */ table.text-center, table.text-center td, table.text-center th { - text-align: center; + text-align: center; } - .table.align th { - text-align: left; + text-align: left; } - .table.align td { - text-align: right; + text-align: right; } - /* * Component: Label * ---------------- */ .label-default { - background-color: #d2d6de; - color: #444; + background-color: #d2d6de; + color: #444; } - /* * Component: Direct Chat * ---------------------- */ .direct-chat .box-body { - border-bottom-right-radius: 0; - border-bottom-left-radius: 0; - position: relative; - overflow-x: hidden; - padding: 0; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; + position: relative; + overflow-x: hidden; + padding: 0; } - .direct-chat.chat-pane-open .direct-chat-contacts { - -webkit-transform: translate(0, 0); - -ms-transform: translate(0, 0); - -o-transform: translate(0, 0); - transform: translate(0, 0); + -webkit-transform: translate(0, 0); + -ms-transform: translate(0, 0); + -o-transform: translate(0, 0); + transform: translate(0, 0); } - .direct-chat-messages { - -webkit-transform: translate(0, 0); - -ms-transform: translate(0, 0); - -o-transform: translate(0, 0); - transform: translate(0, 0); - padding: 10px; - height: 250px; - overflow: auto; + -webkit-transform: translate(0, 0); + -ms-transform: translate(0, 0); + -o-transform: translate(0, 0); + transform: translate(0, 0); + padding: 10px; + height: 250px; + overflow: auto; } - .direct-chat-msg, .direct-chat-text { - display: block; + display: block; } - .direct-chat-msg { - margin-bottom: 10px; + margin-bottom: 10px; } - .direct-chat-msg:before, .direct-chat-msg:after { - content: " "; - display: table; + content: " "; + display: table; } - .direct-chat-msg:after { - clear: both; + clear: both; +} +.direct-chat-msg:before, +.direct-chat-msg:after { + content: " "; + display: table; +} +.direct-chat-msg:after { + clear: both; } - .direct-chat-messages, .direct-chat-contacts { - -webkit-transition: -webkit-transform 0.5s ease-in-out; - -moz-transition: -moz-transform 0.5s ease-in-out; - -o-transition: -o-transform 0.5s ease-in-out; - transition: transform 0.5s ease-in-out; + -webkit-transition: -webkit-transform 0.5s ease-in-out; + -moz-transition: -moz-transform 0.5s ease-in-out; + -o-transition: -o-transform 0.5s ease-in-out; + transition: transform 0.5s ease-in-out; } - .direct-chat-text { - border-radius: 5px; - position: relative; - padding: 5px 10px; - background: #d2d6de; - border: 1px solid #d2d6de; - margin: 5px 0 0 50px; - color: #444444; + border-radius: 5px; + position: relative; + padding: 5px 10px; + background: #d2d6de; + border: 1px solid #d2d6de; + margin: 5px 0 0 50px; + color: #444444; } - .direct-chat-text:after, .direct-chat-text:before { - position: absolute; - right: 100%; - top: 15px; - border: solid transparent; - border-right-color: #d2d6de; - content: ' '; - height: 0; - width: 0; - pointer-events: none; + position: absolute; + right: 100%; + top: 15px; + border: solid transparent; + border-right-color: #d2d6de; + content: ' '; + height: 0; + width: 0; + pointer-events: none; } - .direct-chat-text:after { - border-width: 5px; - margin-top: -5px; + border-width: 5px; + margin-top: -5px; } - .direct-chat-text:before { - border-width: 6px; - margin-top: -6px; + border-width: 6px; + margin-top: -6px; } - .right .direct-chat-text { - margin-right: 50px; - margin-left: 0; + margin-right: 50px; + margin-left: 0; } - .right .direct-chat-text:after, .right .direct-chat-text:before { - right: auto; - left: 100%; - border-right-color: transparent; - border-left-color: #d2d6de; + right: auto; + left: 100%; + border-right-color: transparent; + border-left-color: #d2d6de; } - .direct-chat-img { - border-radius: 50%; - float: left; - width: 40px; - height: 40px; + border-radius: 50%; + float: left; + width: 40px; + height: 40px; } - .right .direct-chat-img { - float: right; + float: right; } - .direct-chat-info { - display: block; - margin-bottom: 2px; - font-size: 12px; + display: block; + margin-bottom: 2px; + font-size: 12px; } - .direct-chat-name { - font-weight: 600; + font-weight: 600; } - .direct-chat-timestamp { - color: #999; + color: #999; } - .direct-chat-contacts-open .direct-chat-contacts { - -webkit-transform: translate(0, 0); - -ms-transform: translate(0, 0); - -o-transform: translate(0, 0); - transform: translate(0, 0); + -webkit-transform: translate(0, 0); + -ms-transform: translate(0, 0); + -o-transform: translate(0, 0); + transform: translate(0, 0); } - .direct-chat-contacts { - -webkit-transform: translate(101%, 0); - -ms-transform: translate(101%, 0); - -o-transform: translate(101%, 0); - transform: translate(101%, 0); - position: absolute; - top: 0; - bottom: 0; - height: 250px; - width: 100%; - background: #222d32; - color: #fff; - overflow: auto; + -webkit-transform: translate(101%, 0); + -ms-transform: translate(101%, 0); + -o-transform: translate(101%, 0); + transform: translate(101%, 0); + position: absolute; + top: 0; + bottom: 0; + height: 250px; + width: 100%; + background: #222d32; + color: #fff; + overflow: auto; } - .contacts-list > li { - border-bottom: 1px solid rgba(0, 0, 0, 0.2); - padding: 10px; - margin: 0; + border-bottom: 1px solid rgba(0, 0, 0, 0.2); + padding: 10px; + margin: 0; } - .contacts-list > li:before, .contacts-list > li:after { - content: " "; - display: table; + content: " "; + display: table; } - .contacts-list > li:after { - clear: both; + clear: both; +} +.contacts-list > li:before, +.contacts-list > li:after { + content: " "; + display: table; +} +.contacts-list > li:after { + clear: both; } - .contacts-list > li:last-of-type { - border-bottom: none; + border-bottom: none; } - .contacts-list-img { - border-radius: 50%; - width: 40px; - float: left; + border-radius: 50%; + width: 40px; + float: left; } - .contacts-list-info { - margin-left: 45px; - color: #fff; + margin-left: 45px; + color: #fff; } - .contacts-list-name, .contacts-list-status { - display: block; + display: block; } - .contacts-list-name { - font-weight: 600; + font-weight: 600; } - .contacts-list-status { - font-size: 12px; + font-size: 12px; } - .contacts-list-date { - color: #aaa; - font-weight: normal; + color: #aaa; + font-weight: normal; } - .contacts-list-msg { - color: #999; + color: #999; } - .direct-chat-danger .right > .direct-chat-text { - background: #dd4b39; - border-color: #dd4b39; - color: #ffffff; + background: #dd4b39; + border-color: #dd4b39; + color: #ffffff; } - .direct-chat-danger .right > .direct-chat-text:after, .direct-chat-danger .right > .direct-chat-text:before { - border-left-color: #dd4b39; + border-left-color: #dd4b39; } - .direct-chat-primary .right > .direct-chat-text { - background: #3c8dbc; - border-color: #3c8dbc; - color: #ffffff; + background: #3c8dbc; + border-color: #3c8dbc; + color: #ffffff; } - .direct-chat-primary .right > .direct-chat-text:after, .direct-chat-primary .right > .direct-chat-text:before { - border-left-color: #3c8dbc; + border-left-color: #3c8dbc; } - .direct-chat-warning .right > .direct-chat-text { - background: #f39c12; - border-color: #f39c12; - color: #ffffff; + background: #f39c12; + border-color: #f39c12; + color: #ffffff; } - .direct-chat-warning .right > .direct-chat-text:after, .direct-chat-warning .right > .direct-chat-text:before { - border-left-color: #f39c12; + border-left-color: #f39c12; } - .direct-chat-info .right > .direct-chat-text { - background: #00c0ef; - border-color: #00c0ef; - color: #ffffff; + background: #00c0ef; + border-color: #00c0ef; + color: #ffffff; } - .direct-chat-info .right > .direct-chat-text:after, .direct-chat-info .right > .direct-chat-text:before { - border-left-color: #00c0ef; + border-left-color: #00c0ef; } - .direct-chat-success .right > .direct-chat-text { - background: #00a65a; - border-color: #00a65a; - color: #ffffff; + background: #00a65a; + border-color: #00a65a; + color: #ffffff; } - .direct-chat-success .right > .direct-chat-text:after, .direct-chat-success .right > .direct-chat-text:before { - border-left-color: #00a65a; + border-left-color: #00a65a; } - /* * Component: Users List * --------------------- */ .users-list > li { - width: 25%; - float: left; - padding: 10px; - text-align: center; + width: 25%; + float: left; + padding: 10px; + text-align: center; } - .users-list > li img { - border-radius: 50%; - max-width: 100%; - height: auto; + border-radius: 50%; + max-width: 100%; + height: auto; } - .users-list > li > a:hover, .users-list > li > a:hover .users-list-name { - color: #999; + color: #999; } - .users-list-name, .users-list-date { - display: block; + display: block; } - .users-list-name { - font-weight: 600; - color: #444; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; + font-weight: 600; + color: #444; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; } - .users-list-date { - color: #999; - font-size: 12px; + color: #999; + font-size: 12px; } - /* * Component: Carousel * ------------------- */ .carousel-control.left, .carousel-control.right { - background-image: none; + background-image: none; } - .carousel-control > .fa { - font-size: 40px; - position: absolute; - top: 50%; - z-index: 5; - display: inline-block; - margin-top: -20px; + font-size: 40px; + position: absolute; + top: 50%; + z-index: 5; + display: inline-block; + margin-top: -20px; } - /* * Component: modal * ---------------- */ .modal { - background: rgba(0, 0, 0, 0.3); + background: rgba(0, 0, 0, 0.3); } - .modal-content { - border-radius: 0; + border-radius: 0; + -webkit-box-shadow: 0 2px 3px rgba(0, 0, 0, 0.125); + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.125); + border: 0; +} +@media (min-width: 768px) { + .modal-content { -webkit-box-shadow: 0 2px 3px rgba(0, 0, 0, 0.125); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.125); - border: 0; + } } - -@media (min-width: 768px) { - .modal-content { - -webkit-box-shadow: 0 2px 3px rgba(0, 0, 0, 0.125); - box-shadow: 0 2px 3px rgba(0, 0, 0, 0.125); - } -} - .modal-header { - border-bottom-color: #f4f4f4; + border-bottom-color: #f4f4f4; } - .modal-footer { - border-top-color: #f4f4f4; + border-top-color: #f4f4f4; } - .modal-primary .modal-header, .modal-primary .modal-footer { - border-color: #307095; + border-color: #307095; } - .modal-warning .modal-header, .modal-warning .modal-footer { - border-color: #c87f0a; + border-color: #c87f0a; } - .modal-info .modal-header, .modal-info .modal-footer { - border-color: #0097bc; + border-color: #0097bc; } - .modal-success .modal-header, .modal-success .modal-footer { - border-color: #00733e; + border-color: #00733e; } - .modal-danger .modal-header, .modal-danger .modal-footer { - border-color: #c23321; + border-color: #c23321; } - /* * Component: Social Widgets * ------------------------- */ .box-widget { - border: none; - position: relative; + border: none; + position: relative; } - .widget-user .widget-user-header { - padding: 20px; - height: 120px; - border-top-right-radius: 3px; - border-top-left-radius: 3px; + padding: 20px; + height: 120px; + border-top-right-radius: 3px; + border-top-left-radius: 3px; } - .widget-user .widget-user-username { - margin-top: 0; - margin-bottom: 5px; - font-size: 25px; - font-weight: 300; - text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); + margin-top: 0; + margin-bottom: 5px; + font-size: 25px; + font-weight: 300; + text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); } - .widget-user .widget-user-desc { - margin-top: 0; + margin-top: 0; } - .widget-user .widget-user-image { - position: absolute; - top: 65px; - left: 50%; - margin-left: -45px; + position: absolute; + top: 65px; + left: 50%; + margin-left: -45px; } - .widget-user .widget-user-image > img { - width: 90px; - height: auto; - border: 3px solid #fff; + width: 90px; + height: auto; + border: 3px solid #fff; } - .widget-user .box-footer { - padding-top: 30px; + padding-top: 30px; } - .widget-user-2 .widget-user-header { - padding: 20px; - border-top-right-radius: 3px; - border-top-left-radius: 3px; + padding: 20px; + border-top-right-radius: 3px; + border-top-left-radius: 3px; } - .widget-user-2 .widget-user-username { - margin-top: 5px; - margin-bottom: 5px; - font-size: 25px; - font-weight: 300; + margin-top: 5px; + margin-bottom: 5px; + font-size: 25px; + font-weight: 300; } - .widget-user-2 .widget-user-desc { - margin-top: 0; + margin-top: 0; } - .widget-user-2 .widget-user-username, .widget-user-2 .widget-user-desc { - margin-left: 75px; + margin-left: 75px; } - .widget-user-2 .widget-user-image > img { - width: 65px; - height: auto; - float: left; + width: 65px; + height: auto; + float: left; +} +.treeview-menu { + display: none; + list-style: none; + padding: 0; + margin: 0; + padding-left: 5px; +} +.treeview-menu .treeview-menu { + padding-left: 20px; +} +.treeview-menu > li { + margin: 0; +} +.treeview-menu > li > a { + padding: 5px 5px 5px 15px; + display: block; + font-size: 14px; +} +.treeview-menu > li > a > .fa, +.treeview-menu > li > a > .glyphicon, +.treeview-menu > li > a > .ion { + width: 20px; +} +.treeview-menu > li > a > .pull-right-container > .fa-angle-left, +.treeview-menu > li > a > .pull-right-container > .fa-angle-down, +.treeview-menu > li > a > .fa-angle-left, +.treeview-menu > li > a > .fa-angle-down { + width: auto; } - /* * Page: Mailbox * ------------- */ .mailbox-messages > .table { - margin: 0; + margin: 0; } - .mailbox-controls { - padding: 5px; + padding: 5px; } - .mailbox-controls.with-border { - border-bottom: 1px solid #f4f4f4; + border-bottom: 1px solid #f4f4f4; } - .mailbox-read-info { - border-bottom: 1px solid #f4f4f4; - padding: 10px; + border-bottom: 1px solid #f4f4f4; + padding: 10px; } - .mailbox-read-info h3 { - font-size: 20px; - margin: 0; + font-size: 20px; + margin: 0; } - .mailbox-read-info h5 { - margin: 0; - padding: 5px 0 0 0; + margin: 0; + padding: 5px 0 0 0; } - .mailbox-read-time { - color: #999; - font-size: 13px; + color: #999; + font-size: 13px; } - .mailbox-read-message { - padding: 10px; + padding: 10px; } - .mailbox-attachments li { - float: left; - width: 200px; - border: 1px solid #eee; - margin-bottom: 10px; - margin-right: 10px; + float: left; + width: 200px; + border: 1px solid #eee; + margin-bottom: 10px; + margin-right: 10px; } - .mailbox-attachment-name { - font-weight: bold; - color: #666; + font-weight: bold; + color: #666; } - .mailbox-attachment-icon, .mailbox-attachment-info, .mailbox-attachment-size { - display: block; + display: block; } - .mailbox-attachment-info { - padding: 10px; - background: #f4f4f4; + padding: 10px; + background: #f4f4f4; } - .mailbox-attachment-size { - color: #999; - font-size: 12px; + color: #999; + font-size: 12px; } - .mailbox-attachment-icon { - text-align: center; - font-size: 65px; - color: #666; - padding: 20px 10px; + text-align: center; + font-size: 65px; + color: #666; + padding: 20px 10px; } - .mailbox-attachment-icon.has-img { - padding: 0; + padding: 0; } - .mailbox-attachment-icon.has-img > img { - max-width: 100%; - height: auto; + max-width: 100%; + height: auto; } - /* * Page: Lock Screen * ----------------- */ /* ADD THIS CLASS TO THE TAG */ .lockscreen { - background: #d2d6de; + background: #d2d6de; } - .lockscreen-logo { - font-size: 35px; - text-align: center; - margin-bottom: 25px; - font-weight: 300; + font-size: 35px; + text-align: center; + margin-bottom: 25px; + font-weight: 300; } - .lockscreen-logo a { - color: #444; + color: #444; } - .lockscreen-wrapper { - max-width: 400px; - margin: 0 auto; - margin-top: 10%; + max-width: 400px; + margin: 0 auto; + margin-top: 10%; } - /* User name [optional] */ .lockscreen .lockscreen-name { - text-align: center; - font-weight: 600; + text-align: center; + font-weight: 600; } - /* Will contain the image and the sign in form */ .lockscreen-item { - border-radius: 4px; - padding: 0; - background: #fff; - position: relative; - margin: 10px auto 30px auto; - width: 290px; + border-radius: 4px; + padding: 0; + background: #fff; + position: relative; + margin: 10px auto 30px auto; + width: 290px; } - /* User image */ .lockscreen-image { - border-radius: 50%; - position: absolute; - left: -10px; - top: -25px; - background: #fff; - padding: 5px; - z-index: 10; + border-radius: 50%; + position: absolute; + left: -10px; + top: -25px; + background: #fff; + padding: 5px; + z-index: 10; } - .lockscreen-image > img { - border-radius: 50%; - width: 70px; - height: 70px; + border-radius: 50%; + width: 70px; + height: 70px; } - /* Contains the password input and the login button */ .lockscreen-credentials { - margin-left: 70px; + margin-left: 70px; } - .lockscreen-credentials .form-control { - border: 0; + border: 0; } - .lockscreen-credentials .btn { - background-color: #fff; - border: 0; - padding: 0 10px; + background-color: #fff; + border: 0; + padding: 0 10px; } - .lockscreen-footer { - margin-top: 10px; + margin-top: 10px; } - /* * Page: Login & Register * ---------------------- */ .login-logo, .register-logo { - font-size: 35px; - text-align: center; - margin-bottom: 25px; - font-weight: 300; + font-size: 35px; + text-align: center; + margin-bottom: 25px; + font-weight: 300; } - .login-logo a, .register-logo a { - color: #444; + color: #444; } - .login-page, .register-page { - background: #d2d6de; + background: #d2d6de; } - .login-box, .register-box { - width: 360px; - margin: 7% auto; + width: 360px; + margin: 7% auto; } - @media (max-width: 768px) { - .login-box, - .register-box { - width: 90%; - margin-top: 20px; - } + .login-box, + .register-box { + width: 90%; + margin-top: 20px; + } } - .login-box-body, .register-box-body { - background: #fff; - padding: 20px; - border-top: 0; - color: #666; + background: #fff; + padding: 20px; + border-top: 0; + color: #666; } - .login-box-body .form-control-feedback, .register-box-body .form-control-feedback { - color: #777; + color: #777; } - .login-box-msg, .register-box-msg { - margin: 0; - text-align: center; - padding: 0 20px 20px 20px; + margin: 0; + text-align: center; + padding: 0 20px 20px 20px; } - .social-auth-links { - margin: 10px 0; + margin: 10px 0; } - /* * Page: 400 and 500 error pages * ------------------------------ */ .error-page { - width: 600px; - margin: 20px auto 0 auto; + width: 600px; + margin: 20px auto 0 auto; } - @media (max-width: 991px) { - .error-page { - width: 100%; - } + .error-page { + width: 100%; + } } - .error-page > .headline { - float: left; - font-size: 100px; - font-weight: 300; + float: left; + font-size: 100px; + font-weight: 300; } - @media (max-width: 991px) { - .error-page > .headline { - float: none; - text-align: center; - } + .error-page > .headline { + float: none; + text-align: center; + } } - .error-page > .error-content { - margin-left: 190px; - display: block; + margin-left: 190px; + display: block; } - @media (max-width: 991px) { - .error-page > .error-content { - margin-left: 0; - } + .error-page > .error-content { + margin-left: 0; + } } - .error-page > .error-content > h3 { - font-weight: 300; - font-size: 25px; + font-weight: 300; + font-size: 25px; } - @media (max-width: 991px) { - .error-page > .error-content > h3 { - text-align: center; - } + .error-page > .error-content > h3 { + text-align: center; + } } - /* * Page: Invoice * ------------- */ .invoice { - position: relative; - background: #fff; - border: 1px solid #f4f4f4; - padding: 20px; - margin: 10px 25px; + position: relative; + background: #fff; + border: 1px solid #f4f4f4; + padding: 20px; + margin: 10px 25px; } - .invoice-title { - margin-top: 0; + margin-top: 0; } - /* * Page: Profile * ------------- */ .profile-user-img { - margin: 0 auto; - width: 100px; - padding: 3px; - border: 3px solid #d2d6de; + margin: 0 auto; + width: 100px; + padding: 3px; + border: 3px solid #d2d6de; } - .profile-username { - font-size: 21px; - margin-top: 5px; + font-size: 21px; + margin-top: 5px; } - .post { - border-bottom: 1px solid #d2d6de; - margin-bottom: 15px; - padding-bottom: 15px; - color: #666; + border-bottom: 1px solid #d2d6de; + margin-bottom: 15px; + padding-bottom: 15px; + color: #666; } - .post:last-of-type { - border-bottom: 0; - margin-bottom: 0; - padding-bottom: 0; + border-bottom: 0; + margin-bottom: 0; + padding-bottom: 0; } - .post .user-block { - margin-bottom: 15px; + margin-bottom: 15px; } - -/* - * Social Buttons for Bootstrap - * - * Copyright 2013-2015 Panayiotis Lipiridis - * Licensed under the MIT License - * - * https://github.com/lipis/bootstrap-social - */ .btn-social { - position: relative; - padding-left: 44px; - text-align: left; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + position: relative; + padding-left: 44px; + text-align: left; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } - .btn-social > :first-child { - position: absolute; - left: 0; - top: 0; - bottom: 0; - width: 32px; - line-height: 34px; - font-size: 1.6em; - text-align: center; - border-right: 1px solid rgba(0, 0, 0, 0.2); + position: absolute; + left: 0; + top: 0; + bottom: 0; + width: 32px; + line-height: 34px; + font-size: 1.6em; + text-align: center; + border-right: 1px solid rgba(0, 0, 0, 0.2); } - .btn-social.btn-lg { - padding-left: 61px; + padding-left: 61px; } - .btn-social.btn-lg > :first-child { - line-height: 45px; - width: 45px; - font-size: 1.8em; + line-height: 45px; + width: 45px; + font-size: 1.8em; } - .btn-social.btn-sm { - padding-left: 38px; + padding-left: 38px; } - .btn-social.btn-sm > :first-child { - line-height: 28px; - width: 28px; - font-size: 1.4em; + line-height: 28px; + width: 28px; + font-size: 1.4em; } - .btn-social.btn-xs { - padding-left: 30px; + padding-left: 30px; } - .btn-social.btn-xs > :first-child { - line-height: 20px; - width: 20px; - font-size: 1.2em; + line-height: 20px; + width: 20px; + font-size: 1.2em; } - .btn-social-icon { - position: relative; - padding-left: 44px; - text-align: left; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - height: 34px; - width: 34px; - padding: 0; + position: relative; + padding-left: 44px; + text-align: left; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + height: 34px; + width: 34px; + padding: 0; } - .btn-social-icon > :first-child { - position: absolute; - left: 0; - top: 0; - bottom: 0; - width: 32px; - line-height: 34px; - font-size: 1.6em; - text-align: center; - border-right: 1px solid rgba(0, 0, 0, 0.2); + position: absolute; + left: 0; + top: 0; + bottom: 0; + width: 32px; + line-height: 34px; + font-size: 1.6em; + text-align: center; + border-right: 1px solid rgba(0, 0, 0, 0.2); } - .btn-social-icon.btn-lg { - padding-left: 61px; + padding-left: 61px; } - .btn-social-icon.btn-lg > :first-child { - line-height: 45px; - width: 45px; - font-size: 1.8em; + line-height: 45px; + width: 45px; + font-size: 1.8em; } - .btn-social-icon.btn-sm { - padding-left: 38px; + padding-left: 38px; } - .btn-social-icon.btn-sm > :first-child { - line-height: 28px; - width: 28px; - font-size: 1.4em; + line-height: 28px; + width: 28px; + font-size: 1.4em; } - .btn-social-icon.btn-xs { - padding-left: 30px; + padding-left: 30px; } - .btn-social-icon.btn-xs > :first-child { - line-height: 20px; - width: 20px; - font-size: 1.2em; + line-height: 20px; + width: 20px; + font-size: 1.2em; } - .btn-social-icon > :first-child { - border: none; - text-align: center; - width: 100%; + border: none; + text-align: center; + width: 100%; } - .btn-social-icon.btn-lg { - height: 45px; - width: 45px; - padding-left: 0; - padding-right: 0; + height: 45px; + width: 45px; + padding-left: 0; + padding-right: 0; } - .btn-social-icon.btn-sm { - height: 30px; - width: 30px; - padding-left: 0; - padding-right: 0; + height: 30px; + width: 30px; + padding-left: 0; + padding-right: 0; } - .btn-social-icon.btn-xs { - height: 22px; - width: 22px; - padding-left: 0; - padding-right: 0; + height: 22px; + width: 22px; + padding-left: 0; + padding-right: 0; } - .btn-adn { - color: #ffffff; - background-color: #d87a68; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #d87a68; + border-color: rgba(0, 0, 0, 0.2); } - .btn-adn:focus, .btn-adn.focus { - color: #ffffff; - background-color: #ce563f; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #ce563f; + border-color: rgba(0, 0, 0, 0.2); } - .btn-adn:hover { - color: #ffffff; - background-color: #ce563f; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #ce563f; + border-color: rgba(0, 0, 0, 0.2); } - .btn-adn:active, .btn-adn.active, .open > .dropdown-toggle.btn-adn { - color: #ffffff; - background-color: #ce563f; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #ce563f; + border-color: rgba(0, 0, 0, 0.2); } - .btn-adn:active, .btn-adn.active, .open > .dropdown-toggle.btn-adn { - background-image: none; + background-image: none; } - .btn-adn .badge { - color: #d87a68; - background-color: #ffffff; + color: #d87a68; + background-color: #ffffff; +} +.btn-adn:focus, +.btn-adn.focus { + color: #ffffff; + background-color: #ce563f; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-adn:hover { + color: #ffffff; + background-color: #ce563f; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-adn:active, +.btn-adn.active, +.open > .dropdown-toggle.btn-adn { + color: #ffffff; + background-color: #ce563f; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-adn:active, +.btn-adn.active, +.open > .dropdown-toggle.btn-adn { + background-image: none; +} +.btn-adn .badge { + color: #d87a68; + background-color: #ffffff; } - .btn-bitbucket { - color: #ffffff; - background-color: #205081; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #205081; + border-color: rgba(0, 0, 0, 0.2); } - .btn-bitbucket:focus, .btn-bitbucket.focus { - color: #ffffff; - background-color: #163758; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #163758; + border-color: rgba(0, 0, 0, 0.2); } - .btn-bitbucket:hover { - color: #ffffff; - background-color: #163758; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #163758; + border-color: rgba(0, 0, 0, 0.2); } - .btn-bitbucket:active, .btn-bitbucket.active, .open > .dropdown-toggle.btn-bitbucket { - color: #ffffff; - background-color: #163758; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #163758; + border-color: rgba(0, 0, 0, 0.2); } - .btn-bitbucket:active, .btn-bitbucket.active, .open > .dropdown-toggle.btn-bitbucket { - background-image: none; + background-image: none; } - .btn-bitbucket .badge { - color: #205081; - background-color: #ffffff; + color: #205081; + background-color: #ffffff; +} +.btn-bitbucket:focus, +.btn-bitbucket.focus { + color: #ffffff; + background-color: #163758; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-bitbucket:hover { + color: #ffffff; + background-color: #163758; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-bitbucket:active, +.btn-bitbucket.active, +.open > .dropdown-toggle.btn-bitbucket { + color: #ffffff; + background-color: #163758; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-bitbucket:active, +.btn-bitbucket.active, +.open > .dropdown-toggle.btn-bitbucket { + background-image: none; +} +.btn-bitbucket .badge { + color: #205081; + background-color: #ffffff; } - .btn-dropbox { - color: #ffffff; - background-color: #1087dd; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #1087dd; + border-color: rgba(0, 0, 0, 0.2); } - .btn-dropbox:focus, .btn-dropbox.focus { - color: #ffffff; - background-color: #0d6aad; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #0d6aad; + border-color: rgba(0, 0, 0, 0.2); } - .btn-dropbox:hover { - color: #ffffff; - background-color: #0d6aad; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #0d6aad; + border-color: rgba(0, 0, 0, 0.2); } - .btn-dropbox:active, .btn-dropbox.active, .open > .dropdown-toggle.btn-dropbox { - color: #ffffff; - background-color: #0d6aad; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #0d6aad; + border-color: rgba(0, 0, 0, 0.2); } - .btn-dropbox:active, .btn-dropbox.active, .open > .dropdown-toggle.btn-dropbox { - background-image: none; + background-image: none; } - .btn-dropbox .badge { - color: #1087dd; - background-color: #ffffff; + color: #1087dd; + background-color: #ffffff; +} +.btn-dropbox:focus, +.btn-dropbox.focus { + color: #ffffff; + background-color: #0d6aad; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-dropbox:hover { + color: #ffffff; + background-color: #0d6aad; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-dropbox:active, +.btn-dropbox.active, +.open > .dropdown-toggle.btn-dropbox { + color: #ffffff; + background-color: #0d6aad; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-dropbox:active, +.btn-dropbox.active, +.open > .dropdown-toggle.btn-dropbox { + background-image: none; +} +.btn-dropbox .badge { + color: #1087dd; + background-color: #ffffff; } - .btn-facebook { - color: #ffffff; - background-color: #3b5998; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #3b5998; + border-color: rgba(0, 0, 0, 0.2); } - .btn-facebook:focus, .btn-facebook.focus { - color: #ffffff; - background-color: #2d4373; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #2d4373; + border-color: rgba(0, 0, 0, 0.2); } - .btn-facebook:hover { - color: #ffffff; - background-color: #2d4373; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #2d4373; + border-color: rgba(0, 0, 0, 0.2); } - .btn-facebook:active, .btn-facebook.active, .open > .dropdown-toggle.btn-facebook { - color: #ffffff; - background-color: #2d4373; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #2d4373; + border-color: rgba(0, 0, 0, 0.2); } - .btn-facebook:active, .btn-facebook.active, .open > .dropdown-toggle.btn-facebook { - background-image: none; + background-image: none; } - .btn-facebook .badge { - color: #3b5998; - background-color: #ffffff; + color: #3b5998; + background-color: #ffffff; +} +.btn-facebook:focus, +.btn-facebook.focus { + color: #ffffff; + background-color: #2d4373; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-facebook:hover { + color: #ffffff; + background-color: #2d4373; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-facebook:active, +.btn-facebook.active, +.open > .dropdown-toggle.btn-facebook { + color: #ffffff; + background-color: #2d4373; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-facebook:active, +.btn-facebook.active, +.open > .dropdown-toggle.btn-facebook { + background-image: none; +} +.btn-facebook .badge { + color: #3b5998; + background-color: #ffffff; } - .btn-flickr { - color: #ffffff; - background-color: #ff0084; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #ff0084; + border-color: rgba(0, 0, 0, 0.2); } - .btn-flickr:focus, .btn-flickr.focus { - color: #ffffff; - background-color: #cc006a; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #cc006a; + border-color: rgba(0, 0, 0, 0.2); } - .btn-flickr:hover { - color: #ffffff; - background-color: #cc006a; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #cc006a; + border-color: rgba(0, 0, 0, 0.2); } - .btn-flickr:active, .btn-flickr.active, .open > .dropdown-toggle.btn-flickr { - color: #ffffff; - background-color: #cc006a; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #cc006a; + border-color: rgba(0, 0, 0, 0.2); } - .btn-flickr:active, .btn-flickr.active, .open > .dropdown-toggle.btn-flickr { - background-image: none; + background-image: none; } - .btn-flickr .badge { - color: #ff0084; - background-color: #ffffff; + color: #ff0084; + background-color: #ffffff; +} +.btn-flickr:focus, +.btn-flickr.focus { + color: #ffffff; + background-color: #cc006a; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-flickr:hover { + color: #ffffff; + background-color: #cc006a; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-flickr:active, +.btn-flickr.active, +.open > .dropdown-toggle.btn-flickr { + color: #ffffff; + background-color: #cc006a; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-flickr:active, +.btn-flickr.active, +.open > .dropdown-toggle.btn-flickr { + background-image: none; +} +.btn-flickr .badge { + color: #ff0084; + background-color: #ffffff; } - .btn-foursquare { - color: #ffffff; - background-color: #f94877; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #f94877; + border-color: rgba(0, 0, 0, 0.2); } - .btn-foursquare:focus, .btn-foursquare.focus { - color: #ffffff; - background-color: #f71752; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #f71752; + border-color: rgba(0, 0, 0, 0.2); } - .btn-foursquare:hover { - color: #ffffff; - background-color: #f71752; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #f71752; + border-color: rgba(0, 0, 0, 0.2); } - .btn-foursquare:active, .btn-foursquare.active, .open > .dropdown-toggle.btn-foursquare { - color: #ffffff; - background-color: #f71752; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #f71752; + border-color: rgba(0, 0, 0, 0.2); } - .btn-foursquare:active, .btn-foursquare.active, .open > .dropdown-toggle.btn-foursquare { - background-image: none; + background-image: none; } - .btn-foursquare .badge { - color: #f94877; - background-color: #ffffff; + color: #f94877; + background-color: #ffffff; +} +.btn-foursquare:focus, +.btn-foursquare.focus { + color: #ffffff; + background-color: #f71752; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-foursquare:hover { + color: #ffffff; + background-color: #f71752; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-foursquare:active, +.btn-foursquare.active, +.open > .dropdown-toggle.btn-foursquare { + color: #ffffff; + background-color: #f71752; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-foursquare:active, +.btn-foursquare.active, +.open > .dropdown-toggle.btn-foursquare { + background-image: none; +} +.btn-foursquare .badge { + color: #f94877; + background-color: #ffffff; } - .btn-github { - color: #ffffff; - background-color: #444444; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #444444; + border-color: rgba(0, 0, 0, 0.2); } - .btn-github:focus, .btn-github.focus { - color: #ffffff; - background-color: #2b2b2b; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #2b2b2b; + border-color: rgba(0, 0, 0, 0.2); } - .btn-github:hover { - color: #ffffff; - background-color: #2b2b2b; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #2b2b2b; + border-color: rgba(0, 0, 0, 0.2); } - .btn-github:active, .btn-github.active, .open > .dropdown-toggle.btn-github { - color: #ffffff; - background-color: #2b2b2b; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #2b2b2b; + border-color: rgba(0, 0, 0, 0.2); } - .btn-github:active, .btn-github.active, .open > .dropdown-toggle.btn-github { - background-image: none; + background-image: none; } - .btn-github .badge { - color: #444444; - background-color: #ffffff; + color: #444444; + background-color: #ffffff; +} +.btn-github:focus, +.btn-github.focus { + color: #ffffff; + background-color: #2b2b2b; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-github:hover { + color: #ffffff; + background-color: #2b2b2b; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-github:active, +.btn-github.active, +.open > .dropdown-toggle.btn-github { + color: #ffffff; + background-color: #2b2b2b; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-github:active, +.btn-github.active, +.open > .dropdown-toggle.btn-github { + background-image: none; +} +.btn-github .badge { + color: #444444; + background-color: #ffffff; } - .btn-google { - color: #ffffff; - background-color: #dd4b39; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #dd4b39; + border-color: rgba(0, 0, 0, 0.2); } - .btn-google:focus, .btn-google.focus { - color: #ffffff; - background-color: #c23321; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #c23321; + border-color: rgba(0, 0, 0, 0.2); } - .btn-google:hover { - color: #ffffff; - background-color: #c23321; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #c23321; + border-color: rgba(0, 0, 0, 0.2); } - .btn-google:active, .btn-google.active, .open > .dropdown-toggle.btn-google { - color: #ffffff; - background-color: #c23321; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #c23321; + border-color: rgba(0, 0, 0, 0.2); } - .btn-google:active, .btn-google.active, .open > .dropdown-toggle.btn-google { - background-image: none; + background-image: none; } - .btn-google .badge { - color: #dd4b39; - background-color: #ffffff; + color: #dd4b39; + background-color: #ffffff; +} +.btn-google:focus, +.btn-google.focus { + color: #ffffff; + background-color: #c23321; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-google:hover { + color: #ffffff; + background-color: #c23321; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-google:active, +.btn-google.active, +.open > .dropdown-toggle.btn-google { + color: #ffffff; + background-color: #c23321; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-google:active, +.btn-google.active, +.open > .dropdown-toggle.btn-google { + background-image: none; +} +.btn-google .badge { + color: #dd4b39; + background-color: #ffffff; } - .btn-instagram { - color: #ffffff; - background-color: #3f729b; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #3f729b; + border-color: rgba(0, 0, 0, 0.2); } - .btn-instagram:focus, .btn-instagram.focus { - color: #ffffff; - background-color: #305777; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #305777; + border-color: rgba(0, 0, 0, 0.2); } - .btn-instagram:hover { - color: #ffffff; - background-color: #305777; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #305777; + border-color: rgba(0, 0, 0, 0.2); } - .btn-instagram:active, .btn-instagram.active, .open > .dropdown-toggle.btn-instagram { - color: #ffffff; - background-color: #305777; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #305777; + border-color: rgba(0, 0, 0, 0.2); } - .btn-instagram:active, .btn-instagram.active, .open > .dropdown-toggle.btn-instagram { - background-image: none; + background-image: none; } - .btn-instagram .badge { - color: #3f729b; - background-color: #ffffff; + color: #3f729b; + background-color: #ffffff; +} +.btn-instagram:focus, +.btn-instagram.focus { + color: #ffffff; + background-color: #305777; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-instagram:hover { + color: #ffffff; + background-color: #305777; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-instagram:active, +.btn-instagram.active, +.open > .dropdown-toggle.btn-instagram { + color: #ffffff; + background-color: #305777; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-instagram:active, +.btn-instagram.active, +.open > .dropdown-toggle.btn-instagram { + background-image: none; +} +.btn-instagram .badge { + color: #3f729b; + background-color: #ffffff; } - .btn-linkedin { - color: #ffffff; - background-color: #007bb6; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #007bb6; + border-color: rgba(0, 0, 0, 0.2); } - .btn-linkedin:focus, .btn-linkedin.focus { - color: #ffffff; - background-color: #005983; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #005983; + border-color: rgba(0, 0, 0, 0.2); } - .btn-linkedin:hover { - color: #ffffff; - background-color: #005983; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #005983; + border-color: rgba(0, 0, 0, 0.2); } - .btn-linkedin:active, .btn-linkedin.active, .open > .dropdown-toggle.btn-linkedin { - color: #ffffff; - background-color: #005983; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #005983; + border-color: rgba(0, 0, 0, 0.2); } - .btn-linkedin:active, .btn-linkedin.active, .open > .dropdown-toggle.btn-linkedin { - background-image: none; + background-image: none; } - .btn-linkedin .badge { - color: #007bb6; - background-color: #ffffff; + color: #007bb6; + background-color: #ffffff; +} +.btn-linkedin:focus, +.btn-linkedin.focus { + color: #ffffff; + background-color: #005983; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-linkedin:hover { + color: #ffffff; + background-color: #005983; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-linkedin:active, +.btn-linkedin.active, +.open > .dropdown-toggle.btn-linkedin { + color: #ffffff; + background-color: #005983; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-linkedin:active, +.btn-linkedin.active, +.open > .dropdown-toggle.btn-linkedin { + background-image: none; +} +.btn-linkedin .badge { + color: #007bb6; + background-color: #ffffff; } - .btn-microsoft { - color: #ffffff; - background-color: #2672ec; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #2672ec; + border-color: rgba(0, 0, 0, 0.2); } - .btn-microsoft:focus, .btn-microsoft.focus { - color: #ffffff; - background-color: #125acd; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #125acd; + border-color: rgba(0, 0, 0, 0.2); } - .btn-microsoft:hover { - color: #ffffff; - background-color: #125acd; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #125acd; + border-color: rgba(0, 0, 0, 0.2); } - .btn-microsoft:active, .btn-microsoft.active, .open > .dropdown-toggle.btn-microsoft { - color: #ffffff; - background-color: #125acd; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #125acd; + border-color: rgba(0, 0, 0, 0.2); } - .btn-microsoft:active, .btn-microsoft.active, .open > .dropdown-toggle.btn-microsoft { - background-image: none; + background-image: none; } - .btn-microsoft .badge { - color: #2672ec; - background-color: #ffffff; + color: #2672ec; + background-color: #ffffff; +} +.btn-microsoft:focus, +.btn-microsoft.focus { + color: #ffffff; + background-color: #125acd; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-microsoft:hover { + color: #ffffff; + background-color: #125acd; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-microsoft:active, +.btn-microsoft.active, +.open > .dropdown-toggle.btn-microsoft { + color: #ffffff; + background-color: #125acd; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-microsoft:active, +.btn-microsoft.active, +.open > .dropdown-toggle.btn-microsoft { + background-image: none; +} +.btn-microsoft .badge { + color: #2672ec; + background-color: #ffffff; } - .btn-openid { - color: #ffffff; - background-color: #f7931e; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #f7931e; + border-color: rgba(0, 0, 0, 0.2); } - .btn-openid:focus, .btn-openid.focus { - color: #ffffff; - background-color: #da7908; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #da7908; + border-color: rgba(0, 0, 0, 0.2); } - .btn-openid:hover { - color: #ffffff; - background-color: #da7908; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #da7908; + border-color: rgba(0, 0, 0, 0.2); } - .btn-openid:active, .btn-openid.active, .open > .dropdown-toggle.btn-openid { - color: #ffffff; - background-color: #da7908; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #da7908; + border-color: rgba(0, 0, 0, 0.2); } - .btn-openid:active, .btn-openid.active, .open > .dropdown-toggle.btn-openid { - background-image: none; + background-image: none; } - .btn-openid .badge { - color: #f7931e; - background-color: #ffffff; + color: #f7931e; + background-color: #ffffff; +} +.btn-openid:focus, +.btn-openid.focus { + color: #ffffff; + background-color: #da7908; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-openid:hover { + color: #ffffff; + background-color: #da7908; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-openid:active, +.btn-openid.active, +.open > .dropdown-toggle.btn-openid { + color: #ffffff; + background-color: #da7908; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-openid:active, +.btn-openid.active, +.open > .dropdown-toggle.btn-openid { + background-image: none; +} +.btn-openid .badge { + color: #f7931e; + background-color: #ffffff; } - .btn-pinterest { - color: #ffffff; - background-color: #cb2027; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #cb2027; + border-color: rgba(0, 0, 0, 0.2); } - .btn-pinterest:focus, .btn-pinterest.focus { - color: #ffffff; - background-color: #9f191f; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #9f191f; + border-color: rgba(0, 0, 0, 0.2); } - .btn-pinterest:hover { - color: #ffffff; - background-color: #9f191f; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #9f191f; + border-color: rgba(0, 0, 0, 0.2); } - .btn-pinterest:active, .btn-pinterest.active, .open > .dropdown-toggle.btn-pinterest { - color: #ffffff; - background-color: #9f191f; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #9f191f; + border-color: rgba(0, 0, 0, 0.2); } - .btn-pinterest:active, .btn-pinterest.active, .open > .dropdown-toggle.btn-pinterest { - background-image: none; + background-image: none; } - .btn-pinterest .badge { - color: #cb2027; - background-color: #ffffff; + color: #cb2027; + background-color: #ffffff; +} +.btn-pinterest:focus, +.btn-pinterest.focus { + color: #ffffff; + background-color: #9f191f; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-pinterest:hover { + color: #ffffff; + background-color: #9f191f; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-pinterest:active, +.btn-pinterest.active, +.open > .dropdown-toggle.btn-pinterest { + color: #ffffff; + background-color: #9f191f; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-pinterest:active, +.btn-pinterest.active, +.open > .dropdown-toggle.btn-pinterest { + background-image: none; +} +.btn-pinterest .badge { + color: #cb2027; + background-color: #ffffff; } - .btn-reddit { - color: #000000; - background-color: #eff7ff; - border-color: rgba(0, 0, 0, 0.2); + color: #000000; + background-color: #eff7ff; + border-color: rgba(0, 0, 0, 0.2); } - .btn-reddit:focus, .btn-reddit.focus { - color: #000000; - background-color: #bcddff; - border-color: rgba(0, 0, 0, 0.2); + color: #000000; + background-color: #bcddff; + border-color: rgba(0, 0, 0, 0.2); } - .btn-reddit:hover { - color: #000000; - background-color: #bcddff; - border-color: rgba(0, 0, 0, 0.2); + color: #000000; + background-color: #bcddff; + border-color: rgba(0, 0, 0, 0.2); } - .btn-reddit:active, .btn-reddit.active, .open > .dropdown-toggle.btn-reddit { - color: #000000; - background-color: #bcddff; - border-color: rgba(0, 0, 0, 0.2); + color: #000000; + background-color: #bcddff; + border-color: rgba(0, 0, 0, 0.2); } - .btn-reddit:active, .btn-reddit.active, .open > .dropdown-toggle.btn-reddit { - background-image: none; + background-image: none; } - .btn-reddit .badge { - color: #eff7ff; - background-color: #000000; + color: #eff7ff; + background-color: #000000; +} +.btn-reddit:focus, +.btn-reddit.focus { + color: #000000; + background-color: #bcddff; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-reddit:hover { + color: #000000; + background-color: #bcddff; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-reddit:active, +.btn-reddit.active, +.open > .dropdown-toggle.btn-reddit { + color: #000000; + background-color: #bcddff; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-reddit:active, +.btn-reddit.active, +.open > .dropdown-toggle.btn-reddit { + background-image: none; +} +.btn-reddit .badge { + color: #eff7ff; + background-color: #000000; } - .btn-soundcloud { - color: #ffffff; - background-color: #ff5500; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #ff5500; + border-color: rgba(0, 0, 0, 0.2); } - .btn-soundcloud:focus, .btn-soundcloud.focus { - color: #ffffff; - background-color: #cc4400; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #cc4400; + border-color: rgba(0, 0, 0, 0.2); } - .btn-soundcloud:hover { - color: #ffffff; - background-color: #cc4400; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #cc4400; + border-color: rgba(0, 0, 0, 0.2); } - .btn-soundcloud:active, .btn-soundcloud.active, .open > .dropdown-toggle.btn-soundcloud { - color: #ffffff; - background-color: #cc4400; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #cc4400; + border-color: rgba(0, 0, 0, 0.2); } - .btn-soundcloud:active, .btn-soundcloud.active, .open > .dropdown-toggle.btn-soundcloud { - background-image: none; + background-image: none; } - .btn-soundcloud .badge { - color: #ff5500; - background-color: #ffffff; + color: #ff5500; + background-color: #ffffff; +} +.btn-soundcloud:focus, +.btn-soundcloud.focus { + color: #ffffff; + background-color: #cc4400; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-soundcloud:hover { + color: #ffffff; + background-color: #cc4400; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-soundcloud:active, +.btn-soundcloud.active, +.open > .dropdown-toggle.btn-soundcloud { + color: #ffffff; + background-color: #cc4400; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-soundcloud:active, +.btn-soundcloud.active, +.open > .dropdown-toggle.btn-soundcloud { + background-image: none; +} +.btn-soundcloud .badge { + color: #ff5500; + background-color: #ffffff; } - .btn-tumblr { - color: #ffffff; - background-color: #2c4762; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #2c4762; + border-color: rgba(0, 0, 0, 0.2); } - .btn-tumblr:focus, .btn-tumblr.focus { - color: #ffffff; - background-color: #1c2d3f; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #1c2d3f; + border-color: rgba(0, 0, 0, 0.2); } - .btn-tumblr:hover { - color: #ffffff; - background-color: #1c2d3f; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #1c2d3f; + border-color: rgba(0, 0, 0, 0.2); } - .btn-tumblr:active, .btn-tumblr.active, .open > .dropdown-toggle.btn-tumblr { - color: #ffffff; - background-color: #1c2d3f; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #1c2d3f; + border-color: rgba(0, 0, 0, 0.2); } - .btn-tumblr:active, .btn-tumblr.active, .open > .dropdown-toggle.btn-tumblr { - background-image: none; + background-image: none; } - .btn-tumblr .badge { - color: #2c4762; - background-color: #ffffff; + color: #2c4762; + background-color: #ffffff; +} +.btn-tumblr:focus, +.btn-tumblr.focus { + color: #ffffff; + background-color: #1c2d3f; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-tumblr:hover { + color: #ffffff; + background-color: #1c2d3f; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-tumblr:active, +.btn-tumblr.active, +.open > .dropdown-toggle.btn-tumblr { + color: #ffffff; + background-color: #1c2d3f; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-tumblr:active, +.btn-tumblr.active, +.open > .dropdown-toggle.btn-tumblr { + background-image: none; +} +.btn-tumblr .badge { + color: #2c4762; + background-color: #ffffff; } - .btn-twitter { - color: #ffffff; - background-color: #55acee; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #55acee; + border-color: rgba(0, 0, 0, 0.2); } - .btn-twitter:focus, .btn-twitter.focus { - color: #ffffff; - background-color: #2795e9; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #2795e9; + border-color: rgba(0, 0, 0, 0.2); } - .btn-twitter:hover { - color: #ffffff; - background-color: #2795e9; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #2795e9; + border-color: rgba(0, 0, 0, 0.2); } - .btn-twitter:active, .btn-twitter.active, .open > .dropdown-toggle.btn-twitter { - color: #ffffff; - background-color: #2795e9; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #2795e9; + border-color: rgba(0, 0, 0, 0.2); } - .btn-twitter:active, .btn-twitter.active, .open > .dropdown-toggle.btn-twitter { - background-image: none; + background-image: none; } - .btn-twitter .badge { - color: #55acee; - background-color: #ffffff; + color: #55acee; + background-color: #ffffff; +} +.btn-twitter:focus, +.btn-twitter.focus { + color: #ffffff; + background-color: #2795e9; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-twitter:hover { + color: #ffffff; + background-color: #2795e9; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-twitter:active, +.btn-twitter.active, +.open > .dropdown-toggle.btn-twitter { + color: #ffffff; + background-color: #2795e9; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-twitter:active, +.btn-twitter.active, +.open > .dropdown-toggle.btn-twitter { + background-image: none; +} +.btn-twitter .badge { + color: #55acee; + background-color: #ffffff; } - .btn-vimeo { - color: #ffffff; - background-color: #1ab7ea; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #1ab7ea; + border-color: rgba(0, 0, 0, 0.2); } - .btn-vimeo:focus, .btn-vimeo.focus { - color: #ffffff; - background-color: #1295bf; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #1295bf; + border-color: rgba(0, 0, 0, 0.2); } - .btn-vimeo:hover { - color: #ffffff; - background-color: #1295bf; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #1295bf; + border-color: rgba(0, 0, 0, 0.2); } - .btn-vimeo:active, .btn-vimeo.active, .open > .dropdown-toggle.btn-vimeo { - color: #ffffff; - background-color: #1295bf; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #1295bf; + border-color: rgba(0, 0, 0, 0.2); } - .btn-vimeo:active, .btn-vimeo.active, .open > .dropdown-toggle.btn-vimeo { - background-image: none; + background-image: none; } - .btn-vimeo .badge { - color: #1ab7ea; - background-color: #ffffff; + color: #1ab7ea; + background-color: #ffffff; +} +.btn-vimeo:focus, +.btn-vimeo.focus { + color: #ffffff; + background-color: #1295bf; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-vimeo:hover { + color: #ffffff; + background-color: #1295bf; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-vimeo:active, +.btn-vimeo.active, +.open > .dropdown-toggle.btn-vimeo { + color: #ffffff; + background-color: #1295bf; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-vimeo:active, +.btn-vimeo.active, +.open > .dropdown-toggle.btn-vimeo { + background-image: none; +} +.btn-vimeo .badge { + color: #1ab7ea; + background-color: #ffffff; } - .btn-vk { - color: #ffffff; - background-color: #587ea3; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #587ea3; + border-color: rgba(0, 0, 0, 0.2); } - .btn-vk:focus, .btn-vk.focus { - color: #ffffff; - background-color: #466482; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #466482; + border-color: rgba(0, 0, 0, 0.2); } - .btn-vk:hover { - color: #ffffff; - background-color: #466482; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #466482; + border-color: rgba(0, 0, 0, 0.2); } - .btn-vk:active, .btn-vk.active, .open > .dropdown-toggle.btn-vk { - color: #ffffff; - background-color: #466482; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #466482; + border-color: rgba(0, 0, 0, 0.2); } - .btn-vk:active, .btn-vk.active, .open > .dropdown-toggle.btn-vk { - background-image: none; + background-image: none; } - .btn-vk .badge { - color: #587ea3; - background-color: #ffffff; + color: #587ea3; + background-color: #ffffff; +} +.btn-vk:focus, +.btn-vk.focus { + color: #ffffff; + background-color: #466482; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-vk:hover { + color: #ffffff; + background-color: #466482; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-vk:active, +.btn-vk.active, +.open > .dropdown-toggle.btn-vk { + color: #ffffff; + background-color: #466482; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-vk:active, +.btn-vk.active, +.open > .dropdown-toggle.btn-vk { + background-image: none; +} +.btn-vk .badge { + color: #587ea3; + background-color: #ffffff; } - .btn-yahoo { - color: #ffffff; - background-color: #720e9e; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #720e9e; + border-color: rgba(0, 0, 0, 0.2); } - .btn-yahoo:focus, .btn-yahoo.focus { - color: #ffffff; - background-color: #500a6f; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #500a6f; + border-color: rgba(0, 0, 0, 0.2); } - .btn-yahoo:hover { - color: #ffffff; - background-color: #500a6f; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #500a6f; + border-color: rgba(0, 0, 0, 0.2); } - .btn-yahoo:active, .btn-yahoo.active, .open > .dropdown-toggle.btn-yahoo { - color: #ffffff; - background-color: #500a6f; - border-color: rgba(0, 0, 0, 0.2); + color: #ffffff; + background-color: #500a6f; + border-color: rgba(0, 0, 0, 0.2); } - .btn-yahoo:active, .btn-yahoo.active, .open > .dropdown-toggle.btn-yahoo { - background-image: none; + background-image: none; } - .btn-yahoo .badge { - color: #720e9e; - background-color: #ffffff; + color: #720e9e; + background-color: #ffffff; +} +.btn-yahoo:focus, +.btn-yahoo.focus { + color: #ffffff; + background-color: #500a6f; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-yahoo:hover { + color: #ffffff; + background-color: #500a6f; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-yahoo:active, +.btn-yahoo.active, +.open > .dropdown-toggle.btn-yahoo { + color: #ffffff; + background-color: #500a6f; + border-color: rgba(0, 0, 0, 0.2); +} +.btn-yahoo:active, +.btn-yahoo.active, +.open > .dropdown-toggle.btn-yahoo { + background-image: none; +} +.btn-yahoo .badge { + color: #720e9e; + background-color: #ffffff; } - /* * Plugin: Full Calendar * --------------------- */ .fc-button { - background: #f4f4f4; - background-image: none; - color: #444; - border-color: #ddd; - border-bottom-color: #ddd; + background: #f4f4f4; + background-image: none; + color: #444; + border-color: #ddd; + border-bottom-color: #ddd; } - .fc-button:hover, .fc-button:active, .fc-button.hover { - background-color: #e9e9e9; + background-color: #e9e9e9; } - .fc-header-title h2 { - font-size: 15px; - line-height: 1.6em; - color: #666; - margin-left: 10px; + font-size: 15px; + line-height: 1.6em; + color: #666; + margin-left: 10px; } - .fc-header-right { - padding-right: 10px; + padding-right: 10px; } - .fc-header-left { - padding-left: 10px; + padding-left: 10px; } - .fc-widget-header { - background: #fafafa; + background: #fafafa; } - .fc-grid { - width: 100%; - border: 0; + width: 100%; + border: 0; } - .fc-widget-header:first-of-type, .fc-widget-content:first-of-type { - border-left: 0; - border-right: 0; + border-left: 0; + border-right: 0; } - .fc-widget-header:last-of-type, .fc-widget-content:last-of-type { - border-right: 0; + border-right: 0; } - .fc-toolbar { - padding: 10px; - margin: 0; + padding: 10px; + margin: 0; } - .fc-day-number { - font-size: 20px; - font-weight: 300; - padding-right: 10px; + font-size: 20px; + font-weight: 300; + padding-right: 10px; } - .fc-color-picker { - list-style: none; - margin: 0; - padding: 0; + list-style: none; + margin: 0; + padding: 0; } - .fc-color-picker > li { - float: left; - font-size: 30px; - margin-right: 5px; - line-height: 30px; + float: left; + font-size: 30px; + margin-right: 5px; + line-height: 30px; } - .fc-color-picker > li .fa { - -webkit-transition: -webkit-transform linear 0.3s; - -moz-transition: -moz-transform linear 0.3s; - -o-transition: -o-transform linear 0.3s; - transition: transform linear 0.3s; + -webkit-transition: -webkit-transform linear 0.3s; + -moz-transition: -moz-transform linear 0.3s; + -o-transition: -o-transform linear 0.3s; + transition: transform linear 0.3s; } - .fc-color-picker > li .fa:hover { - -webkit-transform: rotate(30deg); - -ms-transform: rotate(30deg); - -o-transform: rotate(30deg); - transform: rotate(30deg); + -webkit-transform: rotate(30deg); + -ms-transform: rotate(30deg); + -o-transform: rotate(30deg); + transform: rotate(30deg); } - #add-new-event { - -webkit-transition: all linear 0.3s; - -o-transition: all linear 0.3s; - transition: all linear 0.3s; + -webkit-transition: all linear 0.3s; + -o-transition: all linear 0.3s; + transition: all linear 0.3s; } - .external-event { - padding: 5px 10px; - font-weight: bold; - margin-bottom: 4px; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); - text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); - border-radius: 3px; - cursor: move; + padding: 5px 10px; + font-weight: bold; + margin-bottom: 4px; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + border-radius: 3px; + cursor: move; } - .external-event:hover { - box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.2); + box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.2); } - /* * Plugin: Select2 * --------------- @@ -5018,164 +4930,157 @@ table.text-center th { .select2-selection:focus, .select2-container--default:active, .select2-selection:active { - outline: none; + outline: none; } - .select2-container--default .select2-selection--single, .select2-selection .select2-selection--single { - border: 1px solid #d2d6de; - border-radius: 0; - padding: 6px 12px; - height: 34px; + border: 1px solid #d2d6de; + border-radius: 0; + padding: 6px 12px; + height: 34px; } - .select2-container--default.select2-container--open { - border-color: #3c8dbc; + border-color: #3c8dbc; } - .select2-dropdown { - border: 1px solid #d2d6de; - border-radius: 0; + border: 1px solid #d2d6de; + border-radius: 0; } - .select2-container--default .select2-results__option--highlighted[aria-selected] { - background-color: #3c8dbc; - color: white; + background-color: #3c8dbc; + color: white; } - .select2-results__option { - padding: 6px 12px; - user-select: none; - -webkit-user-select: none; + padding: 6px 12px; + user-select: none; + -webkit-user-select: none; } - .select2-container .select2-selection--single .select2-selection__rendered { - padding-left: 0; - padding-right: 0; - height: auto; - margin-top: -4px; + padding-left: 0; + padding-right: 0; + height: auto; + margin-top: -4px; } - .select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered { - padding-right: 6px; - padding-left: 20px; + padding-right: 6px; + padding-left: 20px; } - .select2-container--default .select2-selection--single .select2-selection__arrow { - height: 28px; - right: 3px; + height: 28px; + right: 3px; } - .select2-container--default .select2-selection--single .select2-selection__arrow b { - margin-top: 0; + margin-top: 0; } - .select2-dropdown .select2-search__field, .select2-search--inline .select2-search__field { - border: 1px solid #d2d6de; + border: 1px solid #d2d6de; } - .select2-dropdown .select2-search__field:focus, .select2-search--inline .select2-search__field:focus { - outline: none; - border: 1px solid #3c8dbc; + outline: none; +} +.select2-container--default.select2-container--focus .select2-selection--multiple, +.select2-container--default .select2-search--dropdown .select2-search__field { + border-color: #3c8dbc !important; } - .select2-container--default .select2-results__option[aria-disabled=true] { - color: #999; + color: #999; } - .select2-container--default .select2-results__option[aria-selected=true] { - background-color: #ddd; + background-color: #ddd; } - .select2-container--default .select2-results__option[aria-selected=true], .select2-container--default .select2-results__option[aria-selected=true]:hover { - color: #444; + color: #444; } - .select2-container--default .select2-selection--multiple { - border: 1px solid #d2d6de; - border-radius: 0; + border: 1px solid #d2d6de; + border-radius: 0; } - .select2-container--default .select2-selection--multiple:focus { - border-color: #3c8dbc; + border-color: #3c8dbc; } - .select2-container--default.select2-container--focus .select2-selection--multiple { - border-color: #d2d6de; + border-color: #d2d6de; } - .select2-container--default .select2-selection--multiple .select2-selection__choice { - background-color: #3c8dbc; - border-color: #367fa9; - padding: 1px 10px; - color: #fff; + background-color: #3c8dbc; + border-color: #367fa9; + padding: 1px 10px; + color: #fff; } - .select2-container--default .select2-selection--multiple .select2-selection__choice__remove { - margin-right: 5px; - color: rgba(255, 255, 255, 0.7); + margin-right: 5px; + color: rgba(255, 255, 255, 0.7); } - .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover { - color: #fff; + color: #fff; } - .select2-container .select2-selection--single .select2-selection__rendered { - padding-right: 10px; + padding-right: 10px; +} +.box .datepicker-inline, +.box .datepicker-inline .datepicker-days, +.box .datepicker-inline > table, +.box .datepicker-inline .datepicker-days > table { + width: 100%; +} +.box .datepicker-inline td:hover, +.box .datepicker-inline .datepicker-days td:hover, +.box .datepicker-inline > table td:hover, +.box .datepicker-inline .datepicker-days > table td:hover { + background-color: rgba(255, 255, 255, 0.3); +} +.box .datepicker-inline td.day.old, +.box .datepicker-inline .datepicker-days td.day.old, +.box .datepicker-inline > table td.day.old, +.box .datepicker-inline .datepicker-days > table td.day.old, +.box .datepicker-inline td.day.new, +.box .datepicker-inline .datepicker-days td.day.new, +.box .datepicker-inline > table td.day.new, +.box .datepicker-inline .datepicker-days > table td.day.new { + color: #777; } - /* * General: Miscellaneous * ---------------------- */ .pad { - padding: 10px; + padding: 10px; } - .margin { - margin: 10px; + margin: 10px; } - .margin-bottom { - margin-bottom: 20px; + margin-bottom: 20px; } - .margin-bottom-none { - margin-bottom: 0; + margin-bottom: 0; } - .margin-r-5 { - margin-right: 5px; + margin-right: 5px; } - .inline { - display: inline; + display: inline; } - .description-block { - display: block; - margin: 10px 0; - text-align: center; + display: block; + margin: 10px 0; + text-align: center; } - .description-block.margin-bottom { - margin-bottom: 25px; + margin-bottom: 25px; } - .description-block > .description-header { - margin: 0; - padding: 0; - font-weight: 600; - font-size: 16px; + margin: 0; + padding: 0; + font-weight: 600; + font-size: 16px; } - .description-block > .description-text { - text-transform: uppercase; + text-transform: uppercase; } - .bg-red, .bg-yellow, .bg-aqua, @@ -5235,660 +5140,549 @@ table.text-center th { .modal-danger .modal-body, .modal-danger .modal-header, .modal-danger .modal-footer { - color: #fff !important; + color: #fff !important; } - .bg-gray { - color: #000; - background-color: #d2d6de !important; + color: #000; + background-color: #d2d6de !important; } - .bg-gray-light { - background-color: #f7f7f7; + background-color: #f7f7f7; } - .bg-black { - background-color: #111111 !important; + background-color: #111111 !important; } - .bg-red, .callout.callout-danger, .alert-danger, .alert-error, .label-danger, .modal-danger .modal-body { - background-color: #dd4b39 !important; + background-color: #dd4b39 !important; } - .bg-yellow, .callout.callout-warning, .alert-warning, .label-warning, .modal-warning .modal-body { - background-color: #f39c12 !important; + background-color: #f39c12 !important; } - .bg-aqua, .callout.callout-info, .alert-info, .label-info, .modal-info .modal-body { - background-color: #00c0ef !important; + background-color: #00c0ef !important; } - .bg-blue { - background-color: #0073b7 !important; + background-color: #0073b7 !important; } - .bg-light-blue, .label-primary, .modal-primary .modal-body { - background-color: #3c8dbc !important; + background-color: #3c8dbc !important; } - .bg-green, .callout.callout-success, .alert-success, .label-success, .modal-success .modal-body { - background-color: #00a65a !important; + background-color: #00a65a !important; } - .bg-navy { - background-color: #001f3f !important; + background-color: #001f3f !important; } - .bg-teal { - background-color: #39cccc !important; + background-color: #39cccc !important; } - .bg-olive { - background-color: #3d9970 !important; + background-color: #3d9970 !important; } - .bg-lime { - background-color: #01ff70 !important; + background-color: #01ff70 !important; } - .bg-orange { - background-color: #ff851b !important; + background-color: #ff851b !important; } - .bg-fuchsia { - background-color: #f012be !important; + background-color: #f012be !important; } - .bg-purple { - background-color: #605ca8 !important; + background-color: #605ca8 !important; } - .bg-maroon { - background-color: #d81b60 !important; + background-color: #d81b60 !important; } - .bg-gray-active { - color: #000; - background-color: #b5bbc8 !important; + color: #000; + background-color: #b5bbc8 !important; } - .bg-black-active { - background-color: #000000 !important; + background-color: #000000 !important; } - .bg-red-active, .modal-danger .modal-header, .modal-danger .modal-footer { - background-color: #d33724 !important; + background-color: #d33724 !important; } - .bg-yellow-active, .modal-warning .modal-header, .modal-warning .modal-footer { - background-color: #db8b0b !important; + background-color: #db8b0b !important; } - .bg-aqua-active, .modal-info .modal-header, .modal-info .modal-footer { - background-color: #00a7d0 !important; + background-color: #00a7d0 !important; } - .bg-blue-active { - background-color: #005384 !important; + background-color: #005384 !important; } - .bg-light-blue-active, .modal-primary .modal-header, .modal-primary .modal-footer { - background-color: #357ca5 !important; + background-color: #357ca5 !important; } - .bg-green-active, .modal-success .modal-header, .modal-success .modal-footer { - background-color: #008d4c !important; + background-color: #008d4c !important; } - .bg-navy-active { - background-color: #001a35 !important; + background-color: #001a35 !important; } - .bg-teal-active { - background-color: #30bbbb !important; + background-color: #30bbbb !important; } - .bg-olive-active { - background-color: #368763 !important; + background-color: #368763 !important; } - .bg-lime-active { - background-color: #00e765 !important; + background-color: #00e765 !important; } - .bg-orange-active { - background-color: #ff7701 !important; + background-color: #ff7701 !important; } - .bg-fuchsia-active { - background-color: #db0ead !important; + background-color: #db0ead !important; } - .bg-purple-active { - background-color: #555299 !important; + background-color: #555299 !important; } - .bg-maroon-active { - background-color: #ca195a !important; + background-color: #ca195a !important; } - [class^="bg-"].disabled { - opacity: 0.65; - filter: alpha(opacity=65); + opacity: 0.65; + filter: alpha(opacity=65); } - .text-red { - color: #dd4b39 !important; + color: #dd4b39 !important; } - .text-yellow { - color: #f39c12 !important; + color: #f39c12 !important; } - .text-aqua { - color: #00c0ef !important; + color: #00c0ef !important; } - .text-blue { - color: #0073b7 !important; + color: #0073b7 !important; } - .text-black { - color: #111111 !important; + color: #111111 !important; } - .text-light-blue { - color: #3c8dbc !important; + color: #3c8dbc !important; } - .text-green { - color: #00a65a !important; + color: #00a65a !important; } - .text-gray { - color: #d2d6de !important; + color: #d2d6de !important; } - .text-navy { - color: #001f3f !important; + color: #001f3f !important; } - .text-teal { - color: #39cccc !important; + color: #39cccc !important; } - .text-olive { - color: #3d9970 !important; + color: #3d9970 !important; } - .text-lime { - color: #01ff70 !important; + color: #01ff70 !important; } - .text-orange { - color: #ff851b !important; + color: #ff851b !important; } - .text-fuchsia { - color: #f012be !important; + color: #f012be !important; } - .text-purple { - color: #605ca8 !important; + color: #605ca8 !important; } - .text-maroon { - color: #d81b60 !important; + color: #d81b60 !important; } - .link-muted { - color: #7a869d; + color: #7a869d; } - .link-muted:hover, .link-muted:focus { - color: #606c84; + color: #606c84; } - .link-black { - color: #666; + color: #666; } - .link-black:hover, .link-black:focus { - color: #999; + color: #999; } - .hide { - display: none !important; + display: none !important; } - .no-border { - border: 0 !important; + border: 0 !important; } - .no-padding { - padding: 0 !important; + padding: 0 !important; } - .no-margin { - margin: 0 !important; + margin: 0 !important; } - .no-shadow { - box-shadow: none !important; + box-shadow: none !important; } - .list-unstyled, .chart-legend, .contacts-list, .users-list, .mailbox-attachments { - list-style: none; - margin: 0; - padding: 0; + list-style: none; + margin: 0; + padding: 0; } - .list-group-unbordered > .list-group-item { - border-left: 0; - border-right: 0; - border-radius: 0; - padding-left: 0; - padding-right: 0; + border-left: 0; + border-right: 0; + border-radius: 0; + padding-left: 0; + padding-right: 0; } - .flat { - border-radius: 0 !important; + border-radius: 0 !important; } - .text-bold, .text-bold.table td, .text-bold.table th { - font-weight: 700; + font-weight: 700; } - .text-sm { - font-size: 12px; + font-size: 12px; } - .jqstooltip { - padding: 5px !important; - width: auto !important; - height: auto !important; + padding: 5px !important; + width: auto !important; + height: auto !important; } - .bg-teal-gradient { - background: #39cccc !important; - background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #39cccc), color-stop(1, #7adddd)) !important; - background: -ms-linear-gradient(bottom, #39cccc, #7adddd) !important; - background: -moz-linear-gradient(center bottom, #39cccc 0%, #7adddd 100%) !important; - background: -o-linear-gradient(#7adddd, #39cccc) !important; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#7adddd', endColorstr='#39cccc', GradientType=0) !important; - color: #fff; + background: #39cccc !important; + background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #39cccc), color-stop(1, #7adddd)) !important; + background: -ms-linear-gradient(bottom, #39cccc, #7adddd) !important; + background: -moz-linear-gradient(center bottom, #39cccc 0%, #7adddd 100%) !important; + background: -o-linear-gradient(#7adddd, #39cccc) !important; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#7adddd', endColorstr='#39cccc', GradientType=0) !important; + color: #fff; } - .bg-light-blue-gradient { - background: #3c8dbc !important; - background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #3c8dbc), color-stop(1, #67a8ce)) !important; - background: -ms-linear-gradient(bottom, #3c8dbc, #67a8ce) !important; - background: -moz-linear-gradient(center bottom, #3c8dbc 0%, #67a8ce 100%) !important; - background: -o-linear-gradient(#67a8ce, #3c8dbc) !important; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#67a8ce', endColorstr='#3c8dbc', GradientType=0) !important; - color: #fff; + background: #3c8dbc !important; + background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #3c8dbc), color-stop(1, #67a8ce)) !important; + background: -ms-linear-gradient(bottom, #3c8dbc, #67a8ce) !important; + background: -moz-linear-gradient(center bottom, #3c8dbc 0%, #67a8ce 100%) !important; + background: -o-linear-gradient(#67a8ce, #3c8dbc) !important; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#67a8ce', endColorstr='#3c8dbc', GradientType=0) !important; + color: #fff; } - .bg-blue-gradient { - background: #0073b7 !important; - background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #0073b7), color-stop(1, #0089db)) !important; - background: -ms-linear-gradient(bottom, #0073b7, #0089db) !important; - background: -moz-linear-gradient(center bottom, #0073b7 0%, #0089db 100%) !important; - background: -o-linear-gradient(#0089db, #0073b7) !important; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0089db', endColorstr='#0073b7', GradientType=0) !important; - color: #fff; + background: #0073b7 !important; + background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #0073b7), color-stop(1, #0089db)) !important; + background: -ms-linear-gradient(bottom, #0073b7, #0089db) !important; + background: -moz-linear-gradient(center bottom, #0073b7 0%, #0089db 100%) !important; + background: -o-linear-gradient(#0089db, #0073b7) !important; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0089db', endColorstr='#0073b7', GradientType=0) !important; + color: #fff; } - .bg-aqua-gradient { - background: #00c0ef !important; - background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #00c0ef), color-stop(1, #14d1ff)) !important; - background: -ms-linear-gradient(bottom, #00c0ef, #14d1ff) !important; - background: -moz-linear-gradient(center bottom, #00c0ef 0%, #14d1ff 100%) !important; - background: -o-linear-gradient(#14d1ff, #00c0ef) !important; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#14d1ff', endColorstr='#00c0ef', GradientType=0) !important; - color: #fff; + background: #00c0ef !important; + background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #00c0ef), color-stop(1, #14d1ff)) !important; + background: -ms-linear-gradient(bottom, #00c0ef, #14d1ff) !important; + background: -moz-linear-gradient(center bottom, #00c0ef 0%, #14d1ff 100%) !important; + background: -o-linear-gradient(#14d1ff, #00c0ef) !important; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#14d1ff', endColorstr='#00c0ef', GradientType=0) !important; + color: #fff; } - .bg-yellow-gradient { - background: #f39c12 !important; - background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #f39c12), color-stop(1, #f7bc60)) !important; - background: -ms-linear-gradient(bottom, #f39c12, #f7bc60) !important; - background: -moz-linear-gradient(center bottom, #f39c12 0%, #f7bc60 100%) !important; - background: -o-linear-gradient(#f7bc60, #f39c12) !important; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f7bc60', endColorstr='#f39c12', GradientType=0) !important; - color: #fff; + background: #f39c12 !important; + background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #f39c12), color-stop(1, #f7bc60)) !important; + background: -ms-linear-gradient(bottom, #f39c12, #f7bc60) !important; + background: -moz-linear-gradient(center bottom, #f39c12 0%, #f7bc60 100%) !important; + background: -o-linear-gradient(#f7bc60, #f39c12) !important; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f7bc60', endColorstr='#f39c12', GradientType=0) !important; + color: #fff; } - .bg-purple-gradient { - background: #605ca8 !important; - background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #605ca8), color-stop(1, #9491c4)) !important; - background: -ms-linear-gradient(bottom, #605ca8, #9491c4) !important; - background: -moz-linear-gradient(center bottom, #605ca8 0%, #9491c4 100%) !important; - background: -o-linear-gradient(#9491c4, #605ca8) !important; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#9491c4', endColorstr='#605ca8', GradientType=0) !important; - color: #fff; + background: #605ca8 !important; + background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #605ca8), color-stop(1, #9491c4)) !important; + background: -ms-linear-gradient(bottom, #605ca8, #9491c4) !important; + background: -moz-linear-gradient(center bottom, #605ca8 0%, #9491c4 100%) !important; + background: -o-linear-gradient(#9491c4, #605ca8) !important; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#9491c4', endColorstr='#605ca8', GradientType=0) !important; + color: #fff; } - .bg-green-gradient { - background: #00a65a !important; - background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #00a65a), color-stop(1, #00ca6d)) !important; - background: -ms-linear-gradient(bottom, #00a65a, #00ca6d) !important; - background: -moz-linear-gradient(center bottom, #00a65a 0%, #00ca6d 100%) !important; - background: -o-linear-gradient(#00ca6d, #00a65a) !important; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ca6d', endColorstr='#00a65a', GradientType=0) !important; - color: #fff; + background: #00a65a !important; + background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #00a65a), color-stop(1, #00ca6d)) !important; + background: -ms-linear-gradient(bottom, #00a65a, #00ca6d) !important; + background: -moz-linear-gradient(center bottom, #00a65a 0%, #00ca6d 100%) !important; + background: -o-linear-gradient(#00ca6d, #00a65a) !important; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ca6d', endColorstr='#00a65a', GradientType=0) !important; + color: #fff; } - .bg-red-gradient { - background: #dd4b39 !important; - background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #dd4b39), color-stop(1, #e47365)) !important; - background: -ms-linear-gradient(bottom, #dd4b39, #e47365) !important; - background: -moz-linear-gradient(center bottom, #dd4b39 0%, #e47365 100%) !important; - background: -o-linear-gradient(#e47365, #dd4b39) !important; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e47365', endColorstr='#dd4b39', GradientType=0) !important; - color: #fff; + background: #dd4b39 !important; + background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #dd4b39), color-stop(1, #e47365)) !important; + background: -ms-linear-gradient(bottom, #dd4b39, #e47365) !important; + background: -moz-linear-gradient(center bottom, #dd4b39 0%, #e47365 100%) !important; + background: -o-linear-gradient(#e47365, #dd4b39) !important; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e47365', endColorstr='#dd4b39', GradientType=0) !important; + color: #fff; } - .bg-black-gradient { - background: #111111 !important; - background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #111111), color-stop(1, #2b2b2b)) !important; - background: -ms-linear-gradient(bottom, #111111, #2b2b2b) !important; - background: -moz-linear-gradient(center bottom, #111111 0%, #2b2b2b 100%) !important; - background: -o-linear-gradient(#2b2b2b, #111111) !important; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#2b2b2b', endColorstr='#111111', GradientType=0) !important; - color: #fff; + background: #111111 !important; + background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #111111), color-stop(1, #2b2b2b)) !important; + background: -ms-linear-gradient(bottom, #111111, #2b2b2b) !important; + background: -moz-linear-gradient(center bottom, #111111 0%, #2b2b2b 100%) !important; + background: -o-linear-gradient(#2b2b2b, #111111) !important; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#2b2b2b', endColorstr='#111111', GradientType=0) !important; + color: #fff; } - .bg-maroon-gradient { - background: #d81b60 !important; - background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #d81b60), color-stop(1, #e73f7c)) !important; - background: -ms-linear-gradient(bottom, #d81b60, #e73f7c) !important; - background: -moz-linear-gradient(center bottom, #d81b60 0%, #e73f7c 100%) !important; - background: -o-linear-gradient(#e73f7c, #d81b60) !important; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e73f7c', endColorstr='#d81b60', GradientType=0) !important; - color: #fff; + background: #d81b60 !important; + background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #d81b60), color-stop(1, #e73f7c)) !important; + background: -ms-linear-gradient(bottom, #d81b60, #e73f7c) !important; + background: -moz-linear-gradient(center bottom, #d81b60 0%, #e73f7c 100%) !important; + background: -o-linear-gradient(#e73f7c, #d81b60) !important; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e73f7c', endColorstr='#d81b60', GradientType=0) !important; + color: #fff; } - .description-block .description-icon { - font-size: 16px; + font-size: 16px; } - .no-pad-top { - padding-top: 0; + padding-top: 0; } - .position-static { - position: static !important; + position: static !important; } - .list-header { - font-size: 15px; - padding: 10px 4px; - font-weight: bold; - color: #666; + font-size: 15px; + padding: 10px 4px; + font-weight: bold; + color: #666; } - .list-seperator { - height: 1px; - background: #f4f4f4; - margin: 15px 0 9px 0; + height: 1px; + background: #f4f4f4; + margin: 15px 0 9px 0; } - .list-link > a { - padding: 4px; - color: #777; + padding: 4px; + color: #777; } - .list-link > a:hover { - color: #222; + color: #222; } - .font-light { - font-weight: 300; + font-weight: 300; } - .user-block:before, .user-block:after { - content: " "; - display: table; + content: " "; + display: table; } - .user-block:after { - clear: both; + clear: both; +} +.user-block:before, +.user-block:after { + content: " "; + display: table; +} +.user-block:after { + clear: both; } - .user-block img { - width: 40px; - height: 40px; - float: left; + width: 40px; + height: 40px; + float: left; } - .user-block .username, .user-block .description, .user-block .comment { - display: block; - margin-left: 50px; + display: block; + margin-left: 50px; } - .user-block .username { - font-size: 16px; - font-weight: 600; + font-size: 16px; + font-weight: 600; } - .user-block .description { - color: #999; - font-size: 13px; + color: #999; + font-size: 13px; } - .user-block.user-block-sm .username, .user-block.user-block-sm .description, .user-block.user-block-sm .comment { - margin-left: 40px; + margin-left: 40px; } - .user-block.user-block-sm .username { - font-size: 14px; + font-size: 14px; } - .img-sm, .img-md, .img-lg, .box-comments .box-comment img, .user-block.user-block-sm img { - float: left; + float: left; } - .img-sm, .box-comments .box-comment img, .user-block.user-block-sm img { - width: 30px !important; - height: 30px !important; + width: 30px !important; + height: 30px !important; } - .img-sm + .img-push { - margin-left: 40px; + margin-left: 40px; } - .img-md { - width: 60px; - height: 60px; + width: 60px; + height: 60px; } - .img-md + .img-push { - margin-left: 70px; + margin-left: 70px; } - .img-lg { - width: 100px; - height: 100px; + width: 100px; + height: 100px; } - .img-lg + .img-push { - margin-left: 110px; + margin-left: 110px; } - .img-bordered { - border: 3px solid #d2d6de; - padding: 3px; + border: 3px solid #d2d6de; + padding: 3px; } - .img-bordered-sm { - border: 2px solid #d2d6de; - padding: 2px; + border: 2px solid #d2d6de; + padding: 2px; } - .attachment-block { - border: 1px solid #f4f4f4; - padding: 5px; - margin-bottom: 10px; - background: #f7f7f7; + border: 1px solid #f4f4f4; + padding: 5px; + margin-bottom: 10px; + background: #f7f7f7; } - .attachment-block .attachment-img { - max-width: 100px; - max-height: 100px; - height: auto; - float: left; + max-width: 100px; + max-height: 100px; + height: auto; + float: left; } - .attachment-block .attachment-pushed { - margin-left: 110px; + margin-left: 110px; } - .attachment-block .attachment-heading { - margin: 0; + margin: 0; } - .attachment-block .attachment-text { - color: #555; + color: #555; } - .connectedSortable { - min-height: 100px; + min-height: 100px; } - .ui-helper-hidden-accessible { - border: 0; - clip: rect(0 0 0 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; } - .sort-highlight { - background: #f4f4f4; - border: 1px dashed #ddd; - margin-bottom: 10px; + background: #f4f4f4; + border: 1px dashed #ddd; + margin-bottom: 10px; } - .full-opacity-hover { - opacity: 0.65; - filter: alpha(opacity=65); + opacity: 0.65; + filter: alpha(opacity=65); } - .full-opacity-hover:hover { - opacity: 1; - filter: alpha(opacity=100); + opacity: 1; + filter: alpha(opacity=100); } - .chart { - position: relative; - overflow: hidden; - width: 100%; + position: relative; + overflow: hidden; + width: 100%; } - .chart svg, .chart canvas { - width: 100% !important; + width: 100% !important; } - /* * Misc: print * ----------- */ @media print { - .no-print, - .main-sidebar, - .left-side, - .main-header, - .content-header { - display: none !important; - } - - .content-wrapper, - .right-side, - .main-footer { - margin-left: 0 !important; - min-height: 0 !important; - -webkit-transform: translate(0, 0) !important; - -ms-transform: translate(0, 0) !important; - -o-transform: translate(0, 0) !important; - transform: translate(0, 0) !important; - } - - .fixed .content-wrapper, - .fixed .right-side { - padding-top: 0 !important; - } - - .invoice { - width: 100%; - border: 0; - margin: 0; - padding: 0; - } - - .invoice-col { - float: left; - width: 33.3333333%; - } - - .table-responsive { - overflow: auto; - } - - .table-responsive > .table tr th, - .table-responsive > .table tr td { - white-space: normal !important; - } + .no-print, + .main-sidebar, + .left-side, + .main-header, + .content-header { + display: none !important; + } + .content-wrapper, + .right-side, + .main-footer { + margin-left: 0 !important; + min-height: 0 !important; + -webkit-transform: translate(0, 0) !important; + -ms-transform: translate(0, 0) !important; + -o-transform: translate(0, 0) !important; + transform: translate(0, 0) !important; + } + .fixed .content-wrapper, + .fixed .right-side { + padding-top: 0 !important; + } + .invoice { + width: 100%; + border: 0; + margin: 0; + padding: 0; + } + .invoice-col { + float: left; + width: 33.3333333%; + } + .table-responsive { + overflow: auto; + } + .table-responsive > .table tr th, + .table-responsive > .table tr td { + white-space: normal !important; + } } diff --git a/public/lib/adminlte/css/skins/skin-blue-light.css b/public/lib/adminlte/css/skins/skin-blue-light.css index be502018b6..580644081b 100755 --- a/public/lib/adminlte/css/skins/skin-blue-light.css +++ b/public/lib/adminlte/css/skins/skin-blue-light.css @@ -3,13 +3,11 @@ * ---------- */ .skin-blue-light .main-header .navbar { - background-color: #3c8dbc; + background-color: #3c8dbc; } - .skin-blue-light .main-header .navbar .nav > li > a { - color: #ffffff; + color: #ffffff; } - .skin-blue-light .main-header .navbar .nav > li > a:hover, .skin-blue-light .main-header .navbar .nav > li > a:active, .skin-blue-light .main-header .navbar .nav > li > a:focus, @@ -17,186 +15,149 @@ .skin-blue-light .main-header .navbar .nav .open > a:hover, .skin-blue-light .main-header .navbar .nav .open > a:focus, .skin-blue-light .main-header .navbar .nav > .active > a { - background: rgba(0, 0, 0, 0.1); - color: #f6f6f6; + background: rgba(0, 0, 0, 0.1); + color: #f6f6f6; } - .skin-blue-light .main-header .navbar .sidebar-toggle { - color: #ffffff; + color: #ffffff; } - .skin-blue-light .main-header .navbar .sidebar-toggle:hover { - color: #f6f6f6; - background: rgba(0, 0, 0, 0.1); + color: #f6f6f6; + background: rgba(0, 0, 0, 0.1); } - .skin-blue-light .main-header .navbar .sidebar-toggle { - color: #fff; + color: #fff; } - .skin-blue-light .main-header .navbar .sidebar-toggle:hover { - background-color: #367fa9; + background-color: #367fa9; } - @media (max-width: 767px) { - .skin-blue-light .main-header .navbar .dropdown-menu li.divider { - background-color: rgba(255, 255, 255, 0.1); - } - - .skin-blue-light .main-header .navbar .dropdown-menu li a { - color: #fff; - } - - .skin-blue-light .main-header .navbar .dropdown-menu li a:hover { - background: #367fa9; - } + .skin-blue-light .main-header .navbar .dropdown-menu li.divider { + background-color: rgba(255, 255, 255, 0.1); + } + .skin-blue-light .main-header .navbar .dropdown-menu li a { + color: #fff; + } + .skin-blue-light .main-header .navbar .dropdown-menu li a:hover { + background: #367fa9; + } } - .skin-blue-light .main-header .logo { - background-color: #3c8dbc; - color: #ffffff; - border-bottom: 0 solid transparent; + background-color: #3c8dbc; + color: #ffffff; + border-bottom: 0 solid transparent; } - .skin-blue-light .main-header .logo:hover { - background-color: #3b8ab8; + background-color: #3b8ab8; } - .skin-blue-light .main-header li.user-header { - background-color: #3c8dbc; + background-color: #3c8dbc; } - .skin-blue-light .content-header { - background: transparent; + background: transparent; } - .skin-blue-light .wrapper, .skin-blue-light .main-sidebar, .skin-blue-light .left-side { - background-color: #f9fafc; + background-color: #f9fafc; } - -.skin-blue-light .content-wrapper, -.skin-blue-light .main-footer { - border-left: 1px solid #d2d6de; +.skin-blue-light .main-sidebar { + border-right: 1px solid #d2d6de; } - .skin-blue-light .user-panel > .info, .skin-blue-light .user-panel > .info > a { - color: #444444; + color: #444444; } - .skin-blue-light .sidebar-menu > li { - -webkit-transition: border-left-color 0.3s ease; - -o-transition: border-left-color 0.3s ease; - transition: border-left-color 0.3s ease; + -webkit-transition: border-left-color 0.3s ease; + -o-transition: border-left-color 0.3s ease; + transition: border-left-color 0.3s ease; } - .skin-blue-light .sidebar-menu > li.header { - color: #848484; - background: #f9fafc; + color: #848484; + background: #f9fafc; } - .skin-blue-light .sidebar-menu > li > a { - border-left: 3px solid transparent; - font-weight: 600; + border-left: 3px solid transparent; + font-weight: 600; } - .skin-blue-light .sidebar-menu > li:hover > a, .skin-blue-light .sidebar-menu > li.active > a { - color: #000000; - background: #f4f4f5; + color: #000000; + background: #f4f4f5; } - .skin-blue-light .sidebar-menu > li.active { - border-left-color: #3c8dbc; + border-left-color: #3c8dbc; } - .skin-blue-light .sidebar-menu > li.active > a { - font-weight: 600; + font-weight: 600; } - .skin-blue-light .sidebar-menu > li > .treeview-menu { - background: #f4f4f5; + background: #f4f4f5; } - .skin-blue-light .sidebar a { - color: #444444; + color: #444444; } - .skin-blue-light .sidebar a:hover { - text-decoration: none; + text-decoration: none; } - -.skin-blue-light .treeview-menu > li > a { - color: #777777; +.skin-blue-light .sidebar-menu .treeview-menu > li > a { + color: #777777; } - -.skin-blue-light .treeview-menu > li.active > a, -.skin-blue-light .treeview-menu > li > a:hover { - color: #000000; +.skin-blue-light .sidebar-menu .treeview-menu > li.active > a, +.skin-blue-light .sidebar-menu .treeview-menu > li > a:hover { + color: #000000; } - -.skin-blue-light .treeview-menu > li.active > a { - font-weight: 600; +.skin-blue-light .sidebar-menu .treeview-menu > li.active > a { + font-weight: 600; } - .skin-blue-light .sidebar-form { - border-radius: 3px; - border: 1px solid #d2d6de; - margin: 10px 10px; + border-radius: 3px; + border: 1px solid #d2d6de; + margin: 10px 10px; } - .skin-blue-light .sidebar-form input[type="text"], .skin-blue-light .sidebar-form .btn { - box-shadow: none; - background-color: #fff; - border: 1px solid transparent; - height: 35px; + box-shadow: none; + background-color: #fff; + border: 1px solid transparent; + height: 35px; } - .skin-blue-light .sidebar-form input[type="text"] { - color: #666; - border-top-left-radius: 2px; - border-top-right-radius: 0; - border-bottom-right-radius: 0; - border-bottom-left-radius: 2px; + color: #666; + border-top-left-radius: 2px; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + border-bottom-left-radius: 2px; } - .skin-blue-light .sidebar-form input[type="text"]:focus, .skin-blue-light .sidebar-form input[type="text"]:focus + .input-group-btn .btn { - background-color: #fff; - color: #666; + background-color: #fff; + color: #666; } - .skin-blue-light .sidebar-form input[type="text"]:focus + .input-group-btn .btn { - border-left-color: #fff; + border-left-color: #fff; } - .skin-blue-light .sidebar-form .btn { - color: #999; - border-top-left-radius: 0; - border-top-right-radius: 2px; - border-bottom-right-radius: 2px; - border-bottom-left-radius: 0; + color: #999; + border-top-left-radius: 0; + border-top-right-radius: 2px; + border-bottom-right-radius: 2px; + border-bottom-left-radius: 0; } - @media (min-width: 768px) { - .skin-blue-light.sidebar-mini.sidebar-collapse .sidebar-menu > li > .treeview-menu { - border-left: 1px solid #d2d6de; - } + .skin-blue-light.sidebar-mini.sidebar-collapse .sidebar-menu > li > .treeview-menu { + border-left: 1px solid #d2d6de; + } } - .skin-blue-light .main-footer { - border-top-color: #d2d6de; + border-top-color: #d2d6de; } - .skin-blue.layout-top-nav .main-header > .logo { - background-color: #3c8dbc; - color: #ffffff; - border-bottom: 0 solid transparent; + background-color: #3c8dbc; + color: #ffffff; + border-bottom: 0 solid transparent; } - .skin-blue.layout-top-nav .main-header > .logo:hover { - background-color: #3b8ab8; + background-color: #3b8ab8; } diff --git a/public/lib/adminlte/css/skins/skin-blue-light.min.css b/public/lib/adminlte/css/skins/skin-blue-light.min.css index c41ca33fa1..033834e29f 100755 --- a/public/lib/adminlte/css/skins/skin-blue-light.min.css +++ b/public/lib/adminlte/css/skins/skin-blue-light.min.css @@ -1 +1 @@ -.skin-blue-light .main-header .navbar{background-color:#3c8dbc}.skin-blue-light .main-header .navbar .nav>li>a{color:#fff}.skin-blue-light .main-header .navbar .nav>li>a:hover,.skin-blue-light .main-header .navbar .nav>li>a:active,.skin-blue-light .main-header .navbar .nav>li>a:focus,.skin-blue-light .main-header .navbar .nav .open>a,.skin-blue-light .main-header .navbar .nav .open>a:hover,.skin-blue-light .main-header .navbar .nav .open>a:focus,.skin-blue-light .main-header .navbar .nav>.active>a{background:rgba(0,0,0,0.1);color:#f6f6f6}.skin-blue-light .main-header .navbar .sidebar-toggle{color:#fff}.skin-blue-light .main-header .navbar .sidebar-toggle:hover{color:#f6f6f6;background:rgba(0,0,0,0.1)}.skin-blue-light .main-header .navbar .sidebar-toggle{color:#fff}.skin-blue-light .main-header .navbar .sidebar-toggle:hover{background-color:#367fa9}@media (max-width:767px){.skin-blue-light .main-header .navbar .dropdown-menu li.divider{background-color:rgba(255,255,255,0.1)}.skin-blue-light .main-header .navbar .dropdown-menu li a{color:#fff}.skin-blue-light .main-header .navbar .dropdown-menu li a:hover{background:#367fa9}}.skin-blue-light .main-header .logo{background-color:#3c8dbc;color:#fff;border-bottom:0 solid transparent}.skin-blue-light .main-header .logo:hover{background-color:#3b8ab8}.skin-blue-light .main-header li.user-header{background-color:#3c8dbc}.skin-blue-light .content-header{background:transparent}.skin-blue-light .wrapper,.skin-blue-light .main-sidebar,.skin-blue-light .left-side{background-color:#f9fafc}.skin-blue-light .content-wrapper,.skin-blue-light .main-footer{border-left:1px solid #d2d6de}.skin-blue-light .user-panel>.info,.skin-blue-light .user-panel>.info>a{color:#444}.skin-blue-light .sidebar-menu>li{-webkit-transition:border-left-color .3s ease;-o-transition:border-left-color .3s ease;transition:border-left-color .3s ease}.skin-blue-light .sidebar-menu>li.header{color:#848484;background:#f9fafc}.skin-blue-light .sidebar-menu>li>a{border-left:3px solid transparent;font-weight:600}.skin-blue-light .sidebar-menu>li:hover>a,.skin-blue-light .sidebar-menu>li.active>a{color:#000;background:#f4f4f5}.skin-blue-light .sidebar-menu>li.active{border-left-color:#3c8dbc}.skin-blue-light .sidebar-menu>li.active>a{font-weight:600}.skin-blue-light .sidebar-menu>li>.treeview-menu{background:#f4f4f5}.skin-blue-light .sidebar a{color:#444}.skin-blue-light .sidebar a:hover{text-decoration:none}.skin-blue-light .treeview-menu>li>a{color:#777}.skin-blue-light .treeview-menu>li.active>a,.skin-blue-light .treeview-menu>li>a:hover{color:#000}.skin-blue-light .treeview-menu>li.active>a{font-weight:600}.skin-blue-light .sidebar-form{border-radius:3px;border:1px solid #d2d6de;margin:10px 10px}.skin-blue-light .sidebar-form input[type="text"],.skin-blue-light .sidebar-form .btn{box-shadow:none;background-color:#fff;border:1px solid transparent;height:35px}.skin-blue-light .sidebar-form input[type="text"]{color:#666;border-top-left-radius:2px;border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:2px}.skin-blue-light .sidebar-form input[type="text"]:focus,.skin-blue-light .sidebar-form input[type="text"]:focus+.input-group-btn .btn{background-color:#fff;color:#666}.skin-blue-light .sidebar-form input[type="text"]:focus+.input-group-btn .btn{border-left-color:#fff}.skin-blue-light .sidebar-form .btn{color:#999;border-top-left-radius:0;border-top-right-radius:2px;border-bottom-right-radius:2px;border-bottom-left-radius:0}@media (min-width:768px){.skin-blue-light.sidebar-mini.sidebar-collapse .sidebar-menu>li>.treeview-menu{border-left:1px solid #d2d6de}}.skin-blue-light .main-footer{border-top-color:#d2d6de}.skin-blue.layout-top-nav .main-header>.logo{background-color:#3c8dbc;color:#fff;border-bottom:0 solid transparent}.skin-blue.layout-top-nav .main-header>.logo:hover{background-color:#3b8ab8} \ No newline at end of file +.skin-blue-light .main-header .navbar{background-color:#3c8dbc}.skin-blue-light .main-header .navbar .nav>li>a{color:#fff}.skin-blue-light .main-header .navbar .nav>li>a:hover,.skin-blue-light .main-header .navbar .nav>li>a:active,.skin-blue-light .main-header .navbar .nav>li>a:focus,.skin-blue-light .main-header .navbar .nav .open>a,.skin-blue-light .main-header .navbar .nav .open>a:hover,.skin-blue-light .main-header .navbar .nav .open>a:focus,.skin-blue-light .main-header .navbar .nav>.active>a{background:rgba(0,0,0,0.1);color:#f6f6f6}.skin-blue-light .main-header .navbar .sidebar-toggle{color:#fff}.skin-blue-light .main-header .navbar .sidebar-toggle:hover{color:#f6f6f6;background:rgba(0,0,0,0.1)}.skin-blue-light .main-header .navbar .sidebar-toggle{color:#fff}.skin-blue-light .main-header .navbar .sidebar-toggle:hover{background-color:#367fa9}@media (max-width:767px){.skin-blue-light .main-header .navbar .dropdown-menu li.divider{background-color:rgba(255,255,255,0.1)}.skin-blue-light .main-header .navbar .dropdown-menu li a{color:#fff}.skin-blue-light .main-header .navbar .dropdown-menu li a:hover{background:#367fa9}}.skin-blue-light .main-header .logo{background-color:#3c8dbc;color:#fff;border-bottom:0 solid transparent}.skin-blue-light .main-header .logo:hover{background-color:#3b8ab8}.skin-blue-light .main-header li.user-header{background-color:#3c8dbc}.skin-blue-light .content-header{background:transparent}.skin-blue-light .wrapper,.skin-blue-light .main-sidebar,.skin-blue-light .left-side{background-color:#f9fafc}.skin-blue-light .main-sidebar{border-right:1px solid #d2d6de}.skin-blue-light .user-panel>.info,.skin-blue-light .user-panel>.info>a{color:#444}.skin-blue-light .sidebar-menu>li{-webkit-transition:border-left-color .3s ease;-o-transition:border-left-color .3s ease;transition:border-left-color .3s ease}.skin-blue-light .sidebar-menu>li.header{color:#848484;background:#f9fafc}.skin-blue-light .sidebar-menu>li>a{border-left:3px solid transparent;font-weight:600}.skin-blue-light .sidebar-menu>li:hover>a,.skin-blue-light .sidebar-menu>li.active>a{color:#000;background:#f4f4f5}.skin-blue-light .sidebar-menu>li.active{border-left-color:#3c8dbc}.skin-blue-light .sidebar-menu>li.active>a{font-weight:600}.skin-blue-light .sidebar-menu>li>.treeview-menu{background:#f4f4f5}.skin-blue-light .sidebar a{color:#444}.skin-blue-light .sidebar a:hover{text-decoration:none}.skin-blue-light .sidebar-menu .treeview-menu>li>a{color:#777}.skin-blue-light .sidebar-menu .treeview-menu>li.active>a,.skin-blue-light .sidebar-menu .treeview-menu>li>a:hover{color:#000}.skin-blue-light .sidebar-menu .treeview-menu>li.active>a{font-weight:600}.skin-blue-light .sidebar-form{border-radius:3px;border:1px solid #d2d6de;margin:10px 10px}.skin-blue-light .sidebar-form input[type="text"],.skin-blue-light .sidebar-form .btn{box-shadow:none;background-color:#fff;border:1px solid transparent;height:35px}.skin-blue-light .sidebar-form input[type="text"]{color:#666;border-top-left-radius:2px;border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:2px}.skin-blue-light .sidebar-form input[type="text"]:focus,.skin-blue-light .sidebar-form input[type="text"]:focus+.input-group-btn .btn{background-color:#fff;color:#666}.skin-blue-light .sidebar-form input[type="text"]:focus+.input-group-btn .btn{border-left-color:#fff}.skin-blue-light .sidebar-form .btn{color:#999;border-top-left-radius:0;border-top-right-radius:2px;border-bottom-right-radius:2px;border-bottom-left-radius:0}@media (min-width:768px){.skin-blue-light.sidebar-mini.sidebar-collapse .sidebar-menu>li>.treeview-menu{border-left:1px solid #d2d6de}}.skin-blue-light .main-footer{border-top-color:#d2d6de}.skin-blue.layout-top-nav .main-header>.logo{background-color:#3c8dbc;color:#fff;border-bottom:0 solid transparent}.skin-blue.layout-top-nav .main-header>.logo:hover{background-color:#3b8ab8} \ No newline at end of file diff --git a/resources/lang/de_DE/bank.php b/resources/lang/de_DE/bank.php index c50588e153..86a0c3062b 100644 --- a/resources/lang/de_DE/bank.php +++ b/resources/lang/de_DE/bank.php @@ -1,6 +1,8 @@ 'Voraussetzungen für einen Import von bunq', 'bunq_prerequisites_text' => 'Um aus bunq importieren zu können, benötigen Sie einen API-Schlüssel. Sie können dies über die App tun.', -]; \ No newline at end of file +]; diff --git a/resources/lang/de_DE/breadcrumbs.php b/resources/lang/de_DE/breadcrumbs.php index 9e9b691b2c..5f2bf17f65 100644 --- a/resources/lang/de_DE/breadcrumbs.php +++ b/resources/lang/de_DE/breadcrumbs.php @@ -31,10 +31,12 @@ return [ 'deposit_list' => 'Umsatz, Einkommen und Einlagen', 'transfer_list' => 'Überweisungen', 'transfers_list' => 'Überweisungen', + 'reconciliation_list' => 'Reconciliations', 'create_withdrawal' => 'Erstelle eine neue Ausgabe', 'create_deposit' => 'Erstelle ein neues Einkommen', 'create_transfer' => 'Erstelle eine neue Überweisung', 'edit_journal' => 'Bearbeite Transaktion ":description"', + 'edit_reconciliation' => 'Edit ":description"', 'delete_journal' => 'Lösche Transaktion ":description"', 'tags' => 'Tags', 'createTag' => 'Neuen Tag erstellen', diff --git a/resources/lang/de_DE/csv.php b/resources/lang/de_DE/csv.php index 804452a045..9077d9fe15 100644 --- a/resources/lang/de_DE/csv.php +++ b/resources/lang/de_DE/csv.php @@ -51,6 +51,8 @@ return [ 'column_account-id' => 'Bestandskonto (vgl. ID in Firefly)', 'column_account-name' => 'Bestandskonto (Name)', 'column_amount' => 'Betrag', + 'column_amount_debet' => 'Amount (debet column)', + 'column_amount_credit' => 'Amount (credit column)', 'column_amount-comma-separated' => 'Betrag (Komma als Dezimaltrennzeichen)', 'column_bill-id' => 'Rechnung (ID übereinstimmend mit Firefly)', 'column_bill-name' => 'Name der Rechnung', diff --git a/resources/lang/de_DE/demo.php b/resources/lang/de_DE/demo.php index 19d4a1bbf5..eec5193c40 100644 --- a/resources/lang/de_DE/demo.php +++ b/resources/lang/de_DE/demo.php @@ -16,11 +16,11 @@ return [ 'accounts-index' => 'Vermögenskonten sind Ihre persönlichen Bank-Konten. Aufwandskonten sind Konten, denen Sie Geld zahlen, z. B. Läden und Freunde. Einnahmekonten sind Konten von denen Sie Geld erhalten, z. B. Ihr Arbeitgeber und andere Einkommensquellen. Auf dieser Seite können Sie diese bearbeiten oder entfernen.', 'budgets-index' => 'Diese Seite zeigt Ihnen einen Überblick über Ihre Budgets. Die obere Leiste zeigt den Betrag, der zur Verfügung steht. Dieser kann für einen Zeitraum angepasst werden, indem Sie auf den Betrag auf der rechten Seite klicken. Wie viel bisher ausgegeben wurde wird darunter angezeigt. Darunter sind die Aufwendungen pro Haushalt und wie viel dafür veranschlagt ist.', 'reports-index-start' => 'Firefly III unterstützt vier Berichtarten. Mehr Informationen hierzu können durch ein Klick auf das Symbol in der oberen rechten Ecke aufgerufen werden.', - 'reports-index-examples' => 'Achten Sie darauf, diese Beispiele anzusehen: eine monatliche Finanzübersicht, eine jährliche Finanzübersicht und eine Haushaltsübersicht.', + 'reports-index-examples' => 'Sehen Sie sich auch diese Beispiele an: eine monatliche Finanzübersicht, eine jährliche Finanzübersicht und eine Haushaltsübersicht.', 'currencies-index' => 'Firefly III unterstützt mehrere Währungen. Obwohl es den Euro standardmäßig nutzt, ist es möglich US-Dollar oder viele andere Währungen zu verwenden. Wie Sie sehen können, ist eine kleine Auswahl an Währungen aufgenommen worden, aber Sie können Ihre eigenen hinzufügen. Die Standardwährung zu ändern, wird die Währung der vorhandenen Buchungen jedoch nicht ändern: Firefly III unterstützt die Verwendung mehrerer Währungen zur gleichen Zeit.', 'transactions-index' => 'Diese Aufwendungen, Einzahlungen und Überweisungen sind nicht besonders einfallsreich. Sie wurden automatisch generiert.', 'piggy-banks-index' => 'Wie Sie sehen können, gibt es drei Sparschweine. Benutzen die Plus- und Minusknöpfe um die Menge des Geldes in den Sparschweinen zu beeinflussen. Klicken Sie auf den Namen des Sparschweins um Details einzusehen.', - 'import-index' => 'Natürlich kann jede CSV-Datei in Firefly III importiert werden ', + 'import-index' => 'Natürlich kann jede CSV-Datei in Firefly III importiert werden', 'import-configure-security' => 'Aufgrund von Sicherheitsbedenken wurde der Upload mit einer lokalen Datei ersetzt.', 'import-configure-configuration' => 'Die unten stehende Konfiguration für die lokale Datei ist korrekt.', ]; diff --git a/resources/lang/de_DE/firefly.php b/resources/lang/de_DE/firefly.php index e7afb2d94c..d5590a87dc 100644 --- a/resources/lang/de_DE/firefly.php +++ b/resources/lang/de_DE/firefly.php @@ -13,12 +13,14 @@ declare(strict_types=1); return [ // general stuff: + 'language_incomplete' => 'Unvollständige Übersetzung', 'close' => 'Schließen', 'actions' => 'Aktionen', 'edit' => 'Bearbeiten', 'delete' => 'Löschen', 'welcomeBack' => 'Was ist gerade los?', 'everything' => 'Alle', + 'today' => 'heute', 'customRange' => 'Individueller Bereich', 'apply' => 'Übernehmen', 'select_date' => 'Wähle ein Datum..', @@ -71,7 +73,7 @@ return [ 'destination_accounts' => 'Zielkonto', 'user_id_is' => 'Ihre Benutzerkennung ist :user', 'field_supports_markdown' => 'Diese Feld unterstützt Abschlag .', - 'need_more_help' => 'Wenn du Hilfe beim Bedienen von Firefly III brauchst, erstelle ein Ticket auf Github.', + 'need_more_help' => 'Wenn Sie Hilfe beim Bedienen von Firefly III brauchen, erstellen Sie ein Ticket auf Github.', 'reenable_intro_text' => 'Sie können auch die Einführung wieder aktivieren.', 'intro_boxes_after_refresh' => 'Die Einführungsfelder werden wieder angezeigt, wenn Sie die Seite aktualisieren.', 'show_all_no_filter' => 'Alle Transaktionen anzeigen, ohne diese nach Datum zu gruppieren.', @@ -85,10 +87,10 @@ return [ 'sum_of_income' => 'Summe von Einnahmen', 'spent_in_specific_budget' => 'Ausgegeben in Budget ":budget"', 'sum_of_expenses_in_budget' => 'Vollkommen ausgegeben in Budget ":budget"', - 'left_in_budget_limit' => 'Übrig zum ausgeben aufgrund der Budgetierung', - 'current_period' => 'Aktuelle Periode', - 'show_the_current_period_and_overview' => 'Zeigen Sie die aktuelle Periode und die Übersicht', - 'pref_languages_locale' => 'Damit eine andere Sprache als Englisch richtig funktioniert muss Ihr Betriebssystem mit den korrekten Gebietsschema-Informationen ausgestattet werden. Wenn diese nicht vorhanden sind, können die Währungsdaten, Terminen und Mengen falsch formatiert.', + 'left_in_budget_limit' => 'Übrig zum Ausgeben aufgrund der Budgetierung', + 'current_period' => 'Aktueller Zeitraum', + 'show_the_current_period_and_overview' => 'Zeigen Sie den aktuellen Zeitraum und die Übersicht', + 'pref_languages_locale' => 'Damit eine andere Sprache als Englisch richtig funktioniert muss Ihr Betriebssystem mit den korrekten Gebietsschema-Informationen ausgestattet werden. Wenn diese nicht vorhanden sind, können die Währungsdaten, Termine und Mengen falsch formatiert.', 'budget_in_period' => 'Alle Transaktionen für Haushalt :name zwischen :start und :end', 'chart_budget_in_period' => 'Diagramm für alle Transaktionen des Haushalts ":name" zwischen :start und :end', 'chart_account_in_period' => 'Diagramm für alle Transaktionen des Kontos ":name" zwischen :start und :end', @@ -129,7 +131,8 @@ return [ 'transfer_exchange_rate_instructions' => 'Das Quellkonto "@source_name" akzeptiert nur Transaktionen in @source_currency. Das Zielkonto "@dest_name" akzeptiert nur Transaktionen in @dest_currency. Sie müssen den Betrag in beiden Währungen korrekt angeben.', 'transaction_data' => 'Transaktionsdaten', 'invalid_server_configuration' => 'Ungültige Serverkonfiguration', - 'invalid_locale_settings' => 'Firefly III is unable to format monetary amounts because your server is missing the required packages. There are instructions how to do this.', + 'invalid_locale_settings' => 'Firefly III kann keine Geldbeträge formatieren, da auf Ihrem Server die erforderlichen Pakete fehlen. Es gibt eine Anleitung, wie dies behoben werden kann.', + 'quickswitch' => 'Schnellauswahl', // search 'search' => 'Suche', @@ -144,10 +147,10 @@ return [ // repeat frequencies: 'repeat_freq_yearly' => 'Jährlich', - 'repeat_freq_half-year' => 'every half-year', - 'repeat_freq_quarterly' => 'quarterly', + 'repeat_freq_half-year' => 'halbjährlich', + 'repeat_freq_quarterly' => 'vierteljährlich', 'repeat_freq_monthly' => 'monatlich', - 'repeat_freq_weekly' => 'weekly', + 'repeat_freq_weekly' => 'wöchentlich', 'weekly' => 'wöchentlich', 'quarterly' => 'vierteljährlich', 'half-year' => 'halbjährlich', @@ -354,6 +357,7 @@ return [ 'without_date' => 'Ohne Datum', 'result' => 'Ergebnis', 'sums_apply_to_range' => 'All sums apply to the selected range', + 'mapbox_api_key' => 'Um die Karte zu verwenden, besorgen Sie sich einen API-Schlüssel von Mapbox. Öffnen Sie Ihre .env Datei und geben Sie diesen Code unter MAPBOX_API_KEY= ein.', 'press_tag_location' => 'Right click or long press to set the tag\'s location.', 'clear_location' => 'Clear location', @@ -435,25 +439,25 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'password_changed' => 'Passwort geändert!', 'should_change' => 'Ziel ist es, ihr Passwort zu ändern.', 'invalid_password' => 'Ungültiges Passwort!', - 'what_is_pw_security' => 'Was ist "Kennwort Sicherheit überprüfen"?', + 'what_is_pw_security' => 'Was ist "Passwortsicherheit überprüfen"?', 'secure_pw_title' => 'So wählen Sie ein sicheres Passwort aus', 'secure_pw_history' => 'Im August 2017 veröffentlichte die bekannte Sicherheitsforscherin Troy Hunt eine Liste von 306 Millionen gestohlenen Passwörtern. Diese Passwörter wurden während der Einbrüche bei Firmen wie LinkedIn, Adobe und NeoPets (und vielen mehr) gestohlen.', - 'secure_pw_check_box' => 'By checking the box, Firefly III will send the SHA1 hash of your password to the website of Troy Hunt to see if it is on the list. This will stop you from using unsafe passwords as is recommended in the latest NIST Special Publication on this subject.', + 'secure_pw_check_box' => 'Wenn Sie das Kontrollkästchen aktivieren, wird Firefly III den SHA1-Hash Ihres Passworts an die Website von Troy Hunt senden, um zu sehen, ob es auf der Liste steht. Dies verhindert, dass Sie unsichere Passwörter verwenden, was in der aktuellen NIST-Sonderveröffentlichung zu diesem Thema empfohlen wird.', 'secure_pw_sha1' => 'Aber ich dachte, dass SHA1 schon geknackt wurde?', - 'secure_pw_hash_speed' => 'Yes, but not in this context. As you can read on the website detailing how they broke SHA1, it is now slightly easier to find a "collision": another string that results in the same SHA1-hash. It now only takes 10,000 years using a single-GPU machine.', - 'secure_pw_hash_security' => 'This collision would not be equal to your password, nor would it be useful on (a site like) Firefly III. This application does not use SHA1 for password verification. So it is safe to check this box. Your password is hashed and sent over HTTPS.', + 'secure_pw_hash_speed' => 'Ja, aber nicht in diesem Zusammenhang. Wie Sie auf auf der Website, die erklärt, wie SHA1 gebrochen wurde, lesen können, ist es jetzt etwas leichter, eine "Kollision" zu finden: eine andere Zeichenfolge, die zu demselben SHA1-Hash führt. Es dauert nur mehr 10.000 Jahre mit einer Single-GPU-Maschine.', + 'secure_pw_hash_security' => 'Diese Kollision wäre nicht gleich Ihrem Passwort, noch wäre es nützlich auf (einer Seite wie) Firefly III. Diese Anwendung verwendet SHA1 nicht zur Passwortüberprüfung. Es ist also sicher, dieses Kästchen zu aktivieren. Ihr Passwort wird gehasht und über HTTPS übertragen.', 'secure_pw_should' => 'Soll ich die Box ankreuzen?', - 'secure_pw_long_password' => 'Wenn du gerade ein langes, Single-Use-Passwort für Firefly III mit einem Kennwortgenerator generiert hast: Nein.', + 'secure_pw_long_password' => 'Wenn Sie gerade ein langes, Single-Use-Passwort für Firefly III mit einem Kennwortgenerator generiert haben: Nein.', 'secure_pw_short' => 'Wenn Sie gerade das Passwort eingegeben haben, welches Sie immer verwenden: Bitte ja.', 'personal_access_token' => 'Persönlicher Zugangs-Token', 'explain_access_token' => 'You need this token to perform command line options, such as importing or exporting data. Without it, such sensitive commands will not work. Do not share your access token. Nobody will ask you for this token, not even me. If you fear you lost this, or when you\'re paranoid, regenerate this token using the button.', 'regenerate_access_token' => 'Zugangs-Token neu erstellen', 'token_regenerated' => 'Ein neuer Zugangs-Token wurde generiert', 'change_your_email' => 'E-Mail Adresse ändern', - 'email_verification' => 'An email message will be sent to your old AND new email address. For security purposes, you will not be able to login until you verify your new email address. If you are unsure if your Firefly III installation is capable of sending email, please do not use this feature. If you are an administrator, you can test this in the Administration.', + 'email_verification' => 'Eine E-Mail-Nachricht wird an Ihre alte UND neue E-Mail-Adresse gesendet. Aus Sicherheitsgründen können Sie sich erst anmelden, wenn Sie Ihre neue E-Mail-Adresse bestätigt haben. Wenn Sie sich nicht sicher sind, ob Ihre Firefly III-Installation E-Mails versenden kann, verwenden Sie bitte diese Funktion nicht. Wenn Sie Administrator sind, können Sie dies in der Administration testen.', 'email_changed_logout' => 'Sie müssen Ihre E-Mail-Adresse bestätigen, um sich anmelden zu können.', - 'login_with_new_email' => 'You can now login with your new email address.', - 'login_with_old_email' => 'You can now login with your old email address again.', + 'login_with_new_email' => 'Sie können sich jetzt mit Ihrer neuen E-Mail-Adresse anmelden.', + 'login_with_old_email' => 'Sie können sich jetzt wieder mit Ihrer alten E-Mail-Adresse anmelden.', // attachments @@ -556,9 +560,9 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'update_budget' => 'Budget aktualisieren', 'update_budget_amount_range' => 'Aktualisiere (erwarteten) verfügbaren Betrag zwischen :start und :end', 'budget_period_navigator' => 'Zeitraum-navigator', - 'info_on_available_amount' => 'What do I have available?', + 'info_on_available_amount' => 'Was habe ich verfügbar?', 'available_amount_indication' => 'Use these amounts to get an indication of what your total budget could be.', - 'suggested' => 'Suggested', + 'suggested' => 'Vorgeschlagen', 'average_between' => 'Average between :start and :end', @@ -587,6 +591,8 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'not_expected_period' => 'Diesen Zeitraum nicht erwartet', 'bill_is_active' => 'Rechnung ist aktiv', 'bill_will_automatch' => 'Rechnung wird automatisch mit passenden Transaktionen verknüpft', + 'skips_over' => 'skips over', + // accounts: 'details_for_asset' => 'Details für Girokonto ":name"', 'details_for_expense' => 'Details für Debitor ":name"', @@ -615,18 +621,55 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'revenue_accounts' => 'Schuldner', 'cash_accounts' => 'Bargeldkonten', 'Cash account' => 'Bargeldkonto', + 'reconcile_account' => 'Konto ":account" ausgleichen', + 'delete_reconciliation' => 'Delete reconciliation', + 'update_reconciliation' => 'Update reconciliation', + 'amount_cannot_be_zero' => 'The amount cannot be zero', + 'end_of_reconcile_period' => 'End of reconcile period: :period', + 'start_of_reconcile_period' => 'Start of reconcile period: :period', + 'start_balance' => 'Start balance', + 'end_balance' => 'End balance', + 'update_balance_dates_instruction' => 'Match the amounts and dates above to your bank statement, and press "Start reconciling"', + 'select_transactions_instruction' => 'Select the transactions that appear on your bank statement.', + 'select_range_and_balance' => 'First verify the date-range and balances. Then press "Start reconciling"', + 'date_change_instruction' => 'If you change the date range now, any progress will be lost.', + 'update_selection' => 'Update selection', + 'store_reconcile' => 'Store reconciliation', + 'reconciliation_transaction' => 'Reconciliation transaction', + 'Reconciliation' => 'Reconciliation', + 'reconciliation' => 'Reconciliation', + 'reconcile_options' => 'Reconciliation options', + 'reconcile_range' => 'Reconciliation range', + 'start_reconcile' => 'Start reconciling', + 'cash' => 'cash', 'account_type' => 'Kontotyp', 'save_transactions_by_moving' => 'Speichern Sie diese Transaktion(en), indem Sie sie auf ein anderes Konto verschieben:', 'stored_new_account' => 'Neues Konto ":name" gespeichert!', 'updated_account' => 'Konto ":name" aktualisiert', 'credit_card_options' => 'Kreditkartenoptionen', - 'no_transactions_account' => 'Es gibt keine Transaktionen (in dieser Zeit) für Girokonto ":name".', + 'no_transactions_account' => 'Es gibt keine Transaktionen (in diesem Zeitraum) für das Girokonto ":name".', 'no_data_for_chart' => 'Es gibt derzeit (noch) nicht genügend Informationen, um dieses Diagramm zu generieren.', - 'select_more_than_one_account' => 'Bitte mehr als ein Konto wählen', - 'select_more_than_one_category' => 'Bitte mehr als eine Kategorie wählen', - 'select_more_than_one_budget' => 'Bitte mehr als ein Budget wählen', + 'select_more_than_one_account' => 'Bitte wählen Sie mehr als einen Konto aus', + 'select_more_than_one_category' => 'Bitte wählen Sie mehr als eine Kategorie aus', + 'select_more_than_one_budget' => 'Bitte wählen Sie mehr als einen Budget aus', 'select_more_than_one_tag' => 'Bitte wählen Sie mehr als einen Tag aus', 'account_default_currency' => 'Wenn Sie eine andere Währung auswählen, werden neue Transaktionen von diesem Konto standardmäßig diese Währung ausgewählt haben.', + 'reconcile_has_more' => 'Your Firefly III ledger has more money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".', + 'reconcile_has_less' => 'Your Firefly III ledger has less money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".', + 'reconcile_is_equal' => 'Your Firefly III ledger and your bank statements match. There is nothing to do. Please press "Confirm reconciliation" to confirm your input.', + 'create_pos_reconcile_transaction' => 'Clear the selected transactions, and create a correction adding :amount to this asset account.', + 'create_neg_reconcile_transaction' => 'Clear the selected transactions, and create a correction removing :amount from this asset account.', + 'reconcile_do_nothing' => 'Clear the selected transactions, but do not correct.', + 'reconcile_go_back' => 'Sie können dies jederzeit später bearbeiten oder löschen.', + 'must_be_asset_account' => 'You can only reconcile asset accounts', + 'reconciliation_stored' => 'Reconciliation stored', + 'reconcilliation_transaction_title' => 'Reconciliation (:from to :to)', + 'reconcile_this_account' => 'Reconcile this account', + 'confirm_reconciliation' => 'Confirm reconciliation', + 'submitted_start_balance' => 'Submitted start balance', + 'selected_transactions' => 'Selected transactions (:count)', + 'already_cleared_transactions' => 'Already cleared transactions (:count)', + 'submitted_end_balance' => 'Submitted end balance', // categories: 'new_category' => 'Neue Kategorie', @@ -660,11 +703,11 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'stored_journal' => 'Neue Überweisung ":description" erfolgreich erstellt', 'select_transactions' => 'Überweisungen auswählen', 'stop_selection' => 'Auswahl von Überweisungen stoppen', - 'edit_selected' => 'Auswahl bearbeiten', - 'delete_selected' => 'Auswahl löschen', + 'reconcile_selected' => 'Ausgleichen', 'mass_delete_journals' => 'Löschen Sie eine Reihe von Überweisungen', 'mass_edit_journals' => 'Bearbeiten Sie eine Reihe von Überweisungen', 'cannot_edit_other_fields' => 'You cannot mass-edit other fields than the ones here, because there is no room to show them. Please follow the link and edit them by one-by-one, if you need to edit these fields.', + 'no_budget' => '(kein Budget)', 'perm-delete-many' => 'Das Löschen von mehreren Elementen auf einmal kann sich störend auswirken. Bitte seien Sie vorsichtig.', 'mass_deleted_transactions_success' => ':amount Überweisung(en) gelöscht.', 'mass_edited_transactions_success' => ':amount Überweisung(en) aktualisiert', @@ -677,11 +720,11 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', // new user: 'welcome' => 'Willkommen bei Firefly!', - 'submit' => 'Bestätigen', + 'submit' => 'Absenden', 'getting_started' => 'Erste Schritte', - 'to_get_started' => 'It is good to see you have successfully installed Firefly III. To get started with this tool please enter your bank\'s name and the balance of your main checking account. Do not worry yet if you have multiple accounts. You can add those later. It\'s just that Firefly III needs something to start with.', + 'to_get_started' => 'Es ist schön, dass Sie Firefly III erfolgreich installiert haben. Um mit diesem Tool zu beginnen, geben Sie bitte den Namen Ihrer Bank und das Guthaben Ihres Hauptkontos ein. Machen Sie sich keine Sorgen, wenn Sie mehrere Konten haben. Sie können diese später hinzufügen. Dies ist nur der Anfang.', 'savings_balance_text' => 'Firefly III will automatically create a savings account for you. By default, there will be no money in your savings account, but if you tell Firefly III the balance it will be stored as such.', - 'finish_up_new_user' => 'That\'s it! You can continue by pressing Submit. You will be taken to the index of Firefly III.', + 'finish_up_new_user' => 'Das war\'s! Sie können fortfahren, indem Sie Absenden drücken. Sie werden zur Startseite von Firefly III gebracht.', 'stored_new_accounts_new_user' => 'Yay! Ihre neuen Konten wurden gespeichert.', // home page: @@ -694,13 +737,15 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'bills_to_pay' => 'Unbezahlte Rechnungen', 'per_day' => 'Pro Tag', 'left_to_spend_per_day' => 'Left to spend per day', - 'bills_paid' => 'Bills paid', + 'bills_paid' => 'Rechnungen bezahlt', // menu and titles, should be recycled as often as possible: 'currency' => 'Währung', 'preferences' => 'Einstellungen', 'logout' => 'Abmelden', + 'toggleNavigation' => 'Navigation umschalten', 'searchPlaceholder' => 'Suchen...', + 'version' => 'Version', 'dashboard' => 'Übersicht', 'currencies' => 'Währungen', 'accounts' => 'Konten', @@ -720,11 +765,11 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'piggyBanks' => 'Sparschweine', 'bills' => 'Rechnungen', 'withdrawal' => 'Ausgabe', - 'deposit' => 'Einzahlung', + 'deposit' => 'Einnahme', 'account' => 'Konto', 'transfer' => 'Überweisung', 'Withdrawal' => 'Ausgabe', - 'Deposit' => 'Einzahlung', + 'Deposit' => 'Einnahme', 'Transfer' => 'Überweisung', 'bill' => 'Rechnung', 'yes' => 'Ja', @@ -826,8 +871,8 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'account_role_sharedAsset' => 'Shared asset account', 'account_role_savingAsset' => 'Sparkonto', 'account_role_ccAsset' => 'Kreditkarte', - 'budget_chart_click' => 'Please click on a budget name in the table above to see a chart.', - 'category_chart_click' => 'Please click on a category name in the table above to see a chart.', + 'budget_chart_click' => 'Klicken Sie auf einen Budgetnamen in der obigen Tabelle, um ein Diagramm anzuzeigen.', + 'category_chart_click' => 'Klicken Sie auf einen Kategorienamen in der obigen Tabelle, um ein Diagramm zu sehen.', // charts: @@ -840,7 +885,7 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'earned' => 'Verdient', 'overspent' => 'Zuviel ausgegeben', 'left' => 'Übrig', - 'no_budget' => '(kein Budget)', + 'no_budget' => '(no budget)', 'max-amount' => 'Höchstbetrag', 'min-amount' => 'Mindestbetrag', 'journal-amount' => 'Aktueller Rechnungseintrag', @@ -867,11 +912,11 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'sum_of_piggy_banks' => 'Summe der Sparschweine', 'saved_so_far' => 'Gespart', 'left_to_save' => 'Zu Sparen', - 'suggested_amount' => 'Suggested monthly amount to save', + 'suggested_amount' => 'Empfohlener monatliche Sparbetrag', 'add_money_to_piggy_title' => 'Geld dem Sparschwein ":name" hinzufügen', 'remove_money_from_piggy_title' => 'Geld dem Sparschwein ":name" entnehmen', 'add' => 'Hinzufügen', - 'no_money_for_piggy' => 'You have no money to put in this piggy bank.', + 'no_money_for_piggy' => 'Sie haben kein Geld, welches Sie in dieses Sparschwein geben können.', 'remove' => 'Entfernen', 'max_amount_add' => 'Der maximale Betrag, den Sie hinzufügen können ist', @@ -904,7 +949,7 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'transaction_journal_information' => 'Transaktionsinformationen', 'transaction_journal_meta' => 'Metainformationen', 'total_amount' => 'Gesamtbetrag', - 'number_of_decimals' => 'Anzahl der Dezimalstellen', + 'number_of_decimals' => 'Anzahl der Nachkommastellen', // administration 'administration' => 'Administration', @@ -926,10 +971,11 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'budgets_with_limits' => 'Budget(s) mit konfigurierten Betrag', 'rule_or_rules' => 'Regel(n)', 'rulegroup_or_groups' => 'Regelgruppe(n)', + 'tag_or_tags' => 'Tag(s)', 'configuration_updated' => 'Die Konfiguration wurde aktualisiert', 'setting_is_demo_site' => 'Demonstrationsseite', 'setting_is_demo_site_explain' => 'Wenn sie diese Option auswählen, wird sich diese Installation wie eine Demonstrationsseite verhalten, was ungewollte Auswirkungen haben kann.', - 'block_code_bounced' => 'Email message(s) bounced', + 'block_code_bounced' => 'E-Mail-Nachricht(en) wurden abgewiesen', 'block_code_expired' => 'Demo-Konto abgelaufen', 'no_block_code' => 'Kein Grund für Block oder Benutzer nicht blockiert', 'block_code_email_changed' => 'Der Benutzer hat die neue E-Mail-Adresse noch nicht bestätigt', @@ -962,20 +1008,20 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'link_transaction' => 'Link transaction', 'link_to_other_transaction' => 'Link this transaction to another transaction', 'select_transaction_to_link' => 'Select a transaction to link this transaction to', - 'this_transaction' => 'This transaction', + 'this_transaction' => 'Diese Transaktion', 'transaction' => 'Transaction', - 'comments' => 'Comments', + 'comments' => 'Kommentare', 'to_link_not_found' => 'If the transaction you want to link to is not listed, simply enter its ID.', - 'invalid_link_selection' => 'Cannot link these transactions', + 'invalid_link_selection' => 'Diese Transaktionen können nicht verknüpft werden', 'journals_linked' => 'Transactions are linked.', 'journals_error_linked' => 'These transactions are already linked.', 'journal_links' => 'Transaction links', 'this_withdrawal' => 'This withdrawal', - 'this_deposit' => 'This deposit', + 'this_deposit' => 'Diese Einnahme', 'this_transfer' => 'This transfer', 'overview_for_link' => 'Overview for link type ":name"', 'source_transaction' => 'Source transaction', - 'link_description' => 'Link description', + 'link_description' => 'Linkbeschreibung', 'destination_transaction' => 'Destination transaction', 'delete_journal_link' => 'Delete the link between :source and :destination', 'deleted_link' => 'Deleted link', @@ -1001,7 +1047,8 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'split_this_transfer' => 'Diese Überweisung aufteilen', 'cannot_edit_multiple_source' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple source accounts.', 'cannot_edit_multiple_dest' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple destination accounts.', - 'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.', + 'cannot_edit_reconciled' => 'You cannot edit transaction #:id with description ":description" because it has been marked as reconciled.', + 'cannot_edit_opening_balance' => 'Sie können die Eröffnungsbilanz eines Kontos nicht bearbeiten.', 'no_edit_multiple_left' => 'You have selected no valid transactions to edit.', 'cannot_convert_split_journal' => 'Cannot convert a split transaction', @@ -1013,6 +1060,7 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'import_index_title' => 'Daten in Firefly III importieren', 'import_index_sub_title' => 'Index', 'import_general_index_intro' => 'Willkommen beim Importassistenten von Firefly. Es gibt einige Möglichkeiten, Daten in Firefly III zu importieren, die hier als Schaltflächen angezeigt werden.', + 'import_general_index_csv_file' => 'Importiere eine (CSV) Datei', 'import_index_intro' => 'Dieser Assistent hilft Ihnen, Dateien von Ihrer Bank in Firefly III zu importieren. Bitte sehen Sie sich die Hilfeseiten in der oberen rechten Ecke an.', 'import_index_file' => 'Datei auswählen', 'import_index_config' => 'Wenn Sie bereits zuvor Daten in Firefly III importiert haben, haben Sie eventuell eine Kofigurationsdatei, welche einige Einstellungen für Sie voreinstellt. Für einige Banken haben andere Nutzer freundlicherweise bereits ihre Konfigurationsdatei zur Verfügung gestellt.', @@ -1028,31 +1076,31 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'import_config_bread_crumb' => 'Set up your import file', // import status page: - 'import_status_bread_crumb' => 'Import status', - 'import_status_sub_title' => 'Import status', - 'import_status_wait_title' => 'Please hold...', - 'import_status_wait_text' => 'This box will disappear in a moment.', + 'import_status_bread_crumb' => 'Importstatus', + 'import_status_sub_title' => 'Importstatus', + 'import_status_wait_title' => 'Bitte warten...', + 'import_status_wait_text' => 'Diese Box wird gleich verschwinden.', 'import_status_ready_title' => 'Der Import ist startbereit', - 'import_status_ready_text' => 'The import is ready to start. All the configuration you needed to do has been done. Please download the configuration file. It will help you with the import should it not go as planned. To actually run the import, you can either execute the following command in your console, or run the web-based import. Depending on your configuration, the console import will give you more feedback.', - 'import_status_ready_config' => 'Download configuration', - 'import_status_ready_start' => 'Start the import', - 'import_status_ready_share' => 'Please consider downloading your configuration and sharing it at the import configuration center. This will allow other users of Firefly III to import their files more easily.', - 'import_status_running_title' => 'The import is running', - 'import_status_running_placeholder' => 'Please hold for an update...', + 'import_status_ready_text' => 'Der Import ist bereit zu starten. Alle Einstellungen wurden von Ihnen erledigt. Bitte laden Sie die Konfigurationsdatei herunter. Diese wird Ihnen beim Import helfen, sollte dieser nicht wie gewünscht verlaufen. Um den Import tatsächlich zu starten führen Sie den folgenden Befehl in der Konsole aus oder nutzen Sie den Web-basierten Import. Abhängig von ihrer Konfiguration wird Ihnen der Konsolenimport mehr Rückmeldungen geben.', + 'import_status_ready_config' => 'Konfigurationsdatei herunterladen', + 'import_status_ready_start' => 'Starte den Import', + 'import_status_ready_share' => 'Bitte denken Sie darüber nach ihre Konfiguration herunterzuladen und in der Sammlung an Import-Einstellungen zu teilen. Dieses erlaubt es anderen Nutzern von Firefly III ihre Daten einfacher zu importieren.', + 'import_status_running_title' => 'Der Import läuft', + 'import_status_running_placeholder' => 'Bitte warten Sie auf eine Aktualisierung...', 'import_status_errors_title' => 'Fehler beim Import', - 'import_status_errors_single' => 'An error has occured during the import. It does not appear to be fatal.', - 'import_status_errors_multi' => 'Some errors occured during the import. These do not appear to be fatal.', + 'import_status_errors_single' => 'Beim Import ist ein Fehler aufgetreten. Dieser scheint aber nicht schwerwiegend zu sein.', + 'import_status_errors_multi' => 'Beim Import sind einige Fehler aufgetreten. Diese scheinen aber nicht schwerwiegend zu sein.', 'import_status_fatal_title' => 'Ein schwerwiegender Fehler ist aufgetreten', - 'import_status_fatal_text' => 'A fatal error occurred, which the import-routine cannot recover from. Please see the explanation in red below.', - 'import_status_fatal_more' => 'If the error is a time-out, the import will have stopped half-way. For some server configurations, it is merely the server that stopped while the import keeps running in the background. To verify this, check out the log files. If the problem persists, consider importing over the command line instead.', + 'import_status_fatal_text' => 'Es ist ein schwerwiegender Fehler aufgetreten und die Importroutine kann nicht fortgeführt werden. Bitte sehen Sie sich die Erklärung in rot unten an.', + 'import_status_fatal_more' => 'Wenn der Fehler eine Zeitüberschreitung ist, wird der Import mittendrin gestoppt. Bei einigen Serverkonfigurationen wird lediglich der Server gestoppt, während der Import im Hintergrund ausgeführt wird. Um dies zu überprüfen, überprüfen Sie die Protokolldateien. Wenn das Problem weiterhin besteht, sollten Sie stattdessen den Import über die Befehlszeile in Erwägung ziehen.', 'import_status_finished_title' => 'Importassistent abgeschlossen', 'import_status_finished_text' => 'Der Importassistenten hat Ihre Datei importiert.', - 'import_status_finished_job' => 'The transactions imported can be found in tag :tag.', + 'import_status_finished_job' => 'Die importierten Transaktionen finden Sie im Tag : tag.', 'import_status_job_running' => 'Der Import läuft...', 'import_with_key' => 'Import with key \':key\'', // sandstorm.io errors and messages: - 'sandstorm_not_available' => 'This function is not available when you are using Firefly III within a Sandstorm.io environment.', + 'sandstorm_not_available' => 'Diese Funktion ist nicht verfügbar, wenn Sie Firefly III in einer Sandstorm.io-Umgebung verwenden.', // empty lists? no objects? instructions: 'no_accounts_title_asset' => 'Let\'s create an asset account!', @@ -1068,36 +1116,36 @@ Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'no_accounts_imperative_revenue' => 'Revenue accounts are created automatically when you create transactions, but you can create one manually too, if you want. Let\'s create one now:', 'no_accounts_create_revenue' => 'Create a revenue account', 'no_budgets_title_default' => 'Let\'s create a budget', - 'no_budgets_intro_default' => 'You have no budgets yet. Budgets are used to organise your expenses into logical groups, which you can give a soft-cap to limit your expenses.', + 'no_budgets_intro_default' => 'Sie haben noch keine Budgets. Budgets werden verwendet, um Ihre Ausgaben in logischen Gruppen zu organisieren, die Sie mit einem Limit versehen können, um Ihre Ausgaben zu begrenzen.', 'no_budgets_imperative_default' => 'Budgets are the basic tools of financial management. Let\'s create one now:', 'no_budgets_create_default' => 'Ein Budget erstellen', - 'no_categories_title_default' => 'Lassen Sie uns eine Kategorie erstellen!', + 'no_categories_title_default' => 'Erstellen wir eine Kategorie!', 'no_categories_intro_default' => 'You have no categories yet. Categories are used to fine tune your transactions and label them with their designated category.', 'no_categories_imperative_default' => 'Categories are created automatically when you create transactions, but you can create one manually too. Let\'s create one now:', 'no_categories_create_default' => 'Eine Kategorie erstellen', - 'no_tags_title_default' => 'Lassen Sie uns ein Tag erstellen!', + 'no_tags_title_default' => 'Erstellen wir einen Tag!', 'no_tags_intro_default' => 'You have no tags yet. Tags are used to fine tune your transactions and label them with specific keywords.', 'no_tags_imperative_default' => 'Tags are created automatically when you create transactions, but you can create one manually too. Let\'s create one now:', 'no_tags_create_default' => 'Ein neues Tag erstellen', 'no_transactions_title_withdrawal' => 'Let\'s create an expense!', - 'no_transactions_intro_withdrawal' => 'You have no expenses yet. You should create expenses to start managing your finances.', - 'no_transactions_imperative_withdrawal' => 'Have you spent some money? Then you should write it down:', + 'no_transactions_intro_withdrawal' => 'Sie haben noch keine Ausgaben verbucht. Sie sollten Ausgabenseinträge erstellen, um Ihre Finanzen zu verwalten.', + 'no_transactions_imperative_withdrawal' => 'Haben Sie Geld ausgegeben? Dann sollten Sie es aufschreiben:', 'no_transactions_create_withdrawal' => 'Eine neue Ausgabe erstellen', 'no_transactions_title_deposit' => 'Let\'s create some income!', - 'no_transactions_intro_deposit' => 'You have no recorded income yet. You should create income entries to start managing your finances.', - 'no_transactions_imperative_deposit' => 'Have you received some money? Then you should write it down:', - 'no_transactions_create_deposit' => 'Create a deposit', + 'no_transactions_intro_deposit' => 'Sie haben noch keine Einnahmen verbucht. Sie sollten Einkommenseinträge erstellen, um Ihre Finanzen zu verwalten.', + 'no_transactions_imperative_deposit' => 'Haben Sie Geld erhalten? Dann sollten Sie es aufschreiben:', + 'no_transactions_create_deposit' => 'Eine Einnahme erstellen', 'no_transactions_title_transfers' => 'Let\'s create a transfer!', - 'no_transactions_intro_transfers' => 'You have no transfers yet. When you move money between asset accounts, it is recorded as a transfer.', - 'no_transactions_imperative_transfers' => 'Have you moved some money around? Then you should write it down:', + 'no_transactions_intro_transfers' => 'Sie haben noch keine Transfers. Wenn Sie Geld zwischen Ihren Konten bewegen, wird es als Überweisung erfasst.', + 'no_transactions_imperative_transfers' => 'Haben Sie Geld überwiesen? Dann sollten Sie es aufschreiben:', 'no_transactions_create_transfers' => 'Eine Überweisung erstellen', 'no_piggies_title_default' => 'Let\'s create a piggy bank!', - 'no_piggies_intro_default' => 'You have no piggy banks yet. You can create piggy banks to divide your savings and keep track of what you\'re saving up for.', - 'no_piggies_imperative_default' => 'Do you have things you\'re saving money for? Create a piggy bank and keep track:', - 'no_piggies_create_default' => 'Create a new piggy bank', + 'no_piggies_intro_default' => 'Sie haben noch keine Sparscheine. Sie können Sparschweine erstellen, um Ihre Ersparnisse zu teilen und den Überblick darüber zu behalten, wofür Sie sparen.', + 'no_piggies_imperative_default' => 'Haben Sie Dinge, auf die Sie sparen? Erstellen Sie eine Sparschwein und behalten Sie den Überblick:', + 'no_piggies_create_default' => 'Ein neues Sparschwein erstellen', 'no_bills_title_default' => 'Let\'s create a bill!', - 'no_bills_intro_default' => 'You have no bills yet. You can create bills to keep track of regular expenses, like your rent of insurance.', - 'no_bills_imperative_default' => 'Do you have such regular bills? Create a bill and keep track of your payments:', + 'no_bills_intro_default' => 'Du hast noch keine Rechnungen. Sie können Rechnungen erstellen, um die laufenden Ausgaben, wie zum Beispiel Ihre Versicherung oder Miete, nachzuverfolgen.', + 'no_bills_imperative_default' => 'Haben Sie regelmäßige Rechnungen? Erstellen Sie eine Rechnung und verfolgen Sie Ihre Zahlungen:', 'no_bills_create_default' => 'Eine Rechnung erstellen', diff --git a/resources/lang/de_DE/form.php b/resources/lang/de_DE/form.php index 8d8c9157f2..2714fae3e4 100644 --- a/resources/lang/de_DE/form.php +++ b/resources/lang/de_DE/form.php @@ -33,7 +33,7 @@ return [ 'journal_source_account_name' => 'Kreditor (Quelle)', 'journal_source_account_id' => 'Girokonto (Quelle)', 'BIC' => 'BIC', - 'verify_password' => 'Überprüfen Sie die Kennwortsicherheit', + 'verify_password' => 'Passwortsicherheit überprüfen', 'source_account' => 'Quellkonto', 'destination_account' => 'Zielkonto', 'journal_destination_account_id' => 'Girokonto (Ziel)', @@ -57,19 +57,19 @@ return [ 'ccMonthlyPaymentDate' => 'Monatliches Zahlungsdatum der Kreditkarte', 'piggy_bank_id' => 'Sparschwein', 'returnHere' => 'Hierhin zurückkehren', - 'returnHereExplanation' => 'Nach dem Speichern, hierher zurückkehren und eine weitere zu erstellen.', + 'returnHereExplanation' => 'Nach dem Speichern hierher zurückkehren, um ein weiteres Element zu erstellen.', 'returnHereUpdateExplanation' => 'Nach dem Update, hierher zurückkehren.', 'description' => 'Beschreibung', 'expense_account' => 'Debitor (Ausgabe)', 'revenue_account' => 'Kreditor (Einnahme)', 'decimal_places' => 'Nachkommastellen', - 'exchange_rate_instruction' => 'Ausländische Währungen', + 'exchange_rate_instruction' => 'Fremdwährungen', 'source_amount' => 'Betrag (Quelle)', 'destination_amount' => 'Betrag (Ziel)', 'native_amount' => 'Nativer Betrag', 'new_email_address' => 'Neue E-Mail-Adresse', 'verification' => 'Bestätigung', - 'api_key' => 'API key', + 'api_key' => 'API-Schlüssel', 'source_account_asset' => 'Quellkonto (Bestandskonto)', 'destination_account_expense' => 'Zielkonto (Unkostenkonto)', @@ -91,6 +91,7 @@ return [ 'deletePermanently' => 'Dauerhaft löschen', 'cancel' => 'Abbrechen', 'targetdate' => 'Zieldatum', + 'startdate' => 'Startdatum', 'tag' => 'Tag', 'under' => 'Unter', 'symbol' => 'Zeichen', @@ -147,7 +148,7 @@ return [ 'journal_areYouSure' => 'Sind Sie sicher, dass Sie die Überweisung mit dem Namen ":description" löschen möchten?', 'mass_journal_are_you_sure' => 'Sind Sie sicher, dass Sie diese Überweisung löschen möchten?', 'tag_areYouSure' => 'Sind Sie sicher, dass Sie den Tag ":name" löschen möchten?', - 'journal_link_areYouSure' => 'Bist du sicher, dass du die Verknüpfung zwischen :source und :destination löschen möchtest?', + 'journal_link_areYouSure' => 'Sind Sie sicher, dass Sie die Verknüpfung zwischen :source und :destination löschen möchten?', 'linkType_areYouSure' => 'Are you sure you want to delete the link type ":name" (":inward" / ":outward")?', 'permDeleteWarning' => 'Das Löschen von Dingen in Firefly ist dauerhaft und kann nicht rückgängig gemacht werden.', 'mass_make_selection' => 'Sie können das Löschen von Elementen verhindern, indem Sie die Checkbox entfernen.', @@ -164,7 +165,7 @@ return [ 'email' => 'E-Mail Adresse', 'password' => 'Passwort', - 'password_confirmation' => 'Passwort (nochmal)', + 'password_confirmation' => 'Passwort (wiederholen)', 'blocked' => 'Ist blockiert?', 'blocked_code' => 'Grund für Block', diff --git a/resources/lang/de_DE/intro.php b/resources/lang/de_DE/intro.php index 7c470ca97f..7f181bb9f6 100644 --- a/resources/lang/de_DE/intro.php +++ b/resources/lang/de_DE/intro.php @@ -20,7 +20,7 @@ return [ // create account: 'accounts_create_iban' => 'Geben Sie Ihren Konten eine gültige IBAN. Dies könnte einen Datenimport in Zukunft sehr einfach machen.', - 'accounts_create_asset_opening_balance' => 'Anlagekonten können ein "Eröffnungsguthaben" haben, welches den Beginn der Historie dieses Kontos in Firefly angibt.', + 'accounts_create_asset_opening_balance' => 'Anlagekonten können eine "Eröffnungsbilanz" haben, welche den Beginn der Historie dieses Kontos in Firefly angibt.', 'accounts_create_asset_currency' => 'Firefly III unterstützt mehrere Währungen. Anlagenkonten haben eine Hauptwährung, die Sie hier einstellen müssen.', 'accounts_create_asset_virtual' => 'Es kann manchmal helfen, Ihrem Konto ein virtuelles Gleichgewicht zu geben: eine zusätzliche Menge, die dem tatsächlichen Kontostand immer hinzugefügt oder daraus entfernt wird.', @@ -68,14 +68,14 @@ return [ // piggy banks index: 'piggy-banks_index_saved' => 'Dieses Feld zeigt Ihnen, wie viel Sie in jedem Sparschwein gespart haben.', 'piggy-banks_index_button' => 'Neben diesem Fortschrittsbalken befinden sich zwei Buttons (+ und -), um Geld von jedem Sparschwein hinzuzufügen oder zu entfernen.', - 'piggy-banks_index_accountStatus' => 'In dieser Tabelle wird der Status der Anlagenkonten aufgeführt, die mindestens mit einem Sparschwein verbunden sind.', + 'piggy-banks_index_accountStatus' => 'In dieser Tabelle wird der Status der Anlagenkonten aufgeführt, die mit mindestens einem Sparschwein verbunden sind.', // create piggy - 'piggy-banks_create_name' => 'Was ist Ihr Ziel? Eine neue Couch, eine Kamera, Geld für Notfälle?', + 'piggy-banks_create_name' => 'Worauf sparen Sie? Eine neue Couch, eine Kamera, Geld für Notfälle?', 'piggy-banks_create_date' => 'Sie können ein Zieldatum oder einen Termin für Ihr Sparschwein festlegen.', // show piggy - 'piggy-banks_show_piggyChart' => 'Diese Grafik zeigt die Historie dieses Sparschweins.', + 'piggy-banks_show_piggyChart' => 'Dieses Diagramm zeigt den Verlauf dieses Sparschweins.', 'piggy-banks_show_piggyDetails' => 'Einige Details über Ihr Sparschwein', 'piggy-banks_show_piggyEvents' => 'Hinzufügungen oder Entfernungen sind hier ebenfalls aufgeführt.', @@ -105,9 +105,9 @@ return [ 'rules_index_outro' => 'Be sure to check out the help pages using the (?) icon in the top right!', // create rule: - 'rules_create_mandatory' => 'Choose a descriptive title, and set when the rule should be fired.', + 'rules_create_mandatory' => 'Wählen Sie einen aussagekräftigen Titel und legen Sie fest, wann die Regel ausgelöst werden soll.', 'rules_create_ruletriggerholder' => 'Add as many triggers as you like, but remember that ALL triggers must match before any actions are fired.', - 'rules_create_test_rule_triggers' => 'Use this button to see which transactions would match your rule.', + 'rules_create_test_rule_triggers' => 'Verwenden Sie diese Schaltfläche, um zu sehen, welche Transaktionen zu Ihrer Regel passen würden.', 'rules_create_actions' => 'Legen Sie so viele Aktionen fest, wie Sie möchten.', // preferences diff --git a/resources/lang/de_DE/list.php b/resources/lang/de_DE/list.php index 118d36becd..e021c7d5e9 100644 --- a/resources/lang/de_DE/list.php +++ b/resources/lang/de_DE/list.php @@ -17,7 +17,7 @@ return [ 'id' => 'Id', 'create_date' => 'Erstellt am', 'update_date' => 'Aktualisiert am', - 'updated_at' => 'Aktualisiert am', + 'updated_at' => 'Aktualisiert am', 'balance_before' => 'Bilanz vor', 'balance_after' => 'Bilanz nach', 'name' => 'Name', @@ -89,4 +89,5 @@ return [ 'sum_withdrawals' => 'Summe der Auszahlungen', 'sum_deposits' => 'Summe der Einzahlungen', 'sum_transfers' => 'Summe der Überweisungen', + 'reconcile' => 'Reconcile', ]; diff --git a/resources/lang/de_DE/validation.php b/resources/lang/de_DE/validation.php index f9e52e740e..2633ffb165 100644 --- a/resources/lang/de_DE/validation.php +++ b/resources/lang/de_DE/validation.php @@ -14,7 +14,7 @@ declare(strict_types=1); return [ 'iban' => 'Dies ist keine gültige IBAN.', 'unique_account_number_for_user' => 'Es sieht so aus, als ob diese Kontonummer bereits verwendet würde.', - 'deleted_user' => 'Aufgrund von Sicherheitsbeschränkungen ist eine Registrierung dieser Email-Adresse nicht zugelassen.', + 'deleted_user' => 'Aufgrund von Sicherheitsbeschränkungen ist eine Registrierung mit dieser E-Mail-Adresse nicht zugelassen.', 'rule_trigger_value' => 'Dieser Wert ist für den ausgewählten Trigger ungültig.', 'rule_action_value' => 'Dieser Wert ist für die gewählte Aktion ungültig.', 'file_already_attached' => 'Die hochgeladene Datei ":name" ist diesem Objekt bereits angehängt.', @@ -89,5 +89,5 @@ return [ 'in_array' => ':attribute existiert nicht in :other.', 'present' => 'Das :attribute Feld muss vorhanden sein.', 'amount_zero' => 'Der Gesamtbetrag darf nicht Null sein', - 'secure_password' => 'Das ist kein sicheres Passwort. Bitte versuche es erneut. Weitere Informationen finden Sie unter https://goo.gl/NCh2tN', + 'secure_password' => 'Das ist kein sicheres Passwort. Bitte versuchen Sie es erneut. Weitere Informationen finden Sie unter https://goo.gl/NCh2tN', ]; diff --git a/resources/lang/en_US/bank.php b/resources/lang/en_US/bank.php index 11f05b3785..4becc5984c 100644 --- a/resources/lang/en_US/bank.php +++ b/resources/lang/en_US/bank.php @@ -1,6 +1,8 @@ 'Prerequisites for an import from bunq', 'bunq_prerequisites_text' => 'In order to import from bunq, you need to obtain an API key. You can do this through the app.', -]; \ No newline at end of file +]; diff --git a/resources/lang/en_US/breadcrumbs.php b/resources/lang/en_US/breadcrumbs.php index 0be3587f3c..be62acdc7a 100644 --- a/resources/lang/en_US/breadcrumbs.php +++ b/resources/lang/en_US/breadcrumbs.php @@ -31,10 +31,12 @@ return [ 'deposit_list' => 'Revenue, income and deposits', 'transfer_list' => 'Transfers', 'transfers_list' => 'Transfers', + 'reconciliation_list' => 'Reconciliations', 'create_withdrawal' => 'Create new withdrawal', 'create_deposit' => 'Create new deposit', 'create_transfer' => 'Create new transfer', 'edit_journal' => 'Edit transaction ":description"', + 'edit_reconciliation' => 'Edit ":description"', 'delete_journal' => 'Delete transaction ":description"', 'tags' => 'Tags', 'createTag' => 'Create new tag', diff --git a/resources/lang/en_US/csv.php b/resources/lang/en_US/csv.php index eb7fe230b1..094df1e9a2 100644 --- a/resources/lang/en_US/csv.php +++ b/resources/lang/en_US/csv.php @@ -51,6 +51,8 @@ return [ 'column_account-id' => 'Asset account ID (matching Firefly)', 'column_account-name' => 'Asset account (name)', 'column_amount' => 'Amount', + 'column_amount_debet' => 'Amount (debet column)', + 'column_amount_credit' => 'Amount (credit column)', 'column_amount-comma-separated' => 'Amount (comma as decimal separator)', 'column_bill-id' => 'Bill ID (matching Firefly)', 'column_bill-name' => 'Bill name', diff --git a/resources/lang/en_US/demo.php b/resources/lang/en_US/demo.php index 5c99a55718..c35b020f4a 100644 --- a/resources/lang/en_US/demo.php +++ b/resources/lang/en_US/demo.php @@ -20,7 +20,7 @@ return [ 'currencies-index' => 'Firefly III supports multiple currencies. Although it defaults to the Euro it can be set to the US Dollar and many other currencies. As you can see a small selection of currencies has been included but you can add your own if you wish to. Changing the default currency will not change the currency of existing transactions however: Firefly III supports the use of multiple currencies at the same time.', 'transactions-index' => 'These expenses, deposits and transfers are not particularly imaginative. They have been generated automatically.', 'piggy-banks-index' => 'As you can see, there are three piggy banks. Use the plus and minus buttons to influence the amount of money in each piggy bank. Click the name of the piggy bank to see the administration for each piggy bank.', - 'import-index' => 'Of course, any CSV file can be imported into Firefly III ', + 'import-index' => 'Of course, any CSV file can be imported into Firefly III', 'import-configure-security' => 'Because of security concerns, your upload has been replaced with a local file.', 'import-configure-configuration' => 'The configuration you see below is correct for the local file.', ]; diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index 49daf7d145..718e80e255 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -13,12 +13,14 @@ declare(strict_types=1); return [ // general stuff: + 'language_incomplete' => 'Incomplete translation', 'close' => 'Close', 'actions' => 'Actions', 'edit' => 'Edit', 'delete' => 'Delete', 'welcomeBack' => 'What\'s playing?', 'everything' => 'Everything', + 'today' => 'today', 'customRange' => 'Custom range', 'apply' => 'Apply', 'select_date' => 'Select date..', @@ -130,6 +132,7 @@ return [ 'transaction_data' => 'Transaction data', 'invalid_server_configuration' => 'Invalid server configuration', 'invalid_locale_settings' => 'Firefly III is unable to format monetary amounts because your server is missing the required packages. There are instructions how to do this.', + 'quickswitch' => 'Quickswitch', // search 'search' => 'Search', @@ -147,7 +150,7 @@ return [ 'repeat_freq_half-year' => 'every half-year', 'repeat_freq_quarterly' => 'quarterly', 'repeat_freq_monthly' => 'monthly', - 'repeat_freq_weekly' => 'weekly', + 'repeat_freq_weekly' => 'weekly', 'weekly' => 'weekly', 'quarterly' => 'quarterly', 'half-year' => 'every half year', @@ -354,6 +357,7 @@ return [ 'without_date' => 'Without date', 'result' => 'Result', 'sums_apply_to_range' => 'All sums apply to the selected range', + 'mapbox_api_key' => 'To use map, get an API key from Mapbox. Open your .env file en enter this code after MAPBOX_API_KEY=.', 'press_tag_location' => 'Right click or long press to set the tag\'s location.', 'clear_location' => 'Clear location', @@ -586,6 +590,8 @@ return [ 'not_expected_period' => 'Not expected this period', 'bill_is_active' => 'Bill is active', 'bill_will_automatch' => 'Bill will automatically linked to matching transactions', + 'skips_over' => 'skips over', + // accounts: 'details_for_asset' => 'Details for asset account ":name"', 'details_for_expense' => 'Details for expense account ":name"', @@ -614,6 +620,27 @@ return [ 'revenue_accounts' => 'Revenue accounts', 'cash_accounts' => 'Cash accounts', 'Cash account' => 'Cash account', + 'reconcile_account' => 'Reconcile account ":account"', + 'delete_reconciliation' => 'Delete reconciliation', + 'update_reconciliation' => 'Update reconciliation', + 'amount_cannot_be_zero' => 'The amount cannot be zero', + 'end_of_reconcile_period' => 'End of reconcile period: :period', + 'start_of_reconcile_period' => 'Start of reconcile period: :period', + 'start_balance' => 'Start balance', + 'end_balance' => 'End balance', + 'update_balance_dates_instruction' => 'Match the amounts and dates above to your bank statement, and press "Start reconciling"', + 'select_transactions_instruction' => 'Select the transactions that appear on your bank statement.', + 'select_range_and_balance' => 'First verify the date-range and balances. Then press "Start reconciling"', + 'date_change_instruction' => 'If you change the date range now, any progress will be lost.', + 'update_selection' => 'Update selection', + 'store_reconcile' => 'Store reconciliation', + 'reconciliation_transaction' => 'Reconciliation transaction', + 'Reconciliation' => 'Reconciliation', + 'reconciliation' => 'Reconciliation', + 'reconcile_options' => 'Reconciliation options', + 'reconcile_range' => 'Reconciliation range', + 'start_reconcile' => 'Start reconciling', + 'cash' => 'cash', 'account_type' => 'Account type', 'save_transactions_by_moving' => 'Save these transaction(s) by moving them to another account:', 'stored_new_account' => 'New account ":name" stored!', @@ -626,6 +653,22 @@ return [ 'select_more_than_one_budget' => 'Please select more than one budget', 'select_more_than_one_tag' => 'Please select more than one tag', 'account_default_currency' => 'If you select another currency, new transactions from this account will have this currency pre-selected.', + 'reconcile_has_more' => 'Your Firefly III ledger has more money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".', + 'reconcile_has_less' => 'Your Firefly III ledger has less money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".', + 'reconcile_is_equal' => 'Your Firefly III ledger and your bank statements match. There is nothing to do. Please press "Confirm reconciliation" to confirm your input.', + 'create_pos_reconcile_transaction' => 'Clear the selected transactions, and create a correction adding :amount to this asset account.', + 'create_neg_reconcile_transaction' => 'Clear the selected transactions, and create a correction removing :amount from this asset account.', + 'reconcile_do_nothing' => 'Clear the selected transactions, but do not correct.', + 'reconcile_go_back' => 'You can always edit or delete a correction later.', + 'must_be_asset_account' => 'You can only reconcile asset accounts', + 'reconciliation_stored' => 'Reconciliation stored', + 'reconcilliation_transaction_title' => 'Reconciliation (:from to :to)', + 'reconcile_this_account' => 'Reconcile this account', + 'confirm_reconciliation' => 'Confirm reconciliation', + 'submitted_start_balance' => 'Submitted start balance', + 'selected_transactions' => 'Selected transactions (:count)', + 'already_cleared_transactions' => 'Already cleared transactions (:count)', + 'submitted_end_balance' => 'Submitted end balance', // categories: 'new_category' => 'New category', @@ -659,11 +702,11 @@ return [ 'stored_journal' => 'Successfully created new transaction ":description"', 'select_transactions' => 'Select transactions', 'stop_selection' => 'Stop selecting transactions', - 'edit_selected' => 'Edit selected', - 'delete_selected' => 'Delete selected', + 'reconcile_selected' => 'Reconcile', 'mass_delete_journals' => 'Delete a number of transactions', 'mass_edit_journals' => 'Edit a number of transactions', 'cannot_edit_other_fields' => 'You cannot mass-edit other fields than the ones here, because there is no room to show them. Please follow the link and edit them by one-by-one, if you need to edit these fields.', + 'no_budget' => 'none', 'perm-delete-many' => 'Deleting many items in one go can be very disruptive. Please be cautious.', 'mass_deleted_transactions_success' => 'Deleted :amount transaction(s).', 'mass_edited_transactions_success' => 'Updated :amount transaction(s)', @@ -699,7 +742,9 @@ return [ 'currency' => 'Currency', 'preferences' => 'Preferences', 'logout' => 'Logout', + 'toggleNavigation' => 'Toggle navigation', 'searchPlaceholder' => 'Search...', + 'version' => 'Version', 'dashboard' => 'Dashboard', 'currencies' => 'Currencies', 'accounts' => 'Accounts', @@ -925,6 +970,7 @@ return [ 'budgets_with_limits' => 'budget(s) with configured amount', 'rule_or_rules' => 'rule(s)', 'rulegroup_or_groups' => 'rule group(s)', + 'tag_or_tags' => 'tag(s)', 'configuration_updated' => 'The configuration has been updated', 'setting_is_demo_site' => 'Demo site', 'setting_is_demo_site_explain' => 'If you check this box, this installation will behave as if it is the demo site, which can have weird side effects.', @@ -1000,6 +1046,7 @@ return [ 'split_this_transfer' => 'Split this transfer', 'cannot_edit_multiple_source' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple source accounts.', 'cannot_edit_multiple_dest' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple destination accounts.', + 'cannot_edit_reconciled' => 'You cannot edit transaction #:id with description ":description" because it has been marked as reconciled.', 'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.', 'no_edit_multiple_left' => 'You have selected no valid transactions to edit.', 'cannot_convert_split_journal' => 'Cannot convert a split transaction', @@ -1012,6 +1059,7 @@ return [ 'import_index_title' => 'Import data into Firefly III', 'import_index_sub_title' => 'Index', 'import_general_index_intro' => 'Welcome to Firefly\'s import routine. There are a few ways of importing data into Firefly III, displayed here as buttons.', + 'import_general_index_csv_file' => 'Import a (CSV) file', 'import_index_intro' => 'This routine will help you import files from your bank into Firefly III. Please check out the help pages in the top right corner.', 'import_index_file' => 'Select your file', 'import_index_config' => 'If you have previously imported data into Firefly III, you may have a configuration file, which will pre-set configuration values for you. For some banks, other users have kindly provided their configuration file.', @@ -1095,7 +1143,7 @@ return [ 'no_piggies_imperative_default' => 'Do you have things you\'re saving money for? Create a piggy bank and keep track:', 'no_piggies_create_default' => 'Create a new piggy bank', 'no_bills_title_default' => 'Let\'s create a bill!', - 'no_bills_intro_default' => 'You have no bills yet. You can create bills to keep track of regular expenses, like your rent of insurance.', + 'no_bills_intro_default' => 'You have no bills yet. You can create bills to keep track of regular expenses, like your rent or insurance.', 'no_bills_imperative_default' => 'Do you have such regular bills? Create a bill and keep track of your payments:', 'no_bills_create_default' => 'Create a bill', diff --git a/resources/lang/en_US/form.php b/resources/lang/en_US/form.php index 24d6519276..6d7a98c2fe 100644 --- a/resources/lang/en_US/form.php +++ b/resources/lang/en_US/form.php @@ -91,6 +91,7 @@ return [ 'deletePermanently' => 'Delete permanently', 'cancel' => 'Cancel', 'targetdate' => 'Target date', + 'startdate' => 'Start date', 'tag' => 'Tag', 'under' => 'Under', 'symbol' => 'Symbol', diff --git a/resources/lang/en_US/list.php b/resources/lang/en_US/list.php index 992afacc40..8129b082fc 100644 --- a/resources/lang/en_US/list.php +++ b/resources/lang/en_US/list.php @@ -17,7 +17,7 @@ return [ 'id' => 'ID', 'create_date' => 'Created at', 'update_date' => 'Updated at', - 'updated_at' => 'Updated at', + 'updated_at' => 'Updated at', 'balance_before' => 'Balance before', 'balance_after' => 'Balance after', 'name' => 'Name', @@ -89,4 +89,5 @@ return [ 'sum_withdrawals' => 'Sum of withdrawals', 'sum_deposits' => 'Sum of deposits', 'sum_transfers' => 'Sum of transfers', + 'reconcile' => 'Reconcile', ]; diff --git a/resources/lang/es_ES/bank.php b/resources/lang/es_ES/bank.php index 11f05b3785..d331576355 100644 --- a/resources/lang/es_ES/bank.php +++ b/resources/lang/es_ES/bank.php @@ -1,6 +1,8 @@ 'Prerequisites for an import from bunq', - 'bunq_prerequisites_text' => 'In order to import from bunq, you need to obtain an API key. You can do this through the app.', -]; \ No newline at end of file + 'bunq_prerequisites_title' => 'Requisitos previos para una importación de bunq', + 'bunq_prerequisites_text' => 'Para importar de bunq, necesita obtener una clave de API. Puedes hacer esto a través de la aplicación.', +]; diff --git a/resources/lang/es_ES/breadcrumbs.php b/resources/lang/es_ES/breadcrumbs.php index be02ccc42a..11056d5703 100644 --- a/resources/lang/es_ES/breadcrumbs.php +++ b/resources/lang/es_ES/breadcrumbs.php @@ -31,10 +31,12 @@ return [ 'deposit_list' => 'Ganancia, ingresos y depósitos', 'transfer_list' => 'Transferencias', 'transfers_list' => 'Transferencias', + 'reconciliation_list' => 'Reconciliations', 'create_withdrawal' => 'Crear nuevo retiro', 'create_deposit' => 'Crear nuevo depósito', 'create_transfer' => 'Crear nueva transferencia', 'edit_journal' => 'Editar transacción ":description"', + 'edit_reconciliation' => 'Edit ":description"', 'delete_journal' => 'Eliminar transacción ":description"', 'tags' => 'Etiquetas', 'createTag' => 'Crear nueva etiqueta', diff --git a/resources/lang/es_ES/csv.php b/resources/lang/es_ES/csv.php index 42c5abf09a..452567e105 100644 --- a/resources/lang/es_ES/csv.php +++ b/resources/lang/es_ES/csv.php @@ -51,6 +51,8 @@ return [ 'column_account-id' => 'ID de la caja de ahorro (coincide con Firefly)', 'column_account-name' => 'Caja de ahorro (nombre)', 'column_amount' => 'Monto', + 'column_amount_debet' => 'Amount (debet column)', + 'column_amount_credit' => 'Amount (credit column)', 'column_amount-comma-separated' => 'Monto (coma como separador de decimales)', 'column_bill-id' => 'ID de factura (coincide con Firefly)', 'column_bill-name' => 'Nombre de factura', diff --git a/resources/lang/es_ES/demo.php b/resources/lang/es_ES/demo.php index dfb4fc04c7..62a8b022e8 100644 --- a/resources/lang/es_ES/demo.php +++ b/resources/lang/es_ES/demo.php @@ -20,7 +20,7 @@ return [ 'currencies-index' => 'Firefly III admite múltiples monedas. A pesar de que la moneda por defecto es el Euro, se puede seleccionar el Dólar de EE.UU, y muchas otras monedas. Como se puede ver se ha incluido una pequeña selección de monedas, pero puedes agregar tu propia moneda si lo deseas. Sin embargo, cambiar la moneda predeterminada no cambiará la moneda de las transacciones existentes: Firefly III admite el uso de varias monedas al mismo tiempo.', 'transactions-index' => 'Estos gastos, depósitos y transferencias no son particularmente imaginativos. Se han generado automáticamente.', 'piggy-banks-index' => 'Como puede ver, hay tres alcancías. Utilice los botones más y menos para influir en la cantidad de dinero en cada alcancía. Haga clic en el nombre de la alcancía para ver la administración de cada una.', - 'import-index' => 'Por supuesto, cualquier archivo CSV puede ser importado en Firefly III', + 'import-index' => 'Of course, any CSV file can be imported into Firefly III', 'import-configure-security' => 'Debido a problemas de seguridad, su subida se ha sustituido por un archivo local.', 'import-configure-configuration' => 'La configuración que ves a continuación es correcta para el archivo local.', ]; diff --git a/resources/lang/es_ES/firefly.php b/resources/lang/es_ES/firefly.php index fe8a9cc315..c567acc384 100644 --- a/resources/lang/es_ES/firefly.php +++ b/resources/lang/es_ES/firefly.php @@ -13,12 +13,14 @@ declare(strict_types=1); return [ // general stuff: + 'language_incomplete' => 'Incomplete translation', 'close' => 'Cerrar', 'actions' => 'Acciones', 'edit' => 'Editar', 'delete' => 'Eliminar', 'welcomeBack' => '¿Qué está pasando?', 'everything' => 'Todo', + 'today' => 'today', 'customRange' => 'Rango personalizado', 'apply' => 'Aplicar', 'select_date' => 'Seleccionar fecha...', @@ -130,6 +132,7 @@ return [ 'transaction_data' => 'Transaction data', 'invalid_server_configuration' => 'Invalid server configuration', 'invalid_locale_settings' => 'Firefly III is unable to format monetary amounts because your server is missing the required packages. There are instructions how to do this.', + 'quickswitch' => 'Quickswitch', // search 'search' => 'Buscar', @@ -147,7 +150,7 @@ return [ 'repeat_freq_half-year' => 'every half-year', 'repeat_freq_quarterly' => 'quarterly', 'repeat_freq_monthly' => 'monthly', - 'repeat_freq_weekly' => 'weekly', + 'repeat_freq_weekly' => 'weekly', 'weekly' => 'weekly', 'quarterly' => 'quarterly', 'half-year' => 'every half year', @@ -354,6 +357,7 @@ return [ 'without_date' => 'Without date', 'result' => 'Result', 'sums_apply_to_range' => 'All sums apply to the selected range', + 'mapbox_api_key' => 'To use map, get an API key from Mapbox. Open your .env file en enter this code after MAPBOX_API_KEY=.', 'press_tag_location' => 'Right click or long press to set the tag\'s location.', 'clear_location' => 'Clear location', @@ -586,6 +590,8 @@ return [ 'not_expected_period' => 'Not expected this period', 'bill_is_active' => 'Bill is active', 'bill_will_automatch' => 'Bill will automatically linked to matching transactions', + 'skips_over' => 'skips over', + // accounts: 'details_for_asset' => 'Details for asset account ":name"', 'details_for_expense' => 'Details for expense account ":name"', @@ -614,6 +620,27 @@ return [ 'revenue_accounts' => 'Cuentas de ingresos', 'cash_accounts' => 'Cuentas de efectivo', 'Cash account' => 'Cash account', + 'reconcile_account' => 'Reconcile account ":account"', + 'delete_reconciliation' => 'Delete reconciliation', + 'update_reconciliation' => 'Update reconciliation', + 'amount_cannot_be_zero' => 'The amount cannot be zero', + 'end_of_reconcile_period' => 'End of reconcile period: :period', + 'start_of_reconcile_period' => 'Start of reconcile period: :period', + 'start_balance' => 'Start balance', + 'end_balance' => 'End balance', + 'update_balance_dates_instruction' => 'Match the amounts and dates above to your bank statement, and press "Start reconciling"', + 'select_transactions_instruction' => 'Select the transactions that appear on your bank statement.', + 'select_range_and_balance' => 'First verify the date-range and balances. Then press "Start reconciling"', + 'date_change_instruction' => 'If you change the date range now, any progress will be lost.', + 'update_selection' => 'Update selection', + 'store_reconcile' => 'Store reconciliation', + 'reconciliation_transaction' => 'Reconciliation transaction', + 'Reconciliation' => 'Reconciliation', + 'reconciliation' => 'Reconciliation', + 'reconcile_options' => 'Reconciliation options', + 'reconcile_range' => 'Reconciliation range', + 'start_reconcile' => 'Start reconciling', + 'cash' => 'cash', 'account_type' => 'Account type', 'save_transactions_by_moving' => 'Save these transaction(s) by moving them to another account:', 'stored_new_account' => 'New account ":name" stored!', @@ -626,6 +653,22 @@ return [ 'select_more_than_one_budget' => 'Please select more than one budget', 'select_more_than_one_tag' => 'Please select more than one tag', 'account_default_currency' => 'If you select another currency, new transactions from this account will have this currency pre-selected.', + 'reconcile_has_more' => 'Your Firefly III ledger has more money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".', + 'reconcile_has_less' => 'Your Firefly III ledger has less money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".', + 'reconcile_is_equal' => 'Your Firefly III ledger and your bank statements match. There is nothing to do. Please press "Confirm reconciliation" to confirm your input.', + 'create_pos_reconcile_transaction' => 'Clear the selected transactions, and create a correction adding :amount to this asset account.', + 'create_neg_reconcile_transaction' => 'Clear the selected transactions, and create a correction removing :amount from this asset account.', + 'reconcile_do_nothing' => 'Clear the selected transactions, but do not correct.', + 'reconcile_go_back' => 'You can always edit or delete a correction later.', + 'must_be_asset_account' => 'You can only reconcile asset accounts', + 'reconciliation_stored' => 'Reconciliation stored', + 'reconcilliation_transaction_title' => 'Reconciliation (:from to :to)', + 'reconcile_this_account' => 'Reconcile this account', + 'confirm_reconciliation' => 'Confirm reconciliation', + 'submitted_start_balance' => 'Submitted start balance', + 'selected_transactions' => 'Selected transactions (:count)', + 'already_cleared_transactions' => 'Already cleared transactions (:count)', + 'submitted_end_balance' => 'Submitted end balance', // categories: 'new_category' => 'New category', @@ -659,11 +702,11 @@ return [ 'stored_journal' => 'Successfully created new transaction ":description"', 'select_transactions' => 'Select transactions', 'stop_selection' => 'Stop selecting transactions', - 'edit_selected' => 'Edit selected', - 'delete_selected' => 'Delete selected', + 'reconcile_selected' => 'Reconcile', 'mass_delete_journals' => 'Delete a number of transactions', 'mass_edit_journals' => 'Edit a number of transactions', 'cannot_edit_other_fields' => 'You cannot mass-edit other fields than the ones here, because there is no room to show them. Please follow the link and edit them by one-by-one, if you need to edit these fields.', + 'no_budget' => '(no budget)', 'perm-delete-many' => 'Deleting many items in one go can be very disruptive. Please be cautious.', 'mass_deleted_transactions_success' => 'Deleted :amount transaction(s).', 'mass_edited_transactions_success' => 'Updated :amount transaction(s)', @@ -699,7 +742,9 @@ return [ 'currency' => 'Currency', 'preferences' => 'Preferencias', 'logout' => 'Cerrar sesión', + 'toggleNavigation' => 'Toggle navigation', 'searchPlaceholder' => 'Buscar...', + 'version' => 'Version', 'dashboard' => 'Panel de control', 'currencies' => 'Divisas', 'accounts' => 'Cuentas', @@ -925,6 +970,7 @@ return [ 'budgets_with_limits' => 'presupuesto(s) con el importe configurado', 'rule_or_rules' => 'regla(s)', 'rulegroup_or_groups' => 'rule group(s)', + 'tag_or_tags' => 'tag(s)', 'configuration_updated' => 'The configuration has been updated', 'setting_is_demo_site' => 'Demo site', 'setting_is_demo_site_explain' => 'If you check this box, this installation will behave as if it is the demo site, which can have weird side effects.', @@ -1000,6 +1046,7 @@ return [ 'split_this_transfer' => 'Split this transfer', 'cannot_edit_multiple_source' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple source accounts.', 'cannot_edit_multiple_dest' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple destination accounts.', + 'cannot_edit_reconciled' => 'You cannot edit transaction #:id with description ":description" because it has been marked as reconciled.', 'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.', 'no_edit_multiple_left' => 'You have selected no valid transactions to edit.', 'cannot_convert_split_journal' => 'Cannot convert a split transaction', @@ -1012,6 +1059,7 @@ return [ 'import_index_title' => 'Importar datos a Firefly III', 'import_index_sub_title' => 'Índice', 'import_general_index_intro' => 'Welcome to Firefly\'s import routine. There are a few ways of importing data into Firefly III, displayed here as buttons.', + 'import_general_index_csv_file' => 'Import a (CSV) file', 'import_index_intro' => 'This routine will help you import files from your bank into Firefly III. Please check out the help pages in the top right corner.', 'import_index_file' => 'Select your file', 'import_index_config' => 'If you have previously imported data into Firefly III, you may have a configuration file, which will pre-set configuration values for you. For some banks, other users have kindly provided their configuration file.', @@ -1095,7 +1143,7 @@ return [ 'no_piggies_imperative_default' => 'Do you have things you\'re saving money for? Create a piggy bank and keep track:', 'no_piggies_create_default' => 'Create a new piggy bank', 'no_bills_title_default' => '¡Vamos a crear una factura!', - 'no_bills_intro_default' => 'Aún no tienes facturas. Puedes crear facturas para realizar un seguimiento de los gastos periódicos, como el alquiler o un seguro.', + 'no_bills_intro_default' => 'You have no bills yet. You can create bills to keep track of regular expenses, like your rent or insurance.', 'no_bills_imperative_default' => '¿Tienes facturas periódicas? Crea una factura y haz un seguimiento de tus pagos:', 'no_bills_create_default' => 'Crear una factura', diff --git a/resources/lang/es_ES/form.php b/resources/lang/es_ES/form.php index ae0dcf5931..e201f9d429 100644 --- a/resources/lang/es_ES/form.php +++ b/resources/lang/es_ES/form.php @@ -30,25 +30,25 @@ return [ 'currency_id' => 'Divisa', 'attachments' => 'Adjuntos', 'journal_amount' => 'Importe', - 'journal_source_account_name' => 'Revenue account (source)', - 'journal_source_account_id' => 'Asset account (source)', + 'journal_source_account_name' => 'Cuenta de ingresos (origen)', + 'journal_source_account_id' => 'Cuenta de activos (origen)', 'BIC' => 'BIC', 'verify_password' => 'Verificar la seguridad de contraseña', 'source_account' => 'Cuenta origen', 'destination_account' => 'Cuenta destino', - 'journal_destination_account_id' => 'Asset account (destination)', - 'asset_destination_account' => 'Asset account (destination)', - 'asset_source_account' => 'Asset account (source)', + 'journal_destination_account_id' => 'Cuenta de activos (destino)', + 'asset_destination_account' => 'Cuenta de activos (destino)', + 'asset_source_account' => 'Cuenta de activos (origen)', 'journal_description' => 'Descripción', 'note' => 'Notas', - 'split_journal' => 'Split this transaction', - 'split_journal_explanation' => 'Split this transaction in multiple parts', + 'split_journal' => 'Dividir esta transacción', + 'split_journal_explanation' => 'Dividir esta transacción en múltiples partes', 'currency' => 'Divisa', 'account_id' => 'Cuenta', 'budget_id' => 'Presupuesto', 'openingBalance' => 'Saldo inicial', 'tagMode' => 'Modo de etiqueta', - 'tag_position' => 'Tag location', + 'tag_position' => 'Etiquetar ubicación', 'virtualBalance' => 'Saldo virtual', 'targetamount' => 'Cantidad objetivo', 'accountRole' => 'Tipo de cuenta', @@ -67,16 +67,16 @@ return [ 'source_amount' => 'Importe (origen)', 'destination_amount' => 'Importe (destino)', 'native_amount' => 'Native amount', - 'new_email_address' => 'New email address', - 'verification' => 'Verification', - 'api_key' => 'API key', + 'new_email_address' => 'Nueva dirección de email', + 'verification' => 'Verificación', + 'api_key' => 'Clave de API', - 'source_account_asset' => 'Source account (asset account)', - 'destination_account_expense' => 'Destination account (expense account)', - 'destination_account_asset' => 'Destination account (asset account)', - 'source_account_revenue' => 'Source account (revenue account)', + 'source_account_asset' => 'Cuenta de origen (cuenta de activos)', + 'destination_account_expense' => 'Cuenta de destino (cuenta de gastos)', + 'destination_account_asset' => 'Cuenta de destino (cuenta de activos)', + 'source_account_revenue' => 'Cuenta de origen (cuenta de ingresos)', 'type' => 'Tipo', - 'convert_Withdrawal' => 'Convert withdrawal', + 'convert_Withdrawal' => 'Convertir extracción', 'convert_Deposit' => 'Convertir depósito', 'convert_Transfer' => 'Convertir transferencia', @@ -90,7 +90,8 @@ return [ 'tags' => 'Etiquetas', 'deletePermanently' => 'Borrar permanentemente', 'cancel' => 'Cancelar', - 'targetdate' => 'Target date', + 'targetdate' => 'Fecha tope', + 'startdate' => 'Start date', 'tag' => 'Etiqueta', 'under' => 'Under', 'symbol' => 'Símbolo', @@ -117,50 +118,50 @@ return [ 'stop_processing' => 'Detener el procesamiento', 'start_date' => 'Inicio del rango', 'end_date' => 'Final del rango', - 'export_start_range' => 'Start of export range', - 'export_end_range' => 'End of export range', + 'export_start_range' => 'Inicio del rango de exportación', + 'export_end_range' => 'Fin del rango de exportación', 'export_format' => 'Formato del archivo', 'include_attachments' => 'Incluir archivos adjuntos subidos', 'include_old_uploads' => 'Incluir datos importados', - 'accounts' => 'Export transactions from these accounts', - 'delete_account' => 'Delete account ":name"', - 'delete_bill' => 'Delete bill ":name"', - 'delete_budget' => 'Delete budget ":name"', - 'delete_category' => 'Delete category ":name"', + 'accounts' => 'Exportar transacciones de estas cuentas', + 'delete_account' => 'Borrar cuenta ":name"', + 'delete_bill' => 'Eliminar factura ":name"', + 'delete_budget' => 'Eliminar presupuesto ":name"', + 'delete_category' => 'Eliminar categoría ":name"', 'delete_currency' => 'Eliminar divisa ":name"', 'delete_journal' => 'Eliminar la transacción con descripción ":description"', 'delete_attachment' => 'Eliminar adjunto ":name"', 'delete_rule' => 'Eliminar regla ":title"', 'delete_rule_group' => 'Eliminar grupo de reglas ":title"', 'delete_link_type' => 'Eliminar tipo de enlace ":name"', - 'delete_user' => 'Delete user ":email"', - 'user_areYouSure' => 'If you delete user ":email", everything will be gone. There is no undo, undelete or anything. If you delete yourself, you will lose access to this instance of Firefly III.', - 'attachment_areYouSure' => 'Are you sure you want to delete the attachment named ":name"?', - 'account_areYouSure' => 'Are you sure you want to delete the account named ":name"?', - 'bill_areYouSure' => 'Are you sure you want to delete the bill named ":name"?', - 'rule_areYouSure' => 'Are you sure you want to delete the rule titled ":title"?', - 'ruleGroup_areYouSure' => 'Are you sure you want to delete the rule group titled ":title"?', - 'budget_areYouSure' => 'Are you sure you want to delete the budget named ":name"?', - 'category_areYouSure' => 'Are you sure you want to delete the category named ":name"?', - 'currency_areYouSure' => 'Are you sure you want to delete the currency named ":name"?', - 'piggyBank_areYouSure' => 'Are you sure you want to delete the piggy bank named ":name"?', - 'journal_areYouSure' => 'Are you sure you want to delete the transaction described ":description"?', + 'delete_user' => 'Eliminar usuario ":email"', + 'user_areYouSure' => 'Si elimina usuario ":email", todo desaparecerá. No hay deshacer, recuperar ni nada. Si te eliminas, perderás el acceso a esta instancia de Firefly III.', + 'attachment_areYouSure' => '¿Seguro que quieres eliminar el archivo adjunto llamado "name"?', + 'account_areYouSure' => '¿Seguro que quieres eliminar la cuenta llamada ":name"?', + 'bill_areYouSure' => '¿Seguro que quieres eliminar la factura llamada ":name"?', + 'rule_areYouSure' => '¿Seguro que quieres eliminar la regla titulada ":title"?', + 'ruleGroup_areYouSure' => '¿Seguro que quieres eliminar el grupo de reglas titulado ":title"?', + 'budget_areYouSure' => '¿Seguro que quieres eliminar el presupuesto llamado ":name"?', + 'category_areYouSure' => '¿Seguro que quieres eliminar la categoría llamada ":name"?', + 'currency_areYouSure' => '¿Está seguro que desea eliminar la moneda denominada ":name"?', + 'piggyBank_areYouSure' => '¿Está seguro que desea eliminar la hucha llamada ":name"?', + 'journal_areYouSure' => '¿Estás seguro de que deseas eliminar la transacción descrita ":description"?', 'mass_journal_are_you_sure' => 'Are you sure you want to delete these transactions?', - 'tag_areYouSure' => 'Are you sure you want to delete the tag ":tag"?', - 'journal_link_areYouSure' => 'Are you sure you want to delete the link between :source and :destination?', - 'linkType_areYouSure' => 'Are you sure you want to delete the link type ":name" (":inward" / ":outward")?', - 'permDeleteWarning' => 'Deleting stuff from Firely is permanent and cannot be undone.', - 'mass_make_selection' => 'You can still prevent items from being deleted by removing the checkbox.', - 'delete_all_permanently' => 'Delete selected permanently', - 'update_all_journals' => 'Update these transactions', - 'also_delete_transactions' => 'The only transaction connected to this account will be deleted as well.|All :count transactions connected to this account will be deleted as well.', - 'also_delete_connections' => 'The only transaction linked with this link type will lose this connection.|All :count transactions linked with this link type will lose their connection.', - 'also_delete_rules' => 'The only rule connected to this rule group will be deleted as well.|All :count rules connected to this rule group will be deleted as well.', - 'also_delete_piggyBanks' => 'The only piggy bank connected to this account will be deleted as well.|All :count piggy bank connected to this account will be deleted as well.', - 'bill_keep_transactions' => 'The only transaction connected to this bill will not be deleted.|All :count transactions connected to this bill will spared deletion.', - 'budget_keep_transactions' => 'The only transaction connected to this budget will not be deleted.|All :count transactions connected to this budget will spared deletion.', - 'category_keep_transactions' => 'The only transaction connected to this category will not be deleted.|All :count transactions connected to this category will spared deletion.', - 'tag_keep_transactions' => 'The only transaction connected to this tag will not be deleted.|All :count transactions connected to this tag will spared deletion.', + 'tag_areYouSure' => '¿Seguro que quieres eliminar la etiqueta ":tag"?', + 'journal_link_areYouSure' => '¿Seguro que quieres eliminar el vínculo entre :source y :destination?', + 'linkType_areYouSure' => '¿Estás seguro de que deseas eliminar el tipo de vínculo ":name" (":inward" / ":outward")?', + 'permDeleteWarning' => 'Eliminar cosas de Firely es permanente y no se puede deshacer.', + 'mass_make_selection' => 'Aún puede evitar que se eliminen elementos quitando la casilla de verificación.', + 'delete_all_permanently' => 'Eliminar selección permanentemente', + 'update_all_journals' => 'Actualiza estas transacciones', + 'also_delete_transactions' => 'La única transacción conectada a esta cuenta también se eliminará. | Todas las :count transacciones conectadas a esta cuenta también se eliminarán.', + 'also_delete_connections' => 'La única transacción vinculada con este tipo de enlace perderá esta conexión. | Todas las :count transacciones vinculadas con este tipo de enlace perderán su conexión.', + 'also_delete_rules' => 'La única regla conectada a este grupo de reglas también se eliminará. | Todas las :count reglas conectadas a este grupo de reglas también se eliminarán.', + 'also_delete_piggyBanks' => 'La única alcancía conectada a esta cuenta también se eliminará. | Todas las :count alcancías conectadas a esta cuenta también se eliminará.', + 'bill_keep_transactions' => 'La única transacción conectada a esta factura no se eliminará. | Todas las :count transacciones conectadas a esta factura evitarán la eliminación.', + 'budget_keep_transactions' => 'La única transacción conectada a este presupuesto no se eliminará. | Todas las :count transacciones conectadas a este presupuesto evitarán la eliminación.', + 'category_keep_transactions' => 'La única transacción conectada a esta categoría no se eliminará. | Todas las :count transacciones conectadas a esta categoría evitarán la eliminación.', + 'tag_keep_transactions' => 'La única transacción conectada a esta etiqueta no se eliminará. | Todas las :count transacciones conectadas a esta etiqueta evitarán la eliminación.', 'email' => 'Correo electrónico', 'password' => 'Contraseña', @@ -171,27 +172,27 @@ return [ // admin 'domain' => 'Dominio', - 'single_user_mode' => 'Disable user registration', + 'single_user_mode' => 'Deshabilitar registro de usuario', 'is_demo_site' => 'Está en modo demostración', // import 'import_file' => 'Importar archivo', 'configuration_file' => 'Archivo de configuración', - 'import_file_type' => 'Import file type', - 'csv_comma' => 'A comma (,)', - 'csv_semicolon' => 'A semicolon (;)', - 'csv_tab' => 'A tab (invisible)', - 'csv_delimiter' => 'CSV field delimiter', - 'csv_import_account' => 'Default import account', - 'csv_config' => 'CSV import configuration', + 'import_file_type' => 'Importar tipo de archivo', + 'csv_comma' => 'Una coma (,)', + 'csv_semicolon' => 'Un punto y coma (;)', + 'csv_tab' => 'Un tabulador (invisible)', + 'csv_delimiter' => 'Delimitador de campo CSV', + 'csv_import_account' => 'Cuenta de importación predeterminada', + 'csv_config' => 'Configuración de importación de CSV', - 'due_date' => 'Due date', - 'payment_date' => 'Payment date', - 'invoice_date' => 'Invoice date', - 'internal_reference' => 'Internal reference', - 'inward' => 'Inward description', - 'outward' => 'Outward description', - 'rule_group_id' => 'Rule group', + 'due_date' => 'Fecha de vencimiento', + 'payment_date' => 'Fecha de pago', + 'invoice_date' => 'Fecha de la factura', + 'internal_reference' => 'Referencia interna', + 'inward' => 'Descripción interna', + 'outward' => 'Descripción externa', + 'rule_group_id' => 'Grupo de reglas', ]; diff --git a/resources/lang/es_ES/list.php b/resources/lang/es_ES/list.php index 77824e1ef7..d658e4995b 100644 --- a/resources/lang/es_ES/list.php +++ b/resources/lang/es_ES/list.php @@ -17,7 +17,7 @@ return [ 'id' => 'ID', 'create_date' => 'Fecha de creación', 'update_date' => 'Fecha de modificación', - 'updated_at' => 'Updated at', + 'updated_at' => 'Updated at', 'balance_before' => 'Balance antes de ', 'balance_after' => 'Balance después de la', 'name' => 'Nombre', @@ -83,10 +83,11 @@ return [ 'inward' => 'Descripción interna', 'outward' => 'Descripción externa', 'number_of_transactions' => 'Número de transacciones', - 'total_amount' => 'Total amount', - 'sum' => 'Sum', + 'total_amount' => 'Total', + 'sum' => 'Suma', 'sum_excluding_transfers' => 'Sum (excluding transfers)', 'sum_withdrawals' => 'Sum of withdrawals', 'sum_deposits' => 'Sum of deposits', - 'sum_transfers' => 'Sum of transfers', + 'sum_transfers' => 'Suma de transferencias', + 'reconcile' => 'Reconcile', ]; diff --git a/resources/lang/fr_FR/bank.php b/resources/lang/fr_FR/bank.php index e15a71094d..dc45c22851 100644 --- a/resources/lang/fr_FR/bank.php +++ b/resources/lang/fr_FR/bank.php @@ -1,6 +1,8 @@ 'Pré-requis pour un import depuis Bunq', 'bunq_prerequisites_text' => 'Pour pouvoir importer depuis Bunq, vous avez besoin d\'obtenir une clé API. Vous pouvez faire celà depuis l\'appli.', -]; \ No newline at end of file +]; diff --git a/resources/lang/fr_FR/breadcrumbs.php b/resources/lang/fr_FR/breadcrumbs.php index f807e4aedb..20ac87c186 100644 --- a/resources/lang/fr_FR/breadcrumbs.php +++ b/resources/lang/fr_FR/breadcrumbs.php @@ -31,10 +31,12 @@ return [ 'deposit_list' => 'Revenu, salaire et versements', 'transfer_list' => 'Virements', 'transfers_list' => 'Virements', + 'reconciliation_list' => 'Rapprochements', 'create_withdrawal' => 'Créer un nouveau retrait', 'create_deposit' => 'Créer un nouveau versement', 'create_transfer' => 'Créer un nouveau virement', 'edit_journal' => 'Éditer la transaction ":description"', + 'edit_reconciliation' => 'Éditer ":description"', 'delete_journal' => 'Supprimer la transaction ":description"', 'tags' => 'Mots-clés', 'createTag' => 'Créer un nouveau mot-clé', diff --git a/resources/lang/fr_FR/csv.php b/resources/lang/fr_FR/csv.php index 0d678882b7..b9cd03e7a1 100644 --- a/resources/lang/fr_FR/csv.php +++ b/resources/lang/fr_FR/csv.php @@ -51,6 +51,8 @@ return [ 'column_account-id' => 'Compte d\'actif (ID correspondant à Firefly)', 'column_account-name' => 'Compte d’actif (nom)', 'column_amount' => 'Montant', + 'column_amount_debet' => 'Montant (colonne débit)', + 'column_amount_credit' => 'Montant (colonne de crédit)', 'column_amount-comma-separated' => 'Montant (virgule comme séparateur décimal)', 'column_bill-id' => 'Facture (ID correspondant à Firefly)', 'column_bill-name' => 'Nom de la facture', diff --git a/resources/lang/fr_FR/demo.php b/resources/lang/fr_FR/demo.php index fbb7aaa450..6466b291ac 100644 --- a/resources/lang/fr_FR/demo.php +++ b/resources/lang/fr_FR/demo.php @@ -20,7 +20,7 @@ return [ 'currencies-index' => 'Firefly III prend en charge plusieurs devises. Bien que l\'Euro soit la devise par défaut, cette dernière peut être changée pour le Dollar américain et de nombreuses autres devises. Comme vous pouvez le remarquer une petite sélection des monnaies a été incluse, mais vous pouvez ajouter vos propres devises si vous le souhaitez. Gardez à l\'esprit que la modification de la devise par défaut ne modifie pas la monnaie des transactions existantes : Firefly III prend en charge l’utilisation de plusieurs devises en même temps.', 'transactions-index' => 'Ces dépenses, dépôts et transferts ne sont pas particulièrement imaginatifs. Ils ont été générés automatiquement.', 'piggy-banks-index' => 'Comme vous pouvez le voir, il y a trois tirelires. Utilisez les boutons plus et moins pour influer sur le montant d’argent dans chaque tirelire. Cliquez sur le nom de la tirelire pour voir l’administration pour chaque tirelire.', - 'import-index' => 'Bien sûr, n’importe quel fichier CSV peut être importé dans Firefly III ', + 'import-index' => 'Bien sûr, n’importe quel fichier CSV peut être importé dans Firefly III', 'import-configure-security' => 'Pour des raisons de sécurité, votre téléchargement a été remplacé par un fichier local.', 'import-configure-configuration' => 'La configuration que vous voyez ci-dessous est correcte pour le fichier local.', ]; diff --git a/resources/lang/fr_FR/firefly.php b/resources/lang/fr_FR/firefly.php index 8f249119da..b9d082f29b 100644 --- a/resources/lang/fr_FR/firefly.php +++ b/resources/lang/fr_FR/firefly.php @@ -13,12 +13,14 @@ declare(strict_types=1); return [ // general stuff: + 'language_incomplete' => 'Traduction incomplète', 'close' => 'Fermer', 'actions' => 'Actions', 'edit' => 'Modifier', 'delete' => 'Supprimer', 'welcomeBack' => 'Que se passe-t-il ?', 'everything' => 'Tout', + 'today' => 'aujourd\'hui', 'customRange' => 'Etendue personnalisée', 'apply' => 'Appliquer', 'select_date' => 'Sélectionner une date..', @@ -130,6 +132,7 @@ return [ 'transaction_data' => 'Données de transaction', 'invalid_server_configuration' => 'Configuration de serveur invalide', 'invalid_locale_settings' => 'Firefly III ne parvient pas à formater les montants monétaires car il manque des paquets logiciels sur votre serveur. Voici des insctructions sur comment procéder.', + 'quickswitch' => 'Changement rapide', // search 'search' => 'Rechercher', @@ -144,10 +147,10 @@ return [ // repeat frequencies: 'repeat_freq_yearly' => 'annuellement', - 'repeat_freq_half-year' => 'every half-year', - 'repeat_freq_quarterly' => 'quarterly', + 'repeat_freq_half-year' => 'semestriel', + 'repeat_freq_quarterly' => 'trimestriel', 'repeat_freq_monthly' => 'mensuel', - 'repeat_freq_weekly' => 'weekly', + 'repeat_freq_weekly' => 'hebdomadaire', 'weekly' => 'hebdomadaire', 'quarterly' => 'trimestriel', 'half-year' => 'semestriel', @@ -354,6 +357,7 @@ return [ 'without_date' => 'Sans date', 'result' => 'Résultat', 'sums_apply_to_range' => 'Toutes les sommes s\'appliquent à l\'ensemble sélectionné', + 'mapbox_api_key' => 'Pour utiliser la carte, obtenez une clé API à partir de Mapbox. Ouvrez votre fichier .env et entrez ce code après MAPBOX_API_KEY = .', 'press_tag_location' => 'Faites un clic droit ou appuyez longuement sur pour définir l\'emplacement de l\'étiquette.', 'clear_location' => 'Effacer la localisation', @@ -587,6 +591,8 @@ return [ 'not_expected_period' => 'Cette période n\'est pas prévu', 'bill_is_active' => 'Facture en cours', 'bill_will_automatch' => 'La facture sera automatiquement liée aux transactions correspondantes', + 'skips_over' => 'saute', + // accounts: 'details_for_asset' => 'Détails pour le compte d’actif ":name"', 'details_for_expense' => 'Détail du compte de dépenses ":name"', @@ -615,6 +621,27 @@ return [ 'revenue_accounts' => 'Comptes de recettes', 'cash_accounts' => 'Comptes de trésorerie', 'Cash account' => 'Compte de trésorerie', + 'reconcile_account' => 'Rapprocher le compte ":account"', + 'delete_reconciliation' => 'Supprimer le rapprochement', + 'update_reconciliation' => 'Mettre à jour le rapprochement', + 'amount_cannot_be_zero' => 'Le montant ne peut pas être zéro', + 'end_of_reconcile_period' => 'Fin de la période de rapptrochement : :period', + 'start_of_reconcile_period' => 'Début de la période de rapprochement : :period', + 'start_balance' => 'Solde initial', + 'end_balance' => 'Solde de clotûre', + 'update_balance_dates_instruction' => 'Faites correspondre les montants et les dates ci-dessus à votre relevé bancaire et appuyez sur "Démarrer le rapprochement"', + 'select_transactions_instruction' => 'Sélectionnez les transactions qui apparaissent sur votre relevé bancaire.', + 'select_range_and_balance' => 'Vérifiez d\'abord la plage de dates et les soldes. Puis appuyez sur "Démarrer le rapprochement"', + 'date_change_instruction' => 'Si vous modifiez la plage de dates maintenant, toute progression sera perdue.', + 'update_selection' => 'Mettre à jour la sélection', + 'store_reconcile' => 'Stocker le rapprochement', + 'reconciliation_transaction' => 'Transaction de rapprochement', + 'Reconciliation' => 'Rapprochement', + 'reconciliation' => 'Rapprochement', + 'reconcile_options' => 'Options de rapprochement', + 'reconcile_range' => 'Plage de rapprochement', + 'start_reconcile' => 'Commencer le rapprochement', + 'cash' => 'espèce', 'account_type' => 'Type de compte', 'save_transactions_by_moving' => 'Enregistrer ces opération(s) en les déplaçant vers un autre compte :', 'stored_new_account' => 'Nouveau compte ":name" créé !', @@ -627,6 +654,22 @@ return [ 'select_more_than_one_budget' => 'Veuillez sélectionner plus d\'un budget', 'select_more_than_one_tag' => 'Veuillez sélectionner plus d\'un tag', 'account_default_currency' => 'Si vous sélectionnez une autre monnaie, les nouvelles transactions de ce compte auront cette monnaie pré-sélectionnées.', + 'reconcile_has_more' => 'Votre registre Firefly III a plus d\'argent que ce que votre banque prétend que vous devriez avoir. Il y a plusieurs options. S\'il vous plaît choisir quoi faire. Ensuite, appuyez sur "Confirmer le rapprochement".', + 'reconcile_has_less' => 'Votre registre Firefly III a moins d\'argent que ce que votre banque prétend que vous devriez avoir. Il y a plusieurs options. S\'il vous plaît choisir quoi faire. Ensuite, appuyez sur "Confirmer le rapprochement".', + 'reconcile_is_equal' => 'Votre registre Firefly III et vos relevés bancaires correspondent. Il n\'y a rien à faire. S\'il vous plaît appuyez sur "Confirmer le rapprochement" pour confirmer votre entrée.', + 'create_pos_reconcile_transaction' => 'Effacez les transactions sélectionnées et créez une correction en ajoutant :amount à ce compte d\'actif.', + 'create_neg_reconcile_transaction' => 'Effacez les transactions sélectionnées et créez une correction en enlevant :amount à ce compte d\'actif.', + 'reconcile_do_nothing' => 'Effacez les transactions sélectionnées, mais ne les corrigez pas.', + 'reconcile_go_back' => 'Vous pouvez toujours modifier ou supprimer une correction ultérieurement.', + 'must_be_asset_account' => 'Vous pouvez uniquement rapprocher les comptes d\'actifs', + 'reconciliation_stored' => 'Rapprochement stocké', + 'reconcilliation_transaction_title' => 'Rapprochement (:from vers :to)', + 'reconcile_this_account' => 'Rapprocher ce compte', + 'confirm_reconciliation' => 'Confirmer le rapprochement', + 'submitted_start_balance' => 'Solde initial soumis', + 'selected_transactions' => 'Transactions sélectionnées ( :count)', + 'already_cleared_transactions' => 'Transactions déjà effacées ( :count)', + 'submitted_end_balance' => 'Solde final soumis', // categories: 'new_category' => 'Nouvelle catégorie', @@ -660,11 +703,11 @@ return [ 'stored_journal' => 'Opération créée avec succès ":description"', 'select_transactions' => 'Sélectionner des opérations', 'stop_selection' => 'Arrêter de sélectionner les transactions', - 'edit_selected' => 'Modifier la sélection', - 'delete_selected' => 'Supprimer la sélection', + 'reconcile_selected' => 'Rapproché', 'mass_delete_journals' => 'Supprimer un certain nombre de transactions', 'mass_edit_journals' => 'Modifier un certain nombre d’opérations', 'cannot_edit_other_fields' => 'Vous ne peut pas modifier en masse d\'autres champs que ceux ici, car il n’y a pas de place pour tous les montrer. S’il vous plaît suivez le lien et modifiez les par un par un, si vous devez modifier ces champs.', + 'no_budget' => '(pas de budget)', 'perm-delete-many' => 'Supprimer de nombreux éléments en une seule fois peut être très problématique. Soyez prudent.', 'mass_deleted_transactions_success' => 'Montant des opérations supprimées : :amount.', 'mass_edited_transactions_success' => 'Montant des opérations mises à jour : :amount', @@ -700,7 +743,9 @@ return [ 'currency' => 'Devise', 'preferences' => 'Préférences', 'logout' => 'Se déconnecter', + 'toggleNavigation' => 'Activer navigation', 'searchPlaceholder' => 'Rechercher...', + 'version' => 'Version', 'dashboard' => 'Tableau de Bord', 'currencies' => 'Devises', 'accounts' => 'Comptes', @@ -710,7 +755,7 @@ return [ 'Revenue account' => 'Compte de recettes', 'Initial balance account' => 'Balance initiale', 'budgets' => 'Budgets', - 'tags' => 'Tags', + 'tags' => 'Mots-clés', 'reports' => 'Rapports', 'transactions' => 'Opérations', 'expenses' => 'Dépenses', @@ -915,7 +960,7 @@ return [ 'firefly_instance_configuration' => 'Options de configuration pour Firefly III', 'setting_single_user_mode' => 'Mode utilisateur unique', 'setting_single_user_mode_explain' => 'Par défaut, Firefly III accepte uniquement un (1) enregistrement : vous. Il s\'agit d\'une mesure de sécurité qui empêche les autres d\'utiliser votre instance, à moins que vous ne les autorisiez. Les enregistrements futurs sont bloqués. Lorsque vous désactivez cette case, d\'autres personnes peuvent utiliser votre instance aussi bien, en supposant qu\'elles puissent l\'atteindre (quand il est connecté à Internet).', - 'store_configuration' => 'Configuration de la boutique', + 'store_configuration' => 'Sauvegarder la configuration', 'single_user_administration' => 'Gestion de l\'utilisateur pour :email', 'edit_user' => 'Modifier l\'utilisateur :email', 'hidden_fields_preferences' => 'Tous les champs ne sont pas visibles dès maintenant. Vous devez les activer dans vos paramètres.', @@ -926,6 +971,7 @@ return [ 'budgets_with_limits' => 'budget(s) avec montant configuré', 'rule_or_rules' => 'règle(s)', 'rulegroup_or_groups' => 'groupe(s) de règles', + 'tag_or_tags' => 'tag (s)', 'configuration_updated' => 'La configuration a été mise à jour', 'setting_is_demo_site' => 'Site de démonstration', 'setting_is_demo_site_explain' => 'Si vous cochez cette case, cette installation se comportera comme si c\'était le site de démonstration, ce qui peut engendrer des effets secondaires étranges.', @@ -1001,6 +1047,7 @@ return [ 'split_this_transfer' => 'Scinder ce transfert', 'cannot_edit_multiple_source' => 'Vous ne pouvez pas modifier la transaction scindée #:id avec la description ":description" car elle contient plusieurs comptes sources.', 'cannot_edit_multiple_dest' => 'Vous ne pouvez pas modifier la transaction scindée #:id avec la description ":description" car elle contient plusieurs comptes de destination.', + 'cannot_edit_reconciled' => 'Vous ne pouvez pas modifier transaction #: id avec la description ": description" car elle a été marquée comme rapprochée.', 'cannot_edit_opening_balance' => 'Vous ne pouvez pas modifier le solde d\'ouverture d\'un compte.', 'no_edit_multiple_left' => 'Vous n\'avez sélectionné aucune transaction valide à éditer.', 'cannot_convert_split_journal' => 'Vous ne pouvez pas convertir une transaction ventilée', @@ -1013,6 +1060,7 @@ return [ 'import_index_title' => 'Importer des données dans Firefly III', 'import_index_sub_title' => 'Index', 'import_general_index_intro' => 'Bienvenue dans la routine d\'importation de Firefly. Il existe différentes façons d\'importer des données dans Firefly III, affichées ici sous forme de boutons.', + 'import_general_index_csv_file' => 'Importer un fichier CSV', 'import_index_intro' => 'Cette routine vous aidera à importer des fichiers de votre banque dans Firefly III. Consultez les pages d\'aide en haut à droite.', 'import_index_file' => 'Sélectionnez votre fichier', 'import_index_config' => 'Si vous avez précédemment importé des données dans Firefly III, vous pouvez avoir un fichier de configuration qui définira les valeurs de configuration. Pour certaines banques, les autres utilisateurs ont bien voulu fournir leur fichier configuration.', @@ -1096,7 +1144,7 @@ return [ 'no_piggies_imperative_default' => 'Avez-vous des choses pour lesquelles vous économisez de l\'argent ? Créer une tirelire et suivez-là :', 'no_piggies_create_default' => 'Créer une nouvelle tirelire', 'no_bills_title_default' => 'Nous allons créer une facture !', - 'no_bills_intro_default' => 'Vous n\'avez pas encore de factures. Vous pouvez créer des factures pour suivre les dépenses ordinaires, comme votre loyer d\'assurance.', + 'no_bills_intro_default' => 'Vous n\'avez pas encore de factures. Vous pouvez créer des factures pour suivre les dépenses ordinaires, comme votre loyer ou l\'assurance.', 'no_bills_imperative_default' => 'Avez-vous des factures régulières ? Créez une facture et suivez vos paiements :', 'no_bills_create_default' => 'Créer une facture', diff --git a/resources/lang/fr_FR/form.php b/resources/lang/fr_FR/form.php index 713da77a23..7c8f86d20e 100644 --- a/resources/lang/fr_FR/form.php +++ b/resources/lang/fr_FR/form.php @@ -91,6 +91,7 @@ return [ 'deletePermanently' => 'Supprimer définitivement', 'cancel' => 'Annuler', 'targetdate' => 'Date cible', + 'startdate' => 'Date de début', 'tag' => 'Mot-clé', 'under' => 'En dessous de', 'symbol' => 'Symbole', @@ -171,7 +172,7 @@ return [ // admin 'domain' => 'Domaine', - 'single_user_mode' => 'Disable user registration', + 'single_user_mode' => 'Désactiver le formulaire d\'inscription', 'is_demo_site' => 'Est un site de démonstration', diff --git a/resources/lang/fr_FR/list.php b/resources/lang/fr_FR/list.php index 7851f5e0a2..d857ad4361 100644 --- a/resources/lang/fr_FR/list.php +++ b/resources/lang/fr_FR/list.php @@ -17,7 +17,7 @@ return [ 'id' => 'Identifiant', 'create_date' => 'Créé le', 'update_date' => 'Mis à jour le', - 'updated_at' => 'Mis à jour le', + 'updated_at' => 'Mis à jour le', 'balance_before' => 'Solde avant', 'balance_after' => 'Solde après', 'name' => 'Nom', @@ -89,4 +89,5 @@ return [ 'sum_withdrawals' => 'Somme des retraits', 'sum_deposits' => 'Somme des dépôts', 'sum_transfers' => 'Somme des transferts', + 'reconcile' => 'Rapprocher', ]; diff --git a/resources/lang/id_ID/bank.php b/resources/lang/id_ID/bank.php index 189df0107b..7a4a8d1b11 100644 --- a/resources/lang/id_ID/bank.php +++ b/resources/lang/id_ID/bank.php @@ -1,6 +1,8 @@ 'Prasyarat untuk impor dari bunq', 'bunq_prerequisites_text' => 'Untuk mengimpor dari bunq, Anda perlu mendapatkan kunci API. Anda dapat melakukan ini melalui aplikasi.', -]; \ No newline at end of file +]; diff --git a/resources/lang/id_ID/breadcrumbs.php b/resources/lang/id_ID/breadcrumbs.php index 0e8a1deda7..52438bb1cf 100644 --- a/resources/lang/id_ID/breadcrumbs.php +++ b/resources/lang/id_ID/breadcrumbs.php @@ -31,10 +31,12 @@ return [ 'deposit_list' => 'Pendapatan, pemasukan, dan deposit', 'transfer_list' => 'Transfer', 'transfers_list' => 'Transfer', + 'reconciliation_list' => 'Reconciliations', 'create_withdrawal' => 'Buat penarikan baru', 'create_deposit' => 'Buat deposit baru', 'create_transfer' => 'Buat transfer baru', 'edit_journal' => 'Edit transaksi ":description"', + 'edit_reconciliation' => 'Edit ":description"', 'delete_journal' => 'Hapus transaksi ":description"', 'tags' => 'Label', 'createTag' => 'Buat label baru', diff --git a/resources/lang/id_ID/csv.php b/resources/lang/id_ID/csv.php index ff1c20c9ae..21209b6726 100644 --- a/resources/lang/id_ID/csv.php +++ b/resources/lang/id_ID/csv.php @@ -51,6 +51,8 @@ return [ 'column_account-id' => 'ID akun aset (yang cocok dengan Firefly)', 'column_account-name' => 'Akun aset (nama)', 'column_amount' => 'Jumlah', + 'column_amount_debet' => 'Amount (debet column)', + 'column_amount_credit' => 'Amount (credit column)', 'column_amount-comma-separated' => 'Jumlah (koma sebagai tanda desimal)', 'column_bill-id' => 'ID tagihan (yang cocok dengan Firefly)', 'column_bill-name' => 'Nama tagihan', diff --git a/resources/lang/id_ID/demo.php b/resources/lang/id_ID/demo.php index 5c99a55718..c35b020f4a 100644 --- a/resources/lang/id_ID/demo.php +++ b/resources/lang/id_ID/demo.php @@ -20,7 +20,7 @@ return [ 'currencies-index' => 'Firefly III supports multiple currencies. Although it defaults to the Euro it can be set to the US Dollar and many other currencies. As you can see a small selection of currencies has been included but you can add your own if you wish to. Changing the default currency will not change the currency of existing transactions however: Firefly III supports the use of multiple currencies at the same time.', 'transactions-index' => 'These expenses, deposits and transfers are not particularly imaginative. They have been generated automatically.', 'piggy-banks-index' => 'As you can see, there are three piggy banks. Use the plus and minus buttons to influence the amount of money in each piggy bank. Click the name of the piggy bank to see the administration for each piggy bank.', - 'import-index' => 'Of course, any CSV file can be imported into Firefly III ', + 'import-index' => 'Of course, any CSV file can be imported into Firefly III', 'import-configure-security' => 'Because of security concerns, your upload has been replaced with a local file.', 'import-configure-configuration' => 'The configuration you see below is correct for the local file.', ]; diff --git a/resources/lang/id_ID/firefly.php b/resources/lang/id_ID/firefly.php index 49daf7d145..147509399d 100644 --- a/resources/lang/id_ID/firefly.php +++ b/resources/lang/id_ID/firefly.php @@ -13,12 +13,14 @@ declare(strict_types=1); return [ // general stuff: + 'language_incomplete' => 'Incomplete translation', 'close' => 'Close', 'actions' => 'Actions', 'edit' => 'Edit', 'delete' => 'Delete', 'welcomeBack' => 'What\'s playing?', 'everything' => 'Everything', + 'today' => 'today', 'customRange' => 'Custom range', 'apply' => 'Apply', 'select_date' => 'Select date..', @@ -130,6 +132,7 @@ return [ 'transaction_data' => 'Transaction data', 'invalid_server_configuration' => 'Invalid server configuration', 'invalid_locale_settings' => 'Firefly III is unable to format monetary amounts because your server is missing the required packages. There are instructions how to do this.', + 'quickswitch' => 'Quickswitch', // search 'search' => 'Search', @@ -147,7 +150,7 @@ return [ 'repeat_freq_half-year' => 'every half-year', 'repeat_freq_quarterly' => 'quarterly', 'repeat_freq_monthly' => 'monthly', - 'repeat_freq_weekly' => 'weekly', + 'repeat_freq_weekly' => 'weekly', 'weekly' => 'weekly', 'quarterly' => 'quarterly', 'half-year' => 'every half year', @@ -354,6 +357,7 @@ return [ 'without_date' => 'Without date', 'result' => 'Result', 'sums_apply_to_range' => 'All sums apply to the selected range', + 'mapbox_api_key' => 'To use map, get an API key from Mapbox. Open your .env file en enter this code after MAPBOX_API_KEY=.', 'press_tag_location' => 'Right click or long press to set the tag\'s location.', 'clear_location' => 'Clear location', @@ -586,6 +590,8 @@ return [ 'not_expected_period' => 'Not expected this period', 'bill_is_active' => 'Bill is active', 'bill_will_automatch' => 'Bill will automatically linked to matching transactions', + 'skips_over' => 'skips over', + // accounts: 'details_for_asset' => 'Details for asset account ":name"', 'details_for_expense' => 'Details for expense account ":name"', @@ -614,6 +620,27 @@ return [ 'revenue_accounts' => 'Revenue accounts', 'cash_accounts' => 'Cash accounts', 'Cash account' => 'Cash account', + 'reconcile_account' => 'Reconcile account ":account"', + 'delete_reconciliation' => 'Delete reconciliation', + 'update_reconciliation' => 'Update reconciliation', + 'amount_cannot_be_zero' => 'The amount cannot be zero', + 'end_of_reconcile_period' => 'End of reconcile period: :period', + 'start_of_reconcile_period' => 'Start of reconcile period: :period', + 'start_balance' => 'Start balance', + 'end_balance' => 'End balance', + 'update_balance_dates_instruction' => 'Match the amounts and dates above to your bank statement, and press "Start reconciling"', + 'select_transactions_instruction' => 'Select the transactions that appear on your bank statement.', + 'select_range_and_balance' => 'First verify the date-range and balances. Then press "Start reconciling"', + 'date_change_instruction' => 'If you change the date range now, any progress will be lost.', + 'update_selection' => 'Update selection', + 'store_reconcile' => 'Store reconciliation', + 'reconciliation_transaction' => 'Reconciliation transaction', + 'Reconciliation' => 'Reconciliation', + 'reconciliation' => 'Reconciliation', + 'reconcile_options' => 'Reconciliation options', + 'reconcile_range' => 'Reconciliation range', + 'start_reconcile' => 'Start reconciling', + 'cash' => 'cash', 'account_type' => 'Account type', 'save_transactions_by_moving' => 'Save these transaction(s) by moving them to another account:', 'stored_new_account' => 'New account ":name" stored!', @@ -626,6 +653,22 @@ return [ 'select_more_than_one_budget' => 'Please select more than one budget', 'select_more_than_one_tag' => 'Please select more than one tag', 'account_default_currency' => 'If you select another currency, new transactions from this account will have this currency pre-selected.', + 'reconcile_has_more' => 'Your Firefly III ledger has more money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".', + 'reconcile_has_less' => 'Your Firefly III ledger has less money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".', + 'reconcile_is_equal' => 'Your Firefly III ledger and your bank statements match. There is nothing to do. Please press "Confirm reconciliation" to confirm your input.', + 'create_pos_reconcile_transaction' => 'Clear the selected transactions, and create a correction adding :amount to this asset account.', + 'create_neg_reconcile_transaction' => 'Clear the selected transactions, and create a correction removing :amount from this asset account.', + 'reconcile_do_nothing' => 'Clear the selected transactions, but do not correct.', + 'reconcile_go_back' => 'You can always edit or delete a correction later.', + 'must_be_asset_account' => 'You can only reconcile asset accounts', + 'reconciliation_stored' => 'Reconciliation stored', + 'reconcilliation_transaction_title' => 'Reconciliation (:from to :to)', + 'reconcile_this_account' => 'Reconcile this account', + 'confirm_reconciliation' => 'Confirm reconciliation', + 'submitted_start_balance' => 'Submitted start balance', + 'selected_transactions' => 'Selected transactions (:count)', + 'already_cleared_transactions' => 'Already cleared transactions (:count)', + 'submitted_end_balance' => 'Submitted end balance', // categories: 'new_category' => 'New category', @@ -659,11 +702,11 @@ return [ 'stored_journal' => 'Successfully created new transaction ":description"', 'select_transactions' => 'Select transactions', 'stop_selection' => 'Stop selecting transactions', - 'edit_selected' => 'Edit selected', - 'delete_selected' => 'Delete selected', + 'reconcile_selected' => 'Reconcile', 'mass_delete_journals' => 'Delete a number of transactions', 'mass_edit_journals' => 'Edit a number of transactions', 'cannot_edit_other_fields' => 'You cannot mass-edit other fields than the ones here, because there is no room to show them. Please follow the link and edit them by one-by-one, if you need to edit these fields.', + 'no_budget' => '(no budget)', 'perm-delete-many' => 'Deleting many items in one go can be very disruptive. Please be cautious.', 'mass_deleted_transactions_success' => 'Deleted :amount transaction(s).', 'mass_edited_transactions_success' => 'Updated :amount transaction(s)', @@ -699,7 +742,9 @@ return [ 'currency' => 'Currency', 'preferences' => 'Preferences', 'logout' => 'Logout', + 'toggleNavigation' => 'Toggle navigation', 'searchPlaceholder' => 'Search...', + 'version' => 'Version', 'dashboard' => 'Dashboard', 'currencies' => 'Currencies', 'accounts' => 'Accounts', @@ -925,6 +970,7 @@ return [ 'budgets_with_limits' => 'budget(s) with configured amount', 'rule_or_rules' => 'rule(s)', 'rulegroup_or_groups' => 'rule group(s)', + 'tag_or_tags' => 'tag(s)', 'configuration_updated' => 'The configuration has been updated', 'setting_is_demo_site' => 'Demo site', 'setting_is_demo_site_explain' => 'If you check this box, this installation will behave as if it is the demo site, which can have weird side effects.', @@ -1000,6 +1046,7 @@ return [ 'split_this_transfer' => 'Split this transfer', 'cannot_edit_multiple_source' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple source accounts.', 'cannot_edit_multiple_dest' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple destination accounts.', + 'cannot_edit_reconciled' => 'You cannot edit transaction #:id with description ":description" because it has been marked as reconciled.', 'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.', 'no_edit_multiple_left' => 'You have selected no valid transactions to edit.', 'cannot_convert_split_journal' => 'Cannot convert a split transaction', @@ -1012,6 +1059,7 @@ return [ 'import_index_title' => 'Import data into Firefly III', 'import_index_sub_title' => 'Index', 'import_general_index_intro' => 'Welcome to Firefly\'s import routine. There are a few ways of importing data into Firefly III, displayed here as buttons.', + 'import_general_index_csv_file' => 'Import a (CSV) file', 'import_index_intro' => 'This routine will help you import files from your bank into Firefly III. Please check out the help pages in the top right corner.', 'import_index_file' => 'Select your file', 'import_index_config' => 'If you have previously imported data into Firefly III, you may have a configuration file, which will pre-set configuration values for you. For some banks, other users have kindly provided their configuration file.', @@ -1095,7 +1143,7 @@ return [ 'no_piggies_imperative_default' => 'Do you have things you\'re saving money for? Create a piggy bank and keep track:', 'no_piggies_create_default' => 'Create a new piggy bank', 'no_bills_title_default' => 'Let\'s create a bill!', - 'no_bills_intro_default' => 'You have no bills yet. You can create bills to keep track of regular expenses, like your rent of insurance.', + 'no_bills_intro_default' => 'You have no bills yet. You can create bills to keep track of regular expenses, like your rent or insurance.', 'no_bills_imperative_default' => 'Do you have such regular bills? Create a bill and keep track of your payments:', 'no_bills_create_default' => 'Create a bill', diff --git a/resources/lang/id_ID/form.php b/resources/lang/id_ID/form.php index 24d6519276..6d7a98c2fe 100644 --- a/resources/lang/id_ID/form.php +++ b/resources/lang/id_ID/form.php @@ -91,6 +91,7 @@ return [ 'deletePermanently' => 'Delete permanently', 'cancel' => 'Cancel', 'targetdate' => 'Target date', + 'startdate' => 'Start date', 'tag' => 'Tag', 'under' => 'Under', 'symbol' => 'Symbol', diff --git a/resources/lang/id_ID/list.php b/resources/lang/id_ID/list.php index 992afacc40..8129b082fc 100644 --- a/resources/lang/id_ID/list.php +++ b/resources/lang/id_ID/list.php @@ -17,7 +17,7 @@ return [ 'id' => 'ID', 'create_date' => 'Created at', 'update_date' => 'Updated at', - 'updated_at' => 'Updated at', + 'updated_at' => 'Updated at', 'balance_before' => 'Balance before', 'balance_after' => 'Balance after', 'name' => 'Name', @@ -89,4 +89,5 @@ return [ 'sum_withdrawals' => 'Sum of withdrawals', 'sum_deposits' => 'Sum of deposits', 'sum_transfers' => 'Sum of transfers', + 'reconcile' => 'Reconcile', ]; diff --git a/resources/lang/nl_NL/bank.php b/resources/lang/nl_NL/bank.php index ae18c976ad..9afeaf242d 100644 --- a/resources/lang/nl_NL/bank.php +++ b/resources/lang/nl_NL/bank.php @@ -1,6 +1,8 @@ 'Voorwaarden voor een import van bunq', 'bunq_prerequisites_text' => 'Om transacties bij bunq te importeren heb je een API sleutel nodig. Dit kan via de app.', -]; \ No newline at end of file +]; diff --git a/resources/lang/nl_NL/breadcrumbs.php b/resources/lang/nl_NL/breadcrumbs.php index 16694da0ea..5e56c5e727 100644 --- a/resources/lang/nl_NL/breadcrumbs.php +++ b/resources/lang/nl_NL/breadcrumbs.php @@ -31,10 +31,12 @@ return [ 'deposit_list' => 'Inkomsten', 'transfer_list' => 'Overschrijvingen', 'transfers_list' => 'Overschrijvingen', + 'reconciliation_list' => 'Afstemmingen', 'create_withdrawal' => 'Sla nieuwe uitgave op', 'create_deposit' => 'Sla nieuwe inkomsten op', 'create_transfer' => 'Sla nieuwe overschrijving op', 'edit_journal' => 'Wijzig transactie ":description"', + 'edit_reconciliation' => 'Wijzig ":description"', 'delete_journal' => 'Verwijder transactie ":description"', 'tags' => 'Tags', 'createTag' => 'Maak nieuwe tag', diff --git a/resources/lang/nl_NL/csv.php b/resources/lang/nl_NL/csv.php index be68315716..b23f80dac1 100644 --- a/resources/lang/nl_NL/csv.php +++ b/resources/lang/nl_NL/csv.php @@ -51,6 +51,8 @@ return [ 'column_account-id' => 'Betaalrekening (ID gelijk aan Firefly)', 'column_account-name' => 'Betaalrekeningnaam', 'column_amount' => 'Bedrag', + 'column_amount_debet' => 'Bedrag (debetkolom)', + 'column_amount_credit' => 'Bedrag (creditkolom)', 'column_amount-comma-separated' => 'Bedrag (komma as decimaalscheidingsteken)', 'column_bill-id' => 'Contract (ID gelijk aan Firefly)', 'column_bill-name' => 'Contractnaam', diff --git a/resources/lang/nl_NL/demo.php b/resources/lang/nl_NL/demo.php index 01aa680497..631ff2236e 100644 --- a/resources/lang/nl_NL/demo.php +++ b/resources/lang/nl_NL/demo.php @@ -20,7 +20,7 @@ return [ 'currencies-index' => 'Firefly ondersteunt meerdere valuta\'s. Hoewel het standaard de Euro is kan je ook kiezen voor de US dollar of een van de vele anderen. Er is een kleine selectie valuta meegeleverd maar je kan je eigen valuta toevoegen. Het veranderen van de standaardvaluta verandert de bestaande transacties niet: Firefly III ondersteunt het gebruik van meerdere valuta op hetzelfde moment.', 'transactions-index' => 'Deze uitgaven, inkomsten en overschrijvingen zijn niet heel fantasierijk. Ze zijn automatisch gegenereerd.', 'piggy-banks-index' => 'Zoals je kan zien zijn er drie spaarpotjes. Gebruik de plus- en minknoppen om het bedrag in de spaarpotjes te veranderen. Klik op de naam van het spaarpotje om er de geschiedenis van te zien.', - 'import-index' => 'Uiteraard kan je elk CSV bestand importeren in Firefly III ', + 'import-index' => 'Uiteraard kan je elk CSV bestand importeren in Firefly III', 'import-configure-security' => 'Uit veiligheidsoverwegingen is je upload vervangen door een lokaal bestand.', 'import-configure-configuration' => 'Deze configuratie is correct voor het lokale bestand.', ]; diff --git a/resources/lang/nl_NL/firefly.php b/resources/lang/nl_NL/firefly.php index 94444918ed..a727a603ae 100644 --- a/resources/lang/nl_NL/firefly.php +++ b/resources/lang/nl_NL/firefly.php @@ -13,12 +13,14 @@ declare(strict_types=1); return [ // general stuff: + 'language_incomplete' => 'Onvolledige vertaling', 'close' => 'Sluiten', 'actions' => 'Acties', 'edit' => 'Wijzig', 'delete' => 'Verwijder', 'welcomeBack' => 'Hoe staat het er voor?', 'everything' => 'Alles', + 'today' => 'vandaag', 'customRange' => 'Zelf bereik kiezen', 'apply' => 'Go', 'select_date' => 'Selecteer periode..', @@ -130,6 +132,7 @@ return [ 'transaction_data' => 'Transactiegegevens', 'invalid_server_configuration' => 'Ongeldige serverconfiguratie', 'invalid_locale_settings' => 'Firefly III kan geldbedragen niet goed weergeven omdat je server de vereiste software mist. Er zijn instructies hoe dit te doen.', + 'quickswitch' => 'Quickswitch', // search 'search' => 'Zoeken', @@ -147,7 +150,7 @@ return [ 'repeat_freq_half-year' => 'elk half jaar', 'repeat_freq_quarterly' => 'elk kwartaal', 'repeat_freq_monthly' => 'maandelijks', - 'repeat_freq_weekly' => 'wekelijks', + 'repeat_freq_weekly' => 'wekelijks', 'weekly' => 'wekelijks', 'quarterly' => 'elk kwartaal', 'half-year' => 'elk half jaar', @@ -354,6 +357,7 @@ return [ 'without_date' => 'Zonder datum', 'result' => 'Resultaat', 'sums_apply_to_range' => 'Alle sommen gelden voor het geselecteerde bereik', + 'mapbox_api_key' => 'Om de kaart te gebruiken regel je een API-key bij Mapbox. Open je .env-bestand en zet deze achter MAPBOX_API_KEY=.', 'press_tag_location' => 'Klik met de rechtermuisknop of druk lang om de locatie van de tag in te stellen.', 'clear_location' => 'Wis locatie', @@ -586,6 +590,8 @@ return [ 'not_expected_period' => 'Niet verwacht deze periode', 'bill_is_active' => 'Contract is actief', 'bill_will_automatch' => 'Waar van toepassing wordt dit contract automatisch gekoppeld aan transacties', + 'skips_over' => 'slaat over', + // accounts: 'details_for_asset' => 'Overzicht voor betaalrekening ":name"', 'details_for_expense' => 'Overzicht voor crediteur ":name"', @@ -614,6 +620,27 @@ return [ 'revenue_accounts' => 'Debiteuren', 'cash_accounts' => 'Contant geldrekeningen', 'Cash account' => 'Contant geldrekening', + 'reconcile_account' => 'Afstemmen betaalrekening ": account"', + 'delete_reconciliation' => 'Verwijder correctie', + 'update_reconciliation' => 'Update correctie', + 'amount_cannot_be_zero' => 'Het bedrag mag niet nul zijn', + 'end_of_reconcile_period' => 'Einde van verrekenperiode: :period', + 'start_of_reconcile_period' => 'Begin van verrekenperiode: :period', + 'start_balance' => 'Startsaldo', + 'end_balance' => 'Eindsaldo', + 'update_balance_dates_instruction' => 'Vergelijk de bedragen en datums hierboven met uw bankafschrift en druk op "Begin met afstemmen"', + 'select_transactions_instruction' => 'Selecteer de transacties die op je bankafschrift staan.', + 'select_range_and_balance' => 'Controleer eerst het datumbereik en de saldo\'s. Druk vervolgens op "Begin met afstemmen"', + 'date_change_instruction' => 'Als je het datumbereik nu wijzigt, gaat je voortgang verloren.', + 'update_selection' => 'Selectie bijwerken', + 'store_reconcile' => 'Afstemming opslaan', + 'reconciliation_transaction' => 'Corrigerende transactie', + 'Reconciliation' => 'Correctie', + 'reconciliation' => 'Correctie', + 'reconcile_options' => 'Afstemmingsopties', + 'reconcile_range' => 'Afstemmingsbereik', + 'start_reconcile' => 'Begin met afstemmen', + 'cash' => 'contant', 'account_type' => 'Rekeningtype', 'save_transactions_by_moving' => 'Bewaar deze transacties door ze aan een andere rekening te koppelen:', 'stored_new_account' => 'Nieuwe rekening ":name" opgeslagen!', @@ -626,6 +653,22 @@ return [ 'select_more_than_one_budget' => 'Selecteer meer dan één budget', 'select_more_than_one_tag' => 'Selecteer meer dan één tag', 'account_default_currency' => 'Nieuwe transacties van deze betaalrekening krijgen automatisch deze valuta.', + 'reconcile_has_more' => 'Je Firefly III boekhouding bevat meer geld dan je bank beweert dat er in zou moeten zitten. Je hebt verschillende opties. Kies wat je wilt doen, en klik dan "Bevestig correctie".', + 'reconcile_has_less' => 'Je Firefly III boekhouding bevat minder geld dan je bank beweert dat er in zou moeten zitten. Je hebt verschillende opties. Kies wat je wilt doen, en klik dan "Bevestig correctie".', + 'reconcile_is_equal' => 'Je Firefly III boekhouding en je bankafschriften lopen gelijk. Je hoeft niets te doen. Klik op "Bevestig correctie" om je invoer te bevestigen.', + 'create_pos_reconcile_transaction' => 'Markeer de geselecteerde transacties als afgestemd, en voeg :amount toe aan de betaalrekening.', + 'create_neg_reconcile_transaction' => 'Markeer de geselecteerde transacties als afgestemd, en verwijder :amount van de betaalrekening.', + 'reconcile_do_nothing' => 'Markeer de geselecteerde transacties als afgestemd, maar maak geen correctie.', + 'reconcile_go_back' => 'Je kan een correctie later altijd wijzigen.', + 'must_be_asset_account' => 'Je kan alleen betaalrekeningen corrigeren', + 'reconciliation_stored' => 'Correctie opgeslagen', + 'reconcilliation_transaction_title' => 'Correctie (:from tot :to)', + 'reconcile_this_account' => 'Corrigeer deze rekening', + 'confirm_reconciliation' => 'Bevestig correctie', + 'submitted_start_balance' => 'Ingevoerd startsaldo', + 'selected_transactions' => 'Geselecteerde transacties (:count)', + 'already_cleared_transactions' => 'Al afgestemde transacties (:count)', + 'submitted_end_balance' => 'Ingevoerd eindsaldo', // categories: 'new_category' => 'Nieuwe categorie', @@ -659,11 +702,11 @@ return [ 'stored_journal' => 'Nieuw transactie ":description" opgeslagen', 'select_transactions' => 'Selecteer transacties', 'stop_selection' => 'Stop met selecteren', - 'edit_selected' => 'Wijzig geselecteerden', - 'delete_selected' => 'Verwijder geselecteerden', + 'reconcile_selected' => 'Verrekenen', 'mass_delete_journals' => 'Verwijder een aantal transacties', 'mass_edit_journals' => 'Wijzig een aantal transacties', 'cannot_edit_other_fields' => 'Je kan andere velden dan de velden die je hier ziet niet groepsgewijs wijzigen. Er is geen ruimte om ze te laten zien. Als je deze velden toch wilt wijzigen, volg dan de link naast de transactie en wijzig ze stuk voor stuk.', + 'no_budget' => '(geen budget)', 'perm-delete-many' => 'Veel items in één keer verwijderen kan zeer storend zijn. Wees voorzichtig.', 'mass_deleted_transactions_success' => 'Verwijder :amount transactie(s).', 'mass_edited_transactions_success' => 'Wijzig :amount transactie(s)', @@ -699,7 +742,9 @@ return [ 'currency' => 'Valuta', 'preferences' => 'Voorkeuren', 'logout' => 'Uitloggen', + 'toggleNavigation' => 'Navigatie aan of uit', 'searchPlaceholder' => 'Zoeken...', + 'version' => 'Versie', 'dashboard' => 'Dashboard', 'currencies' => 'Valuta', 'accounts' => 'Rekeningen', @@ -925,6 +970,7 @@ return [ 'budgets_with_limits' => 'budget(ten) met een ingesteld bedrag', 'rule_or_rules' => 'regel(s)', 'rulegroup_or_groups' => 'regelgroep(en)', + 'tag_or_tags' => 'tag(s)', 'configuration_updated' => 'De configuratie is bijgewerkt', 'setting_is_demo_site' => 'Demo website', 'setting_is_demo_site_explain' => 'Als je dit aanzet doet jouw installatie alsof het een demo-site is, en dat kan problemen opleveren.', @@ -1000,6 +1046,7 @@ return [ 'split_this_transfer' => 'Splits deze overschrijving', 'cannot_edit_multiple_source' => 'Je kan transactie #:id met omschrijving ":description" niet splitsen, want deze bevat meerdere bronrekeningen.', 'cannot_edit_multiple_dest' => 'Je kan transactie #:id met omschrijving ":description" niet wijzigen, want deze bevat meerdere doelrekeningen.', + 'cannot_edit_reconciled' => 'U kunt transactie #:id met omschrijving ": description" niet bewerken omdat deze is gemarkeerd als afgestemd (verrekend).', 'cannot_edit_opening_balance' => 'Je kan het startsaldo van een rekening niet wijzigen via dit scherm.', 'no_edit_multiple_left' => 'Je hebt geen geldige transacties geselecteerd.', 'cannot_convert_split_journal' => 'Kan geen gesplitste transactie omzetten', @@ -1012,6 +1059,7 @@ return [ 'import_index_title' => 'Gegevens importeren in Firefly III', 'import_index_sub_title' => 'Index', 'import_general_index_intro' => 'Dit is de import-routine van Firefly. Er zijn verschillende manieren om gegevens te importeren in Firefly III, hier als knoppen weergegeven.', + 'import_general_index_csv_file' => 'Importeer een (CSV) bestand', 'import_index_intro' => 'Deze pagina\'s helpen je bestanden van je bank te importeren in Firefly III. Gebruik de hulp-pagina\'s linksboven voor meer informatie.', 'import_index_file' => 'Selecteer je bestand', 'import_index_config' => 'Als je eerder gegevens hebt geïmporteerd in Firefly III, heb je wellicht een configuratiebestand, dat een aantal zaken alvast voor je kan instellen. Voor bepaalde banken hebben andere gebruikers uit de liefde van hun hart het benodigde configuratiebestand gedeeld.', diff --git a/resources/lang/nl_NL/form.php b/resources/lang/nl_NL/form.php index 23aee16c7e..6e395b39b1 100644 --- a/resources/lang/nl_NL/form.php +++ b/resources/lang/nl_NL/form.php @@ -91,6 +91,7 @@ return [ 'deletePermanently' => 'Verwijderen', 'cancel' => 'Annuleren', 'targetdate' => 'Doeldatum', + 'startdate' => 'Startdatum', 'tag' => 'Tag', 'under' => 'Onder', 'symbol' => 'Symbool', @@ -184,6 +185,8 @@ return [ 'csv_tab' => 'Een tab (onzichtbaar)', 'csv_delimiter' => 'CSV scheidingsteken', 'csv_import_account' => 'Standaard rekening voor importeren', + 'csv_config' => 'Configuratiebestand', + 'due_date' => 'Vervaldatum', 'payment_date' => 'Betalingsdatum', diff --git a/resources/lang/nl_NL/list.php b/resources/lang/nl_NL/list.php index ccba0762b4..2678a80cd3 100644 --- a/resources/lang/nl_NL/list.php +++ b/resources/lang/nl_NL/list.php @@ -17,7 +17,7 @@ return [ 'id' => 'ID', 'create_date' => 'Aangemaakt op', 'update_date' => 'Bijgewerkt op', - 'updated_at' => 'Bijgewerkt op', + 'updated_at' => 'Bijgewerkt op', 'balance_before' => 'Saldo voor', 'balance_after' => 'Saldo na', 'name' => 'Naam', @@ -89,4 +89,5 @@ return [ 'sum_withdrawals' => 'Som van uitgaven', 'sum_deposits' => 'Som van inkomsten', 'sum_transfers' => 'Som van overschrijvingen', + 'reconcile' => 'Afstemmen', ]; diff --git a/resources/lang/pl_PL/bank.php b/resources/lang/pl_PL/bank.php index da46c4be03..7f2f4c5db0 100644 --- a/resources/lang/pl_PL/bank.php +++ b/resources/lang/pl_PL/bank.php @@ -1,6 +1,8 @@ 'Wymagania wstępne dotyczące importowania z bunq', 'bunq_prerequisites_text' => 'Aby zaimportować dane z bunq, musisz uzyskać klucz API. Możesz to zrobić za pośrednictwem aplikacji.', -]; \ No newline at end of file +]; diff --git a/resources/lang/pl_PL/breadcrumbs.php b/resources/lang/pl_PL/breadcrumbs.php index 52019feac2..8f05e92cee 100644 --- a/resources/lang/pl_PL/breadcrumbs.php +++ b/resources/lang/pl_PL/breadcrumbs.php @@ -31,10 +31,12 @@ return [ 'deposit_list' => 'Przychody, dochody oraz depozyty', 'transfer_list' => 'Transfery', 'transfers_list' => 'Transfery', + 'reconciliation_list' => 'Reconciliations', 'create_withdrawal' => 'Utwórz nową wypłatę', 'create_deposit' => 'Utwórz nową wpłatę', 'create_transfer' => 'Utwórz nowy transfer', 'edit_journal' => 'Modyfikuj transakcję ":description"', + 'edit_reconciliation' => 'Edit ":description"', 'delete_journal' => 'Usuń transakcję ":description"', 'tags' => 'Tagi', 'createTag' => 'Utwórz nowy tag', diff --git a/resources/lang/pl_PL/csv.php b/resources/lang/pl_PL/csv.php index 77e80a686a..a4789a5db3 100644 --- a/resources/lang/pl_PL/csv.php +++ b/resources/lang/pl_PL/csv.php @@ -51,6 +51,8 @@ return [ 'column_account-id' => 'ID konta aktywów (taki sam jak w Firefly)', 'column_account-name' => 'Konto aktywów (nazwa)', 'column_amount' => 'Kwota', + 'column_amount_debet' => 'Amount (debet column)', + 'column_amount_credit' => 'Amount (credit column)', 'column_amount-comma-separated' => 'Kwota (przecinek jako separator dziesiętny)', 'column_bill-id' => 'ID rachunku (taki sam jak w Firefly)', 'column_bill-name' => 'Nazwa rachunku', diff --git a/resources/lang/pl_PL/demo.php b/resources/lang/pl_PL/demo.php index 0ffd1b88bf..094bff01a7 100644 --- a/resources/lang/pl_PL/demo.php +++ b/resources/lang/pl_PL/demo.php @@ -20,7 +20,7 @@ return [ 'currencies-index' => 'Firefly III supports multiple currencies. Although it defaults to the Euro it can be set to the US Dollar and many other currencies. As you can see a small selection of currencies has been included but you can add your own if you wish to. Changing the default currency will not change the currency of existing transactions however: Firefly III supports the use of multiple currencies at the same time.', 'transactions-index' => 'These expenses, deposits and transfers are not particularly imaginative. They have been generated automatically.', 'piggy-banks-index' => 'As you can see, there are three piggy banks. Use the plus and minus buttons to influence the amount of money in each piggy bank. Click the name of the piggy bank to see the administration for each piggy bank.', - 'import-index' => 'Of course, any CSV file can be imported into Firefly III ', + 'import-index' => 'Of course, any CSV file can be imported into Firefly III', 'import-configure-security' => 'Because of security concerns, your upload has been replaced with a local file.', 'import-configure-configuration' => 'Konfiguracja, która widzisz poniżej jest prawidłowa dla lokalnego pliku.', ]; diff --git a/resources/lang/pl_PL/firefly.php b/resources/lang/pl_PL/firefly.php index f1c3209bea..e616a331e8 100644 --- a/resources/lang/pl_PL/firefly.php +++ b/resources/lang/pl_PL/firefly.php @@ -13,12 +13,14 @@ declare(strict_types=1); return [ // general stuff: + 'language_incomplete' => 'Niepełne tłumaczenie', 'close' => 'Zamknij', 'actions' => 'Akcje', 'edit' => 'Modyfikuj', 'delete' => 'Usuń', 'welcomeBack' => 'Co jest grane?', 'everything' => 'Wszystko', + 'today' => 'dzisiaj', 'customRange' => 'Niestandardowy zakres', 'apply' => 'Zastosuj', 'select_date' => 'Wybierz datę...', @@ -130,6 +132,7 @@ return [ 'transaction_data' => 'Dane transakcji', 'invalid_server_configuration' => 'Nieprawidłowa konfiguracja serwera', 'invalid_locale_settings' => 'Firefly III nie może sformatować kwot, ponieważ brakuje wymaganych pakietów na Twoim serwerze. Sprawdźinstrukcje jak je zainstalować (po angielsku).', + 'quickswitch' => 'Szybki przełącznik', // search 'search' => 'Szukaj', @@ -144,10 +147,10 @@ return [ // repeat frequencies: 'repeat_freq_yearly' => 'rocznie', - 'repeat_freq_half-year' => 'every half-year', - 'repeat_freq_quarterly' => 'quarterly', + 'repeat_freq_half-year' => 'co pół roku', + 'repeat_freq_quarterly' => 'kwartalnie', 'repeat_freq_monthly' => 'miesięcznie', - 'repeat_freq_weekly' => 'weekly', + 'repeat_freq_weekly' => 'tygodniowo', 'weekly' => 'tygodniowo', 'quarterly' => 'kwartalnie', 'half-year' => 'co pół roku', @@ -354,6 +357,7 @@ return [ 'without_date' => 'Bez daty', 'result' => 'Wynik', 'sums_apply_to_range' => 'Wszystkie sumy mają zastosowanie do wybranego zakresu', + 'mapbox_api_key' => 'Aby użyć mapy, pobierz klucz API z Mapbox. Otwórz plik .env i wprowadź ten kod po MAPBOX_API_KEY=.', 'press_tag_location' => 'Kliknij prawym przyciskiem myszy lub naciśnij i przytrzymaj aby ustawić lokalizację taga.', 'clear_location' => 'Wyczyść lokalizację', @@ -586,6 +590,8 @@ return [ 'not_expected_period' => 'Nie oczekiwany w tym okresie', 'bill_is_active' => 'Rachunek jest aktywny', 'bill_will_automatch' => 'Rachunek będzie automatycznie powiązany z pasującymi transakcjami', + 'skips_over' => 'pomija', + // accounts: 'details_for_asset' => 'Szczegóły konta aktywów ":name"', 'details_for_expense' => 'Szczegóły konta wydatków ":name"', @@ -614,6 +620,27 @@ return [ 'revenue_accounts' => 'Konta przychodów', 'cash_accounts' => 'Konta gotówkowe', 'Cash account' => 'Konto gotówkowe', + 'reconcile_account' => 'Reconcile account ":account"', + 'delete_reconciliation' => 'Delete reconciliation', + 'update_reconciliation' => 'Update reconciliation', + 'amount_cannot_be_zero' => 'The amount cannot be zero', + 'end_of_reconcile_period' => 'End of reconcile period: :period', + 'start_of_reconcile_period' => 'Start of reconcile period: :period', + 'start_balance' => 'Start balance', + 'end_balance' => 'End balance', + 'update_balance_dates_instruction' => 'Match the amounts and dates above to your bank statement, and press "Start reconciling"', + 'select_transactions_instruction' => 'Select the transactions that appear on your bank statement.', + 'select_range_and_balance' => 'First verify the date-range and balances. Then press "Start reconciling"', + 'date_change_instruction' => 'If you change the date range now, any progress will be lost.', + 'update_selection' => 'Update selection', + 'store_reconcile' => 'Store reconciliation', + 'reconciliation_transaction' => 'Reconciliation transaction', + 'Reconciliation' => 'Reconciliation', + 'reconciliation' => 'Reconciliation', + 'reconcile_options' => 'Reconciliation options', + 'reconcile_range' => 'Reconciliation range', + 'start_reconcile' => 'Start reconciling', + 'cash' => 'gotówka', 'account_type' => 'Typ konta', 'save_transactions_by_moving' => 'Zapisz te transakcje, przenosząc je do innego konta:', 'stored_new_account' => 'Nowe konto ":name" zostało zapisane!', @@ -626,6 +653,22 @@ return [ 'select_more_than_one_budget' => 'Proszę wybierz więcej niż jeden budżet', 'select_more_than_one_tag' => 'Proszę wybierz więcej niż jeden tag', 'account_default_currency' => 'Jeśli wybierzesz inną walutę, nowe transakcje z tego konta będą miały tę walutę wstępnie wybraną.', + 'reconcile_has_more' => 'Your Firefly III ledger has more money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".', + 'reconcile_has_less' => 'Your Firefly III ledger has less money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".', + 'reconcile_is_equal' => 'Your Firefly III ledger and your bank statements match. There is nothing to do. Please press "Confirm reconciliation" to confirm your input.', + 'create_pos_reconcile_transaction' => 'Clear the selected transactions, and create a correction adding :amount to this asset account.', + 'create_neg_reconcile_transaction' => 'Clear the selected transactions, and create a correction removing :amount from this asset account.', + 'reconcile_do_nothing' => 'Clear the selected transactions, but do not correct.', + 'reconcile_go_back' => 'You can always edit or delete a correction later.', + 'must_be_asset_account' => 'You can only reconcile asset accounts', + 'reconciliation_stored' => 'Reconciliation stored', + 'reconcilliation_transaction_title' => 'Reconciliation (:from to :to)', + 'reconcile_this_account' => 'Reconcile this account', + 'confirm_reconciliation' => 'Confirm reconciliation', + 'submitted_start_balance' => 'Submitted start balance', + 'selected_transactions' => 'Selected transactions (:count)', + 'already_cleared_transactions' => 'Already cleared transactions (:count)', + 'submitted_end_balance' => 'Submitted end balance', // categories: 'new_category' => 'Nowa kategoria', @@ -659,11 +702,11 @@ return [ 'stored_journal' => 'Pomyślnie utworzono nową transakcję ":description"', 'select_transactions' => 'Wybierz transakcje', 'stop_selection' => 'Przestań wybierać transakcje', - 'edit_selected' => 'Modyfikuj zaznaczone', - 'delete_selected' => 'Usuń zaznaczone', + 'reconcile_selected' => 'Uzgodnij', 'mass_delete_journals' => 'Usuń wiele transakcji', 'mass_edit_journals' => 'Modyfikuj wiele transakcji', 'cannot_edit_other_fields' => 'Nie możesz masowo modyfikować innych pól niż te tutaj, ponieważ nie ma miejsca, aby je pokazać. Proszę użyć ikony edycji i edytować je jedno po drugim, jeśli chcesz edytować te pola.', + 'no_budget' => '(bez budżetu)', 'perm-delete-many' => 'Usuwanie wielu elementów jednocześnie może być bardzo destrukcyjne. Proszę zachować ostrożność.', 'mass_deleted_transactions_success' => 'Usunięto :amount transakcję(i).', 'mass_edited_transactions_success' => 'Zaktualizowano :amount transakcję(i)', @@ -699,7 +742,9 @@ return [ 'currency' => 'Waluta', 'preferences' => 'Preferencje', 'logout' => 'Wyloguj', + 'toggleNavigation' => 'Przełącz nawigację', 'searchPlaceholder' => 'Szukaj...', + 'version' => 'Wersja', 'dashboard' => 'Kokpit', 'currencies' => 'Waluty', 'accounts' => 'Konta', @@ -825,8 +870,8 @@ return [ 'account_role_sharedAsset' => 'Współdzielone konto aktywów', 'account_role_savingAsset' => 'Konto oszczędnościowe', 'account_role_ccAsset' => 'Karta kredytowa', - 'budget_chart_click' => 'Please click on a budget name in the table above to see a chart.', - 'category_chart_click' => 'Please click on a category name in the table above to see a chart.', + 'budget_chart_click' => 'Kliknij na nazwę budżetu w tabeli powyżej, aby zobaczyć wykres.', + 'category_chart_click' => 'Kliknij na nazwę kategorii w tabeli powyżej, aby zobaczyć wykres.', // charts: @@ -839,7 +884,7 @@ return [ 'earned' => 'Zarobiono', 'overspent' => 'Przepłacono', 'left' => 'Pozostało', - 'no_budget' => '(bez budżetu)', + 'no_budget' => '(no budget)', 'max-amount' => 'Maksymalna kwota', 'min-amount' => 'Minimalna kwota', 'journal-amount' => 'Faktyczna kwota', @@ -925,6 +970,7 @@ return [ 'budgets_with_limits' => 'budżet(y) z określoną kwotą', 'rule_or_rules' => 'reguła(y)', 'rulegroup_or_groups' => 'grupa(y) reguł', + 'tag_or_tags' => 'tag(ów)', 'configuration_updated' => 'Konfiguracja została zaktualizowana', 'setting_is_demo_site' => 'Strona demonstracyjna', 'setting_is_demo_site_explain' => 'Jeśli zaznaczysz to pole, ta instalacja będzie zachowywać się jak witryna demonstracyjna, co może mieć dziwne efekty uboczne.', @@ -1000,6 +1046,7 @@ return [ 'split_this_transfer' => 'Podziel ten transfer', 'cannot_edit_multiple_source' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple source accounts.', 'cannot_edit_multiple_dest' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple destination accounts.', + 'cannot_edit_reconciled' => 'You cannot edit transaction #:id with description ":description" because it has been marked as reconciled.', 'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.', 'no_edit_multiple_left' => 'Nie wybrałeś żadnych poprawnych transakcji do edycji.', 'cannot_convert_split_journal' => 'Nie można przekonwertować podzielonej transakcji', @@ -1012,6 +1059,7 @@ return [ 'import_index_title' => 'Importuj dane do Firefly III', 'import_index_sub_title' => 'Indeks', 'import_general_index_intro' => 'Witamy w procedurze importu Firefly III. Istnieje kilka sposobów importowania danych do Firefly III.', + 'import_general_index_csv_file' => 'Importuj plik CSV', 'import_index_intro' => 'Ta procedura pomoże Ci zaimportować pliki z Twojego banku do Firefly III. Proszę sprawdzić stronę pomocy w prawym górnym rogu.', 'import_index_file' => 'Wybierz swój plik', 'import_index_config' => 'Jeśli wcześniej importowałeś dane do Firefly III, może posiadać plik konfiguracji, który wstępnie ustawi wartości parametrów konfiguracyjnych dla Ciebie. Dla niektórych banków, inni użytkownicy uprzejmie dostarczyli swoje pliki konfiguracji.', @@ -1095,7 +1143,7 @@ return [ 'no_piggies_imperative_default' => 'Oszczędzasz pieniądze na coś? Utwórz skarbonkę i śledź:', 'no_piggies_create_default' => 'Utwórz nową skarbonkę', 'no_bills_title_default' => 'Stwórzmy rachunek!', - 'no_bills_intro_default' => 'You have no bills yet. You can create bills to keep track of regular expenses, like your rent of insurance.', + 'no_bills_intro_default' => 'You have no bills yet. You can create bills to keep track of regular expenses, like your rent or insurance.', 'no_bills_imperative_default' => 'Do you have such regular bills? Create a bill and keep track of your payments:', 'no_bills_create_default' => 'Utwórz rachunek', diff --git a/resources/lang/pl_PL/form.php b/resources/lang/pl_PL/form.php index ea7e8bf603..396568faf3 100644 --- a/resources/lang/pl_PL/form.php +++ b/resources/lang/pl_PL/form.php @@ -91,6 +91,7 @@ return [ 'deletePermanently' => 'Usuń trwale', 'cancel' => 'Anuluj', 'targetdate' => 'Data docelowa', + 'startdate' => 'Start date', 'tag' => 'Tag', 'under' => 'Poniżej', 'symbol' => 'Symbol', diff --git a/resources/lang/pl_PL/list.php b/resources/lang/pl_PL/list.php index b1f02b2b66..b32a13c8ba 100644 --- a/resources/lang/pl_PL/list.php +++ b/resources/lang/pl_PL/list.php @@ -17,7 +17,7 @@ return [ 'id' => 'ID', 'create_date' => 'Utworzono', 'update_date' => 'Zaktualizowano', - 'updated_at' => 'Zaktualizowano', + 'updated_at' => 'Zaktualizowano', 'balance_before' => 'Saldo przed', 'balance_after' => 'Saldo po', 'name' => 'Nazwa', @@ -89,4 +89,5 @@ return [ 'sum_withdrawals' => 'Suma wypłat', 'sum_deposits' => 'Suma wpłat', 'sum_transfers' => 'Suma transferów', + 'reconcile' => 'Reconcile', ]; diff --git a/resources/lang/pt_BR/bank.php b/resources/lang/pt_BR/bank.php index 11f05b3785..4becc5984c 100644 --- a/resources/lang/pt_BR/bank.php +++ b/resources/lang/pt_BR/bank.php @@ -1,6 +1,8 @@ 'Prerequisites for an import from bunq', 'bunq_prerequisites_text' => 'In order to import from bunq, you need to obtain an API key. You can do this through the app.', -]; \ No newline at end of file +]; diff --git a/resources/lang/pt_BR/breadcrumbs.php b/resources/lang/pt_BR/breadcrumbs.php index 1a97cb2988..6e9b01528f 100644 --- a/resources/lang/pt_BR/breadcrumbs.php +++ b/resources/lang/pt_BR/breadcrumbs.php @@ -31,10 +31,12 @@ return [ 'deposit_list' => 'Receitas, renda e depósitos', 'transfer_list' => 'Transferências', 'transfers_list' => 'Transferências', + 'reconciliation_list' => 'Reconciliations', 'create_withdrawal' => 'Criar uma nova retirada', 'create_deposit' => 'Criar um novo depósito', 'create_transfer' => 'Criar nova transferência', 'edit_journal' => 'Editar transação ":description"', + 'edit_reconciliation' => 'Edit ":description"', 'delete_journal' => 'Apagar transação ":description"', 'tags' => 'Etiquetas', 'createTag' => 'Criar nova etiqueta', diff --git a/resources/lang/pt_BR/csv.php b/resources/lang/pt_BR/csv.php index 830d7cd73f..961502a938 100644 --- a/resources/lang/pt_BR/csv.php +++ b/resources/lang/pt_BR/csv.php @@ -51,6 +51,8 @@ return [ 'column_account-id' => 'ID da Conta de Ativo (correspondente Firefly)', 'column_account-name' => 'Conta de Ativo (nome)', 'column_amount' => 'Quantia', + 'column_amount_debet' => 'Amount (debet column)', + 'column_amount_credit' => 'Amount (credit column)', 'column_amount-comma-separated' => 'Quantia (vírgula como separador decimal)', 'column_bill-id' => 'ID Fatura (correspondente Firefly)', 'column_bill-name' => 'Nome da Fatura', diff --git a/resources/lang/pt_BR/demo.php b/resources/lang/pt_BR/demo.php index 749f6d09b1..83d5bdac9f 100644 --- a/resources/lang/pt_BR/demo.php +++ b/resources/lang/pt_BR/demo.php @@ -20,7 +20,7 @@ return [ 'currencies-index' => 'Firefly III oferece suporte a várias moedas. Embora o padrão seja o Euro, ela pode ser definida para o dólar americano e muitas outras moedas. Como você pode ver uma pequena seleção de moedas foi incluída, mas você pode adicionar suas próprias se desejar. No entanto, alterar a moeda padrão não vai mudar a moeda de transações existentes: Firefly III suporta o uso de várias moedas ao mesmo tempo.', 'transactions-index' => 'Estas despesas, depósitos e transferências não são fantasiosas. Elas foram geradas automaticamente.', 'piggy-banks-index' => 'Como você pode ver, existem três cofrinhos. Use o sinal de mais e menos botões para influenciar a quantidade de dinheiro em cada cofrinho. Clique no nome do cofrinho para ver a administração de cada cofrinho.', - 'import-index' => 'Claro, qualquer arquivo .CSV pode ser importado em Firefly III ', + 'import-index' => 'Of course, any CSV file can be imported into Firefly III', 'import-configure-security' => 'Por questões de segurança, seu upload foi substituído por um arquivo local.', 'import-configure-configuration' => 'A configuração que você vê abaixo é a correta para o arquivo local.', ]; diff --git a/resources/lang/pt_BR/firefly.php b/resources/lang/pt_BR/firefly.php index 7dffb37a40..a41bc50f7d 100644 --- a/resources/lang/pt_BR/firefly.php +++ b/resources/lang/pt_BR/firefly.php @@ -13,12 +13,14 @@ declare(strict_types=1); return [ // general stuff: + 'language_incomplete' => 'Incomplete translation', 'close' => 'Fechar', 'actions' => 'Ações', 'edit' => 'Editar', 'delete' => 'Apagar', 'welcomeBack' => 'O que está passando?', 'everything' => 'Tudo', + 'today' => 'today', 'customRange' => 'Intervalo Personalizado', 'apply' => 'Aplicar', 'select_date' => 'Selecione a data..', @@ -130,6 +132,7 @@ return [ 'transaction_data' => 'Transaction data', 'invalid_server_configuration' => 'Invalid server configuration', 'invalid_locale_settings' => 'Firefly III is unable to format monetary amounts because your server is missing the required packages. There are instructions how to do this.', + 'quickswitch' => 'Quickswitch', // search 'search' => 'Pesquisa', @@ -147,7 +150,7 @@ return [ 'repeat_freq_half-year' => 'every half-year', 'repeat_freq_quarterly' => 'quarterly', 'repeat_freq_monthly' => 'mensal', - 'repeat_freq_weekly' => 'weekly', + 'repeat_freq_weekly' => 'weekly', 'weekly' => 'semanal', 'quarterly' => 'trimestral', 'half-year' => 'metade de cada ano', @@ -354,6 +357,7 @@ return [ 'without_date' => 'Without date', 'result' => 'Result', 'sums_apply_to_range' => 'All sums apply to the selected range', + 'mapbox_api_key' => 'To use map, get an API key from Mapbox. Open your .env file en enter this code after MAPBOX_API_KEY=.', 'press_tag_location' => 'Right click or long press to set the tag\'s location.', 'clear_location' => 'Clear location', @@ -586,6 +590,8 @@ return [ 'not_expected_period' => 'Não esperado neste período', 'bill_is_active' => 'Bill is active', 'bill_will_automatch' => 'Bill will automatically linked to matching transactions', + 'skips_over' => 'skips over', + // accounts: 'details_for_asset' => 'Detalhes para a conta de ativo ":name"', 'details_for_expense' => 'Detalhes para a conta de despesas ":name"', @@ -614,6 +620,27 @@ return [ 'revenue_accounts' => 'Contas de receitas', 'cash_accounts' => 'Contas Correntes', 'Cash account' => 'Conta Corrente', + 'reconcile_account' => 'Reconcile account ":account"', + 'delete_reconciliation' => 'Delete reconciliation', + 'update_reconciliation' => 'Update reconciliation', + 'amount_cannot_be_zero' => 'The amount cannot be zero', + 'end_of_reconcile_period' => 'End of reconcile period: :period', + 'start_of_reconcile_period' => 'Start of reconcile period: :period', + 'start_balance' => 'Start balance', + 'end_balance' => 'End balance', + 'update_balance_dates_instruction' => 'Match the amounts and dates above to your bank statement, and press "Start reconciling"', + 'select_transactions_instruction' => 'Select the transactions that appear on your bank statement.', + 'select_range_and_balance' => 'First verify the date-range and balances. Then press "Start reconciling"', + 'date_change_instruction' => 'If you change the date range now, any progress will be lost.', + 'update_selection' => 'Update selection', + 'store_reconcile' => 'Store reconciliation', + 'reconciliation_transaction' => 'Reconciliation transaction', + 'Reconciliation' => 'Reconciliation', + 'reconciliation' => 'Reconciliation', + 'reconcile_options' => 'Reconciliation options', + 'reconcile_range' => 'Reconciliation range', + 'start_reconcile' => 'Start reconciling', + 'cash' => 'cash', 'account_type' => 'Tipo de conta', 'save_transactions_by_moving' => 'Salve essas transações, movendo-os para outra conta:', 'stored_new_account' => 'Nova conta ":name" armazenado!', @@ -626,6 +653,22 @@ return [ 'select_more_than_one_budget' => 'Please select more than one budget', 'select_more_than_one_tag' => 'Please select more than one tag', 'account_default_currency' => 'If you select another currency, new transactions from this account will have this currency pre-selected.', + 'reconcile_has_more' => 'Your Firefly III ledger has more money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".', + 'reconcile_has_less' => 'Your Firefly III ledger has less money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".', + 'reconcile_is_equal' => 'Your Firefly III ledger and your bank statements match. There is nothing to do. Please press "Confirm reconciliation" to confirm your input.', + 'create_pos_reconcile_transaction' => 'Clear the selected transactions, and create a correction adding :amount to this asset account.', + 'create_neg_reconcile_transaction' => 'Clear the selected transactions, and create a correction removing :amount from this asset account.', + 'reconcile_do_nothing' => 'Clear the selected transactions, but do not correct.', + 'reconcile_go_back' => 'You can always edit or delete a correction later.', + 'must_be_asset_account' => 'You can only reconcile asset accounts', + 'reconciliation_stored' => 'Reconciliation stored', + 'reconcilliation_transaction_title' => 'Reconciliation (:from to :to)', + 'reconcile_this_account' => 'Reconcile this account', + 'confirm_reconciliation' => 'Confirm reconciliation', + 'submitted_start_balance' => 'Submitted start balance', + 'selected_transactions' => 'Selected transactions (:count)', + 'already_cleared_transactions' => 'Already cleared transactions (:count)', + 'submitted_end_balance' => 'Submitted end balance', // categories: 'new_category' => 'Nova categoria', @@ -659,11 +702,11 @@ return [ 'stored_journal' => 'Transação ":description" excluída com sucesso', 'select_transactions' => 'Selecione as transações', 'stop_selection' => 'Parar de selecionar transações', - 'edit_selected' => 'Editar selecionado', - 'delete_selected' => 'Excluir selecionados', + 'reconcile_selected' => 'Reconcile', 'mass_delete_journals' => 'Excluir um número de transacções', 'mass_edit_journals' => 'Editar um número de transacções', 'cannot_edit_other_fields' => 'Você não pode editar em massa outros campos que não esse aqui, porque não há espaço para mostrá-los. Por favor siga o link e editá-los por um por um, se você precisar editar esses campos.', + 'no_budget' => '(sem orçamento)', 'perm-delete-many' => 'Exclusão de muitos itens de uma só vez pode ser muito perturbador. Por favor, seja cauteloso.', 'mass_deleted_transactions_success' => 'Excluído :amount de transação(ões).', 'mass_edited_transactions_success' => 'Atualizado :amount de transação(ões)', @@ -699,7 +742,9 @@ return [ 'currency' => 'Moeda', 'preferences' => 'Preferências', 'logout' => 'Desconectar', + 'toggleNavigation' => 'Toggle navigation', 'searchPlaceholder' => 'Pesquisar...', + 'version' => 'Version', 'dashboard' => 'Painel de Controle', 'currencies' => 'Moedas', 'accounts' => 'Contas', @@ -839,7 +884,7 @@ return [ 'earned' => 'Ganho', 'overspent' => 'Gasto excedido', 'left' => 'Esquerda', - 'no_budget' => '(sem orçamento)', + 'no_budget' => '(no budget)', 'max-amount' => 'Maximum amount', 'min-amount' => 'Minumum amount', 'journal-amount' => 'Current bill entry', @@ -925,6 +970,7 @@ return [ 'budgets_with_limits' => 'budget(s) com quantidade configurada', 'rule_or_rules' => 'regra(s)', 'rulegroup_or_groups' => 'grupo(s) de regra', + 'tag_or_tags' => 'tag(s)', 'configuration_updated' => 'A configuração foi atualizada', 'setting_is_demo_site' => 'Site demo', 'setting_is_demo_site_explain' => 'If you check this box, this installation will behave as if it is the demo site, which can have weird side effects.', @@ -1000,6 +1046,7 @@ return [ 'split_this_transfer' => 'Dividir essa transferência', 'cannot_edit_multiple_source' => 'Você não pode editar transações parceladas #:id com a descrição ":description" porque ele contém várias contas de origem.', 'cannot_edit_multiple_dest' => 'Você não pode editar transações parceladas #:id com a descrição ":description" porque ele contém várias contas de destino.', + 'cannot_edit_reconciled' => 'You cannot edit transaction #:id with description ":description" because it has been marked as reconciled.', 'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.', 'no_edit_multiple_left' => 'Você não selecionou nenhuma transação válida para editar.', 'cannot_convert_split_journal' => 'Cannot convert a split transaction', @@ -1012,6 +1059,7 @@ return [ 'import_index_title' => 'Import data into Firefly III', 'import_index_sub_title' => 'Index', 'import_general_index_intro' => 'Welcome to Firefly\'s import routine. There are a few ways of importing data into Firefly III, displayed here as buttons.', + 'import_general_index_csv_file' => 'Import a (CSV) file', 'import_index_intro' => 'This routine will help you import files from your bank into Firefly III. Please check out the help pages in the top right corner.', 'import_index_file' => 'Select your file', 'import_index_config' => 'If you have previously imported data into Firefly III, you may have a configuration file, which will pre-set configuration values for you. For some banks, other users have kindly provided their configuration file.', @@ -1095,7 +1143,7 @@ return [ 'no_piggies_imperative_default' => 'Do you have things you\'re saving money for? Create a piggy bank and keep track:', 'no_piggies_create_default' => 'Create a new piggy bank', 'no_bills_title_default' => 'Let\'s create a bill!', - 'no_bills_intro_default' => 'You have no bills yet. You can create bills to keep track of regular expenses, like your rent of insurance.', + 'no_bills_intro_default' => 'You have no bills yet. You can create bills to keep track of regular expenses, like your rent or insurance.', 'no_bills_imperative_default' => 'Do you have such regular bills? Create a bill and keep track of your payments:', 'no_bills_create_default' => 'Create a bill', diff --git a/resources/lang/pt_BR/form.php b/resources/lang/pt_BR/form.php index 255a2d254f..1377664080 100644 --- a/resources/lang/pt_BR/form.php +++ b/resources/lang/pt_BR/form.php @@ -91,6 +91,7 @@ return [ 'deletePermanently' => 'Apagar permanentemente', 'cancel' => 'Cancelar', 'targetdate' => 'Data Alvo', + 'startdate' => 'Start date', 'tag' => 'Etiqueta', 'under' => 'Debaixo', 'symbol' => 'Símbolo', diff --git a/resources/lang/pt_BR/list.php b/resources/lang/pt_BR/list.php index 2033eec94c..6e258cdc09 100644 --- a/resources/lang/pt_BR/list.php +++ b/resources/lang/pt_BR/list.php @@ -17,7 +17,7 @@ return [ 'id' => 'ID', 'create_date' => 'Criado em', 'update_date' => 'Atualizado em', - 'updated_at' => 'Updated at', + 'updated_at' => 'Updated at', 'balance_before' => 'Saldo Antes', 'balance_after' => 'Saldo depois', 'name' => 'Nome', @@ -89,4 +89,5 @@ return [ 'sum_withdrawals' => 'Sum of withdrawals', 'sum_deposits' => 'Sum of deposits', 'sum_transfers' => 'Sum of transfers', + 'reconcile' => 'Reconcile', ]; diff --git a/resources/lang/ru_RU/bank.php b/resources/lang/ru_RU/bank.php index 11f05b3785..27d103f5f9 100644 --- a/resources/lang/ru_RU/bank.php +++ b/resources/lang/ru_RU/bank.php @@ -1,6 +1,8 @@ 'Prerequisites for an import from bunq', - 'bunq_prerequisites_text' => 'In order to import from bunq, you need to obtain an API key. You can do this through the app.', -]; \ No newline at end of file + 'bunq_prerequisites_title' => 'Реквизиты для импорта из bunq', + 'bunq_prerequisites_text' => 'Для импорта из bunq вам необходимо получить API ключ. Вы можете сделать это через приложение.', +]; diff --git a/resources/lang/ru_RU/breadcrumbs.php b/resources/lang/ru_RU/breadcrumbs.php index 7cd631ef0c..6b9d6eaf60 100644 --- a/resources/lang/ru_RU/breadcrumbs.php +++ b/resources/lang/ru_RU/breadcrumbs.php @@ -31,10 +31,12 @@ return [ 'deposit_list' => 'Мои доходы', 'transfer_list' => 'Переводы', 'transfers_list' => 'Переводы', + 'reconciliation_list' => 'Reconciliations', 'create_withdrawal' => 'Создать новый расход', 'create_deposit' => 'Создать новый доход', 'create_transfer' => 'Создать новый перевод', 'edit_journal' => 'Редактирование транзакции ":description"', + 'edit_reconciliation' => 'Edit ":description"', 'delete_journal' => 'Удаление транзакции ":description"', 'tags' => 'Метки', 'createTag' => 'Создать новую метку', diff --git a/resources/lang/ru_RU/csv.php b/resources/lang/ru_RU/csv.php index 1b3c320594..f81770ec63 100644 --- a/resources/lang/ru_RU/csv.php +++ b/resources/lang/ru_RU/csv.php @@ -51,6 +51,8 @@ return [ 'column_account-id' => 'Asset account ID (matching Firefly)', 'column_account-name' => 'Asset account (name)', 'column_amount' => 'Amount', + 'column_amount_debet' => 'Amount (debet column)', + 'column_amount_credit' => 'Amount (credit column)', 'column_amount-comma-separated' => 'Amount (comma as decimal separator)', 'column_bill-id' => 'Bill ID (matching Firefly)', 'column_bill-name' => 'Bill name', diff --git a/resources/lang/ru_RU/demo.php b/resources/lang/ru_RU/demo.php index 57e9277cdb..babdfb5310 100644 --- a/resources/lang/ru_RU/demo.php +++ b/resources/lang/ru_RU/demo.php @@ -20,7 +20,7 @@ return [ 'currencies-index' => 'Firefly III supports multiple currencies. Although it defaults to the Euro it can be set to the US Dollar and many other currencies. As you can see a small selection of currencies has been included but you can add your own if you wish to. Changing the default currency will not change the currency of existing transactions however: Firefly III supports the use of multiple currencies at the same time.', 'transactions-index' => 'These expenses, deposits and transfers are not particularly imaginative. They have been generated automatically.', 'piggy-banks-index' => 'As you can see, there are three piggy banks. Use the plus and minus buttons to influence the amount of money in each piggy bank. Click the name of the piggy bank to see the administration for each piggy bank.', - 'import-index' => 'Of course, any CSV file can be imported into Firefly III ', - 'import-configure-security' => 'Because of security concerns, your upload has been replaced with a local file.', + 'import-index' => 'Of course, any CSV file can be imported into Firefly III', + 'import-configure-security' => 'По соображениям безопасности, загружаемый вами файл был заменен локальным.', 'import-configure-configuration' => 'The configuration you see below is correct for the local file.', ]; diff --git a/resources/lang/ru_RU/firefly.php b/resources/lang/ru_RU/firefly.php index 7dcf9afe4d..e56bd79980 100644 --- a/resources/lang/ru_RU/firefly.php +++ b/resources/lang/ru_RU/firefly.php @@ -13,12 +13,14 @@ declare(strict_types=1); return [ // general stuff: + 'language_incomplete' => 'Incomplete translation', 'close' => 'Закрыть', 'actions' => 'Действия', 'edit' => 'Изменить', 'delete' => 'Удалить', 'welcomeBack' => 'Что происходит с моими финансами?', 'everything' => 'Всё', + 'today' => 'today', 'customRange' => 'Другой интервал', 'apply' => 'Применить', 'select_date' => 'Выбрать дату...', @@ -130,6 +132,7 @@ return [ 'transaction_data' => 'Данные транзакции', 'invalid_server_configuration' => 'Invalid server configuration', 'invalid_locale_settings' => 'Firefly III is unable to format monetary amounts because your server is missing the required packages. There are instructions how to do this.', + 'quickswitch' => 'Quickswitch', // search 'search' => 'Поиск', @@ -147,7 +150,7 @@ return [ 'repeat_freq_half-year' => 'every half-year', 'repeat_freq_quarterly' => 'quarterly', 'repeat_freq_monthly' => 'ежемесячно', - 'repeat_freq_weekly' => 'weekly', + 'repeat_freq_weekly' => 'weekly', 'weekly' => 'еженедельно', 'quarterly' => 'раз в квартал', 'half-year' => 'раз в полгода', @@ -354,6 +357,7 @@ return [ 'without_date' => 'Without date', 'result' => 'Result', 'sums_apply_to_range' => 'All sums apply to the selected range', + 'mapbox_api_key' => 'To use map, get an API key from Mapbox. Open your .env file en enter this code after MAPBOX_API_KEY=.', 'press_tag_location' => 'Right click or long press to set the tag\'s location.', 'clear_location' => 'Clear location', @@ -586,6 +590,8 @@ return [ 'not_expected_period' => 'Not expected this period', 'bill_is_active' => 'Bill is active', 'bill_will_automatch' => 'Bill will automatically linked to matching transactions', + 'skips_over' => 'skips over', + // accounts: 'details_for_asset' => 'Details for asset account ":name"', 'details_for_expense' => 'Details for expense account ":name"', @@ -614,6 +620,27 @@ return [ 'revenue_accounts' => 'Revenue accounts', 'cash_accounts' => 'Cash accounts', 'Cash account' => 'Cash account', + 'reconcile_account' => 'Reconcile account ":account"', + 'delete_reconciliation' => 'Delete reconciliation', + 'update_reconciliation' => 'Update reconciliation', + 'amount_cannot_be_zero' => 'The amount cannot be zero', + 'end_of_reconcile_period' => 'End of reconcile period: :period', + 'start_of_reconcile_period' => 'Start of reconcile period: :period', + 'start_balance' => 'Start balance', + 'end_balance' => 'End balance', + 'update_balance_dates_instruction' => 'Match the amounts and dates above to your bank statement, and press "Start reconciling"', + 'select_transactions_instruction' => 'Select the transactions that appear on your bank statement.', + 'select_range_and_balance' => 'First verify the date-range and balances. Then press "Start reconciling"', + 'date_change_instruction' => 'If you change the date range now, any progress will be lost.', + 'update_selection' => 'Update selection', + 'store_reconcile' => 'Store reconciliation', + 'reconciliation_transaction' => 'Reconciliation transaction', + 'Reconciliation' => 'Reconciliation', + 'reconciliation' => 'Reconciliation', + 'reconcile_options' => 'Reconciliation options', + 'reconcile_range' => 'Reconciliation range', + 'start_reconcile' => 'Start reconciling', + 'cash' => 'cash', 'account_type' => 'Account type', 'save_transactions_by_moving' => 'Save these transaction(s) by moving them to another account:', 'stored_new_account' => 'New account ":name" stored!', @@ -626,6 +653,22 @@ return [ 'select_more_than_one_budget' => 'Please select more than one budget', 'select_more_than_one_tag' => 'Please select more than one tag', 'account_default_currency' => 'If you select another currency, new transactions from this account will have this currency pre-selected.', + 'reconcile_has_more' => 'Your Firefly III ledger has more money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".', + 'reconcile_has_less' => 'Your Firefly III ledger has less money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".', + 'reconcile_is_equal' => 'Your Firefly III ledger and your bank statements match. There is nothing to do. Please press "Confirm reconciliation" to confirm your input.', + 'create_pos_reconcile_transaction' => 'Clear the selected transactions, and create a correction adding :amount to this asset account.', + 'create_neg_reconcile_transaction' => 'Clear the selected transactions, and create a correction removing :amount from this asset account.', + 'reconcile_do_nothing' => 'Clear the selected transactions, but do not correct.', + 'reconcile_go_back' => 'You can always edit or delete a correction later.', + 'must_be_asset_account' => 'You can only reconcile asset accounts', + 'reconciliation_stored' => 'Reconciliation stored', + 'reconcilliation_transaction_title' => 'Reconciliation (:from to :to)', + 'reconcile_this_account' => 'Reconcile this account', + 'confirm_reconciliation' => 'Confirm reconciliation', + 'submitted_start_balance' => 'Submitted start balance', + 'selected_transactions' => 'Selected transactions (:count)', + 'already_cleared_transactions' => 'Already cleared transactions (:count)', + 'submitted_end_balance' => 'Submitted end balance', // categories: 'new_category' => 'Новая категория', @@ -659,11 +702,11 @@ return [ 'stored_journal' => 'Successfully created new transaction ":description"', 'select_transactions' => 'Выбрать транзакции', 'stop_selection' => 'Завершить выбор транзакций', - 'edit_selected' => 'Edit selected', - 'delete_selected' => 'Delete selected', + 'reconcile_selected' => 'Reconcile', 'mass_delete_journals' => 'Delete a number of transactions', 'mass_edit_journals' => 'Edit a number of transactions', 'cannot_edit_other_fields' => 'You cannot mass-edit other fields than the ones here, because there is no room to show them. Please follow the link and edit them by one-by-one, if you need to edit these fields.', + 'no_budget' => '(no budget)', 'perm-delete-many' => 'Deleting many items in one go can be very disruptive. Please be cautious.', 'mass_deleted_transactions_success' => 'Deleted :amount transaction(s).', 'mass_edited_transactions_success' => 'Updated :amount transaction(s)', @@ -699,7 +742,9 @@ return [ 'currency' => 'Валюта', 'preferences' => 'Настройки', 'logout' => 'Выход', + 'toggleNavigation' => 'Toggle navigation', 'searchPlaceholder' => 'Поиск...', + 'version' => 'Version', 'dashboard' => 'Сводка', 'currencies' => 'Валюты', 'accounts' => 'Счета', @@ -925,6 +970,7 @@ return [ 'budgets_with_limits' => 'budget(s) with configured amount', 'rule_or_rules' => 'rule(s)', 'rulegroup_or_groups' => 'rule group(s)', + 'tag_or_tags' => 'tag(s)', 'configuration_updated' => 'The configuration has been updated', 'setting_is_demo_site' => 'Demo site', 'setting_is_demo_site_explain' => 'If you check this box, this installation will behave as if it is the demo site, which can have weird side effects.', @@ -1000,6 +1046,7 @@ return [ 'split_this_transfer' => 'Split this transfer', 'cannot_edit_multiple_source' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple source accounts.', 'cannot_edit_multiple_dest' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple destination accounts.', + 'cannot_edit_reconciled' => 'You cannot edit transaction #:id with description ":description" because it has been marked as reconciled.', 'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.', 'no_edit_multiple_left' => 'You have selected no valid transactions to edit.', 'cannot_convert_split_journal' => 'Cannot convert a split transaction', @@ -1012,6 +1059,7 @@ return [ 'import_index_title' => 'Импорт данных в Firefly III', 'import_index_sub_title' => 'Index', 'import_general_index_intro' => 'Welcome to Firefly\'s import routine. There are a few ways of importing data into Firefly III, displayed here as buttons.', + 'import_general_index_csv_file' => 'Import a (CSV) file', 'import_index_intro' => 'This routine will help you import files from your bank into Firefly III. Please check out the help pages in the top right corner.', 'import_index_file' => 'Select your file', 'import_index_config' => 'If you have previously imported data into Firefly III, you may have a configuration file, which will pre-set configuration values for you. For some banks, other users have kindly provided their configuration file.', @@ -1095,7 +1143,7 @@ return [ 'no_piggies_imperative_default' => 'Do you have things you\'re saving money for? Create a piggy bank and keep track:', 'no_piggies_create_default' => 'Create a new piggy bank', 'no_bills_title_default' => 'Let\'s create a bill!', - 'no_bills_intro_default' => 'You have no bills yet. You can create bills to keep track of regular expenses, like your rent of insurance.', + 'no_bills_intro_default' => 'You have no bills yet. You can create bills to keep track of regular expenses, like your rent or insurance.', 'no_bills_imperative_default' => 'Do you have such regular bills? Create a bill and keep track of your payments:', 'no_bills_create_default' => 'Create a bill', diff --git a/resources/lang/ru_RU/form.php b/resources/lang/ru_RU/form.php index b4832f0cf6..c5fd8619f3 100644 --- a/resources/lang/ru_RU/form.php +++ b/resources/lang/ru_RU/form.php @@ -91,6 +91,7 @@ return [ 'deletePermanently' => 'Delete permanently', 'cancel' => 'Отмена', 'targetdate' => 'Намеченная дата', + 'startdate' => 'Start date', 'tag' => 'Тег', 'under' => 'Under', 'symbol' => 'Символ', diff --git a/resources/lang/ru_RU/list.php b/resources/lang/ru_RU/list.php index f1ce3395d5..a0a1d8cd6e 100644 --- a/resources/lang/ru_RU/list.php +++ b/resources/lang/ru_RU/list.php @@ -17,7 +17,7 @@ return [ 'id' => 'ID', 'create_date' => 'Создан', 'update_date' => 'Обновлён', - 'updated_at' => 'Updated at', + 'updated_at' => 'Updated at', 'balance_before' => 'Баланс до', 'balance_after' => 'Баланс после', 'name' => 'Имя', @@ -89,4 +89,5 @@ return [ 'sum_withdrawals' => 'Sum of withdrawals', 'sum_deposits' => 'Sum of deposits', 'sum_transfers' => 'Sum of transfers', + 'reconcile' => 'Reconcile', ]; diff --git a/resources/lang/ru_RU/validation.php b/resources/lang/ru_RU/validation.php index 8273315994..a4ef9fd56b 100644 --- a/resources/lang/ru_RU/validation.php +++ b/resources/lang/ru_RU/validation.php @@ -22,49 +22,49 @@ return [ 'file_invalid_mime' => 'Файл ":name" имеет тип ":mime". Загрузка файлов такого типа невозможна.', 'file_too_large' => 'Файл ":name" слишком большой.', 'belongs_to_user' => 'Значение :attribute неизвестно', - 'accepted' => 'The :attribute must be accepted.', - 'bic' => 'This is not a valid BIC.', - 'more' => ':attribute must be larger than zero.', - 'active_url' => 'The :attribute is not a valid URL.', - 'after' => 'The :attribute must be a date after :date.', - 'alpha' => 'The :attribute may only contain letters.', - 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', - 'alpha_num' => 'The :attribute may only contain letters and numbers.', - 'array' => 'The :attribute must be an array.', - 'unique_for_user' => 'There already is an entry with this :attribute.', - 'before' => 'The :attribute must be a date before :date.', - 'unique_object_for_user' => 'This name is already in use', - 'unique_account_for_user' => 'This account name is already in use', - 'between.numeric' => 'The :attribute must be between :min and :max.', - 'between.file' => 'The :attribute must be between :min and :max kilobytes.', - 'between.string' => 'The :attribute must be between :min and :max characters.', - 'between.array' => 'The :attribute must have between :min and :max items.', - 'boolean' => 'The :attribute field must be true or false.', - 'confirmed' => 'The :attribute confirmation does not match.', - 'date' => 'The :attribute is not a valid date.', - 'date_format' => 'The :attribute does not match the format :format.', - 'different' => 'The :attribute and :other must be different.', - 'digits' => 'The :attribute must be :digits digits.', - 'digits_between' => 'The :attribute must be between :min and :max digits.', - 'email' => 'The :attribute must be a valid email address.', - 'filled' => 'The :attribute field is required.', - 'exists' => 'The selected :attribute is invalid.', - 'image' => 'The :attribute must be an image.', - 'in' => 'The selected :attribute is invalid.', - 'integer' => 'The :attribute must be an integer.', - 'ip' => 'The :attribute must be a valid IP address.', - 'json' => 'The :attribute must be a valid JSON string.', + 'accepted' => 'Необходимо принять :attribute.', + 'bic' => 'Это некорректный BIC.', + 'more' => ':attribute должен быть больше нуля.', + 'active_url' => ':attribute не является допустимым URL-адресом.', + 'after' => ':attribute должна быть позже :date.', + 'alpha' => ':attribute может содержать только буквы.', + 'alpha_dash' => ':attribute может содержать только буквы, числа и дефис.', + 'alpha_num' => ':attribute может содержать только буквы и числа.', + 'array' => ':attribute должен быть массивом.', + 'unique_for_user' => 'Уже существует запись с этим :attribute.', + 'before' => ':attribute должна быть раньше :date.', + 'unique_object_for_user' => 'Это имя уже используется', + 'unique_account_for_user' => 'Имя аккаунта уже используется', + 'between.numeric' => ':attribute должен быть больше :min и меньше :max.', + 'between.file' => ':attribute должен быть размером :min - :max килобайт.', + 'between.string' => ':attribute должен содержать :min - :max символов.', + 'between.array' => ':attribute должен содержать :min - :max элементов.', + 'boolean' => 'Поле :attribute должно быть истинным или ложным.', + 'confirmed' => ':attribute не совпадает с подтверждением.', + 'date' => ':attribute не является верной датой.', + 'date_format' => ':attribute не совпадает с форматом :format.', + 'different' => ':attribute и :other не должны совпадать.', + 'digits' => ':attribute должно содержать :digits цифр.', + 'digits_between' => ':attribute должен содержать :min - :max цифр.', + 'email' => ':attribute не является верным email адресом.', + 'filled' => 'Поле :attribute должно быть заполнено.', + 'exists' => 'Выбран неверный :attribute.', + 'image' => ':attribute должен быть изображением.', + 'in' => 'Выбранный :attribute не верный.', + 'integer' => ':attribute должно быть целым числом.', + 'ip' => ':attribute должен быть верным IP-адресом.', + 'json' => ':attribute должно быть верной JSON строкой.', 'max.numeric' => 'The :attribute may not be greater than :max.', 'max.file' => 'The :attribute may not be greater than :max kilobytes.', 'max.string' => 'The :attribute may not be greater than :max characters.', 'max.array' => 'The :attribute may not have more than :max items.', 'mimes' => 'The :attribute must be a file of type: :values.', - 'min.numeric' => 'The :attribute must be at least :min.', - 'min.file' => 'The :attribute must be at least :min kilobytes.', + 'min.numeric' => ':attribute должен быть минимум :min.', + 'min.file' => ':attribute должен быть минимум :min килобайт.', 'min.string' => 'The :attribute must be at least :min characters.', 'min.array' => 'The :attribute must have at least :min items.', - 'not_in' => 'The selected :attribute is invalid.', - 'numeric' => 'The :attribute must be a number.', + 'not_in' => 'Выбранный :attribute не верный.', + 'numeric' => ':attribute должен быть числом.', 'regex' => 'The :attribute format is invalid.', 'required' => 'The :attribute field is required.', 'required_if' => 'The :attribute field is required when :other is :value.', @@ -72,22 +72,22 @@ return [ 'required_with' => 'The :attribute field is required when :values is present.', 'required_with_all' => 'The :attribute field is required when :values is present.', 'required_without' => 'The :attribute field is required when :values is not present.', - 'required_without_all' => 'The :attribute field is required when none of :values are present.', - 'same' => 'The :attribute and :other must match.', - 'size.numeric' => 'The :attribute must be :size.', - 'size.file' => 'The :attribute must be :size kilobytes.', - 'size.string' => 'The :attribute must be :size characters.', - 'size.array' => 'The :attribute must contain :size items.', - 'unique' => 'The :attribute has already been taken.', - 'string' => 'The :attribute must be a string.', - 'url' => 'The :attribute format is invalid.', - 'timezone' => 'The :attribute must be a valid zone.', - '2fa_code' => 'The :attribute field is invalid.', - 'dimensions' => 'The :attribute has invalid image dimensions.', - 'distinct' => 'The :attribute field has a duplicate value.', - 'file' => 'The :attribute must be a file.', - 'in_array' => 'The :attribute field does not exist in :other.', - 'present' => 'The :attribute field must be present.', - 'amount_zero' => 'The total amount cannot be zero', - 'secure_password' => 'This is not a secure password. Please try again. For more information, visit https://goo.gl/NCh2tN', + 'required_without_all' => ':attribute поле обязательно для заполнения, так как ни одно из :values не существует.', + 'same' => ':attribute и :other должны совпадать.', + 'size.numeric' => ':attribute должен быть размером :size.', + 'size.file' => ':attribute должен быть размером :size килобайт.', + 'size.string' => ':attribute должен состоять из :size символов.', + 'size.array' => ':attribute должен содержать :size элементов.', + 'unique' => ':attribute уже занят.', + 'string' => 'Значение :attribute должно быть строкой.', + 'url' => 'Неверный формат ввода :attribute.', + 'timezone' => ':attribute должен быть в допустимом диапазоне.', + '2fa_code' => ':attribute введен неверно.', + 'dimensions' => 'Недопустимые размеры изображения :attribute.', + 'distinct' => 'Поле :attribute содержит повторяющееся значение.', + 'file' => ':attribute должен быть файлом.', + 'in_array' => 'Поле :attribute не существует в :other.', + 'present' => 'Поле :attribute должно быть заполнено.', + 'amount_zero' => 'Общее количество не может быть равно нулю', + 'secure_password' => 'Это не безопасный пароль. Попробуйте еще раз. Для получения справки посетите https://goo.gl/NCh2tN', ]; diff --git a/resources/lang/sl_SI/bank.php b/resources/lang/sl_SI/bank.php index 964f43f024..fd0521b288 100644 --- a/resources/lang/sl_SI/bank.php +++ b/resources/lang/sl_SI/bank.php @@ -1,6 +1,8 @@ 'Predpogoji za uvoz iz bunq', 'bunq_prerequisites_text' => 'Če želite uvoziti iz bunq-a, morate pridobiti ključ za API. To lahko storite s pomočjo aplikacije.', -]; \ No newline at end of file +]; diff --git a/resources/lang/sl_SI/breadcrumbs.php b/resources/lang/sl_SI/breadcrumbs.php index 04b738b939..c221d3df3f 100644 --- a/resources/lang/sl_SI/breadcrumbs.php +++ b/resources/lang/sl_SI/breadcrumbs.php @@ -31,10 +31,12 @@ return [ 'deposit_list' => 'prihodki', 'transfer_list' => 'prenosi', 'transfers_list' => 'prenosi', + 'reconciliation_list' => 'Poravnave', 'create_withdrawal' => 'ustvari nov odhodek', 'create_deposit' => 'ustvari nov prihodek', 'create_transfer' => 'ustvari nov prenos', 'edit_journal' => 'uredi transakcijo ":description"', + 'edit_reconciliation' => 'Uredi ":description"', 'delete_journal' => 'izbriši transakcijo ":description"', 'tags' => 'značke', 'createTag' => 'ustvari novo značko', diff --git a/resources/lang/sl_SI/csv.php b/resources/lang/sl_SI/csv.php index 216c4886ae..e9a21edc07 100644 --- a/resources/lang/sl_SI/csv.php +++ b/resources/lang/sl_SI/csv.php @@ -51,6 +51,8 @@ return [ 'column_account-id' => 'ID premoženjskega računa (Firefly)', 'column_account-name' => 'premoženjski račun (ime)', 'column_amount' => 'znesek', + 'column_amount_debet' => 'Znesek v breme', + 'column_amount_credit' => 'Znesek v dobro', 'column_amount-comma-separated' => 'znesek (z decimalno vejico)', 'column_bill-id' => 'ID trajnika (Firefly)', 'column_bill-name' => 'Ime trajnika', diff --git a/resources/lang/sl_SI/demo.php b/resources/lang/sl_SI/demo.php index dca94a9aa7..a3df49a192 100644 --- a/resources/lang/sl_SI/demo.php +++ b/resources/lang/sl_SI/demo.php @@ -21,7 +21,7 @@ Konti prihodkov so računi iz katerih dobivate denar, kot npr. vaš delodajalec, 'currencies-index' => 'Firefly III supports multiple currencies. Although it defaults to the Euro it can be set to the US Dollar and many other currencies. As you can see a small selection of currencies has been included but you can add your own if you wish to. Changing the default currency will not change the currency of existing transactions however: Firefly III supports the use of multiple currencies at the same time.', 'transactions-index' => 'These expenses, deposits and transfers are not particularly imaginative. They have been generated automatically.', 'piggy-banks-index' => 'As you can see, there are three piggy banks. Use the plus and minus buttons to influence the amount of money in each piggy bank. Click the name of the piggy bank to see the administration for each piggy bank.', - 'import-index' => 'Of course, any CSV file can be imported into Firefly III ', + 'import-index' => 'Of course, any CSV file can be imported into Firefly III', 'import-configure-security' => 'Because of security concerns, your upload has been replaced with a local file.', 'import-configure-configuration' => 'The configuration you see below is correct for the local file.', ]; diff --git a/resources/lang/sl_SI/firefly.php b/resources/lang/sl_SI/firefly.php index 22124ba713..b171129468 100644 --- a/resources/lang/sl_SI/firefly.php +++ b/resources/lang/sl_SI/firefly.php @@ -13,12 +13,14 @@ declare(strict_types=1); return [ // general stuff: + 'language_incomplete' => 'nepopoln prevod', 'close' => 'zapri', 'actions' => 'Dejanja', 'edit' => 'uredi', 'delete' => 'izbriši', 'welcomeBack' => 'Kaj dogaja?', 'everything' => 'vse', + 'today' => 'danes', 'customRange' => 'obseg po meri', 'apply' => 'uporabi', 'select_date' => 'Izberi datum..', @@ -82,11 +84,11 @@ return [ 'expenses_by_expense_account' => 'stroški po stroškovnih kontih', 'cannot_redirect_to_account' => 'Firefly III cannot redirect you to the correct page. Apologies.', 'sum_of_expenses' => 'vsota stroškov', - 'sum_of_income' => 'Sum of income', + 'sum_of_income' => 'Vsota dohodkov', 'spent_in_specific_budget' => 'Spent in budget ":budget"', 'sum_of_expenses_in_budget' => 'Spent total in budget ":budget"', 'left_in_budget_limit' => 'Left to spend according to budgeting', - 'current_period' => 'Current period', + 'current_period' => 'Tekoče obdobje', 'show_the_current_period_and_overview' => 'Show the current period and overview', 'pref_languages_locale' => 'For a language other than English to work properly, your operating system must be equipped with the correct locale-information. If these are not present, currency data, dates and amounts may be formatted wrong.', 'budget_in_period' => 'All transactions for budget ":name" between :start and :end', @@ -94,30 +96,30 @@ return [ 'chart_account_in_period' => 'Chart for all transactions for account ":name" between :start and :end', 'chart_category_in_period' => 'Chart for all transactions for category ":name" between :start and :end', 'chart_category_all' => 'Chart for all transactions for category ":name"', - 'clone_withdrawal' => 'Clone this withdrawal', - 'clone_deposit' => 'Clone this deposit', - 'clone_transfer' => 'Clone this transfer', - 'multi_select_no_selection' => 'None selected', - 'multi_select_all_selected' => 'All selected', - 'multi_select_filter_placeholder' => 'Find..', - 'between_dates_breadcrumb' => 'Between :start and :end', - 'all_journals_without_budget' => 'All transactions without a budget', - 'journals_without_budget' => 'Transactions without a budget', - 'all_journals_without_category' => 'All transactions without a category', - 'journals_without_category' => 'Transactions without a category', - 'all_journals_for_account' => 'All transactions for account :name', - 'chart_all_journals_for_account' => 'Chart of all transactions for account :name', - 'journals_in_period_for_account' => 'All transactions for account :name between :start and :end', - 'transferred' => 'Transferred', + 'clone_withdrawal' => 'Kloniraj ta odhodek', + 'clone_deposit' => 'Kloniraj ta prihodek', + 'clone_transfer' => 'Kloniraj ta prenos', + 'multi_select_no_selection' => 'Nič ni izbrano', + 'multi_select_all_selected' => 'Vse je izbrano', + 'multi_select_filter_placeholder' => 'Najdi..', + 'between_dates_breadcrumb' => 'Med :start in :end', + 'all_journals_without_budget' => 'Vse transakcije brez budžeta', + 'journals_without_budget' => 'Transakcije brez budžeta', + 'all_journals_without_category' => 'Vse transakcije brez kategorije', + 'journals_without_category' => 'Transakcije brez kategorije', + 'all_journals_for_account' => 'Vse transakcije za konto :ime', + 'chart_all_journals_for_account' => 'Graf vseh transakcij za konto :name', + 'journals_in_period_for_account' => 'stroški na kontu ":name" med :start in :end', + 'transferred' => 'Prenešeno', 'all_withdrawal' => 'vsi stroški', - 'all_transactions' => 'All transactions', + 'all_transactions' => 'Vse transakcije', 'title_withdrawal_between' => 'vsi stroški med :start in :end', - 'all_deposit' => 'All revenue', - 'title_deposit_between' => 'All revenue between :start and :end', - 'all_transfers' => 'All transfers', - 'title_transfers_between' => 'All transfers between :start and :end', - 'all_transfer' => 'All transfers', - 'all_journals_for_tag' => 'All transactions for tag ":tag"', + 'all_deposit' => 'Vsi prihodki', + 'title_deposit_between' => 'Vsi prihodki med :start in :end', + 'all_transfers' => 'Vsi prenosi', + 'title_transfers_between' => 'vsi prenosi med :start in :end', + 'all_transfer' => 'Vsi prenosi', + 'all_journals_for_tag' => 'Vse transakcije za značko ":tag"', 'title_transfer_between' => 'All transfers between :start and :end', 'all_journals_for_category' => 'All transactions for category :name', 'all_journals_for_budget' => 'All transactions for budget :name', @@ -130,6 +132,7 @@ return [ 'transaction_data' => 'Transaction data', 'invalid_server_configuration' => 'Invalid server configuration', 'invalid_locale_settings' => 'Firefly III is unable to format monetary amounts because your server is missing the required packages. There are instructions how to do this.', + 'quickswitch' => 'Quickswitch', // search 'search' => 'Search', @@ -147,7 +150,7 @@ return [ 'repeat_freq_half-year' => 'every half-year', 'repeat_freq_quarterly' => 'quarterly', 'repeat_freq_monthly' => 'monthly', - 'repeat_freq_weekly' => 'weekly', + 'repeat_freq_weekly' => 'weekly', 'weekly' => 'weekly', 'quarterly' => 'quarterly', 'half-year' => 'every half year', @@ -354,6 +357,7 @@ return [ 'without_date' => 'Without date', 'result' => 'Result', 'sums_apply_to_range' => 'All sums apply to the selected range', + 'mapbox_api_key' => 'To use map, get an API key from Mapbox. Open your .env file en enter this code after MAPBOX_API_KEY=.', 'press_tag_location' => 'Right click or long press to set the tag\'s location.', 'clear_location' => 'Clear location', @@ -586,6 +590,8 @@ return [ 'not_expected_period' => 'Not expected this period', 'bill_is_active' => 'Bill is active', 'bill_will_automatch' => 'Bill will automatically linked to matching transactions', + 'skips_over' => 'skips over', + // accounts: 'details_for_asset' => 'podrobnosti za premoženjski račun ":name"', 'details_for_expense' => 'podrobnosti stroškovnega konta ":name"', @@ -614,6 +620,27 @@ return [ 'revenue_accounts' => 'Revenue accounts', 'cash_accounts' => 'Cash accounts', 'Cash account' => 'Cash account', + 'reconcile_account' => 'Reconcile account ":account"', + 'delete_reconciliation' => 'Delete reconciliation', + 'update_reconciliation' => 'Update reconciliation', + 'amount_cannot_be_zero' => 'The amount cannot be zero', + 'end_of_reconcile_period' => 'End of reconcile period: :period', + 'start_of_reconcile_period' => 'Start of reconcile period: :period', + 'start_balance' => 'Start balance', + 'end_balance' => 'End balance', + 'update_balance_dates_instruction' => 'Match the amounts and dates above to your bank statement, and press "Start reconciling"', + 'select_transactions_instruction' => 'Select the transactions that appear on your bank statement.', + 'select_range_and_balance' => 'First verify the date-range and balances. Then press "Start reconciling"', + 'date_change_instruction' => 'If you change the date range now, any progress will be lost.', + 'update_selection' => 'Update selection', + 'store_reconcile' => 'Store reconciliation', + 'reconciliation_transaction' => 'Reconciliation transaction', + 'Reconciliation' => 'Reconciliation', + 'reconciliation' => 'Reconciliation', + 'reconcile_options' => 'Reconciliation options', + 'reconcile_range' => 'Reconciliation range', + 'start_reconcile' => 'Start reconciling', + 'cash' => 'cash', 'account_type' => 'Account type', 'save_transactions_by_moving' => 'Save these transaction(s) by moving them to another account:', 'stored_new_account' => 'New account ":name" stored!', @@ -626,6 +653,22 @@ return [ 'select_more_than_one_budget' => 'Please select more than one budget', 'select_more_than_one_tag' => 'Please select more than one tag', 'account_default_currency' => 'If you select another currency, new transactions from this account will have this currency pre-selected.', + 'reconcile_has_more' => 'Your Firefly III ledger has more money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".', + 'reconcile_has_less' => 'Your Firefly III ledger has less money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".', + 'reconcile_is_equal' => 'Your Firefly III ledger and your bank statements match. There is nothing to do. Please press "Confirm reconciliation" to confirm your input.', + 'create_pos_reconcile_transaction' => 'Clear the selected transactions, and create a correction adding :amount to this asset account.', + 'create_neg_reconcile_transaction' => 'Clear the selected transactions, and create a correction removing :amount from this asset account.', + 'reconcile_do_nothing' => 'Clear the selected transactions, but do not correct.', + 'reconcile_go_back' => 'You can always edit or delete a correction later.', + 'must_be_asset_account' => 'You can only reconcile asset accounts', + 'reconciliation_stored' => 'Reconciliation stored', + 'reconcilliation_transaction_title' => 'Reconciliation (:from to :to)', + 'reconcile_this_account' => 'Reconcile this account', + 'confirm_reconciliation' => 'Confirm reconciliation', + 'submitted_start_balance' => 'Submitted start balance', + 'selected_transactions' => 'Selected transactions (:count)', + 'already_cleared_transactions' => 'Already cleared transactions (:count)', + 'submitted_end_balance' => 'Submitted end balance', // categories: 'new_category' => 'New category', @@ -659,11 +702,11 @@ return [ 'stored_journal' => 'Successfully created new transaction ":description"', 'select_transactions' => 'Select transactions', 'stop_selection' => 'Stop selecting transactions', - 'edit_selected' => 'Edit selected', - 'delete_selected' => 'Delete selected', + 'reconcile_selected' => 'Reconcile', 'mass_delete_journals' => 'Delete a number of transactions', 'mass_edit_journals' => 'Edit a number of transactions', 'cannot_edit_other_fields' => 'You cannot mass-edit other fields than the ones here, because there is no room to show them. Please follow the link and edit them by one-by-one, if you need to edit these fields.', + 'no_budget' => '(no budget)', 'perm-delete-many' => 'Deleting many items in one go can be very disruptive. Please be cautious.', 'mass_deleted_transactions_success' => 'Deleted :amount transaction(s).', 'mass_edited_transactions_success' => 'Updated :amount transaction(s)', @@ -699,7 +742,9 @@ return [ 'currency' => 'Currency', 'preferences' => 'Preferences', 'logout' => 'Logout', + 'toggleNavigation' => 'Toggle navigation', 'searchPlaceholder' => 'Search...', + 'version' => 'Version', 'dashboard' => 'Dashboard', 'currencies' => 'Currencies', 'accounts' => 'Accounts', @@ -925,6 +970,7 @@ return [ 'budgets_with_limits' => 'budget(s) with configured amount', 'rule_or_rules' => 'rule(s)', 'rulegroup_or_groups' => 'rule group(s)', + 'tag_or_tags' => 'tag(s)', 'configuration_updated' => 'The configuration has been updated', 'setting_is_demo_site' => 'Demo site', 'setting_is_demo_site_explain' => 'If you check this box, this installation will behave as if it is the demo site, which can have weird side effects.', @@ -1000,6 +1046,7 @@ return [ 'split_this_transfer' => 'Split this transfer', 'cannot_edit_multiple_source' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple source accounts.', 'cannot_edit_multiple_dest' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple destination accounts.', + 'cannot_edit_reconciled' => 'You cannot edit transaction #:id with description ":description" because it has been marked as reconciled.', 'cannot_edit_opening_balance' => 'You cannot edit the opening balance of an account.', 'no_edit_multiple_left' => 'You have selected no valid transactions to edit.', 'cannot_convert_split_journal' => 'Cannot convert a split transaction', @@ -1012,6 +1059,7 @@ return [ 'import_index_title' => 'Import data into Firefly III', 'import_index_sub_title' => 'Index', 'import_general_index_intro' => 'Welcome to Firefly\'s import routine. There are a few ways of importing data into Firefly III, displayed here as buttons.', + 'import_general_index_csv_file' => 'Import a (CSV) file', 'import_index_intro' => 'This routine will help you import files from your bank into Firefly III. Please check out the help pages in the top right corner.', 'import_index_file' => 'Select your file', 'import_index_config' => 'If you have previously imported data into Firefly III, you may have a configuration file, which will pre-set configuration values for you. For some banks, other users have kindly provided their configuration file.', @@ -1095,7 +1143,7 @@ return [ 'no_piggies_imperative_default' => 'Do you have things you\'re saving money for? Create a piggy bank and keep track:', 'no_piggies_create_default' => 'Create a new piggy bank', 'no_bills_title_default' => 'Let\'s create a bill!', - 'no_bills_intro_default' => 'You have no bills yet. You can create bills to keep track of regular expenses, like your rent of insurance.', + 'no_bills_intro_default' => 'You have no bills yet. You can create bills to keep track of regular expenses, like your rent or insurance.', 'no_bills_imperative_default' => 'Do you have such regular bills? Create a bill and keep track of your payments:', 'no_bills_create_default' => 'Create a bill', diff --git a/resources/lang/sl_SI/form.php b/resources/lang/sl_SI/form.php index 178718ace6..69ec14c2f2 100644 --- a/resources/lang/sl_SI/form.php +++ b/resources/lang/sl_SI/form.php @@ -91,6 +91,7 @@ return [ 'deletePermanently' => 'Delete permanently', 'cancel' => 'Cancel', 'targetdate' => 'Target date', + 'startdate' => 'Start date', 'tag' => 'Tag', 'under' => 'Under', 'symbol' => 'Symbol', diff --git a/resources/lang/sl_SI/list.php b/resources/lang/sl_SI/list.php index 6aa58450e2..15f7b08998 100644 --- a/resources/lang/sl_SI/list.php +++ b/resources/lang/sl_SI/list.php @@ -17,7 +17,7 @@ return [ 'id' => 'ID', 'create_date' => 'Ustvarjeno', 'update_date' => 'Posodobljeno', - 'updated_at' => 'Posodobljeno', + 'updated_at' => 'Posodobljeno', 'balance_before' => 'Stanje prej', 'balance_after' => 'Stanje potem', 'name' => 'ime', @@ -89,4 +89,5 @@ return [ 'sum_withdrawals' => 'Vsota odlivov', 'sum_deposits' => 'Vsota prilivov', 'sum_transfers' => 'Vsota prenosov', + 'reconcile' => 'Poravnaj', ]; diff --git a/resources/stubs/binary.bin b/resources/stubs/binary.bin new file mode 100644 index 0000000000..25602c8fbc Binary files /dev/null and b/resources/stubs/binary.bin differ diff --git a/resources/views/accounts/reconcile/edit.twig b/resources/views/accounts/reconcile/edit.twig new file mode 100644 index 0000000000..dff6c8c6dc --- /dev/null +++ b/resources/views/accounts/reconcile/edit.twig @@ -0,0 +1,115 @@ +{% extends "./layout/default" %} + +{% block breadcrumbs %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, journal) }} +{% endblock %} + +{% block content %} +

+ + + + + {% if errors.all|length > 0 %} +
+
+

{{ 'errors'|_ }}

+
    + {% for err in errors.all %} +
  • {{ err }}
  • + {% endfor %} +
+
+
+ {% endif %} + + +
+
+
+
+

{{ 'mandatoryFields'|_ }}

+
+
+ {# ALWAYS AVAILABLE #} + {{ ExpandedForm.staticText('description',journal.description) }} + + {# ALWAYS SHOW AMOUNT #} + {{ ExpandedForm.nonSelectableAmount('amount',data.amount, {'currency' : data.currency}) }} + + {# ALWAYS SHOW DATE #} + {{ ExpandedForm.staticText('date',journal.date.formatLocalized(monthAndDayFormat)) }} +
+
+ +
+
+
+
+

{{ 'optionalFields'|_ }}

+
+
+ + {{ ExpandedForm.text('category',data['category']) }} + + + {{ ExpandedForm.text('tags') }} +
+
+ + + {% if optionalFields.attachments %} +
+
+

{{ 'optional_field_attachments'|_ }}

+
+
+ {% if optionalFields.attachments %} + + {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }} + {% endif %} +
+
+ {% endif %} + + +
+
+

{{ 'options'|_ }}

+
+
+ {{ ExpandedForm.optionsList('update','transaction') }} +
+ +
+
+
+ +
+ + +{% endblock %} +{% block scripts %} + + + + + + + + + +{% endblock %} +{% block styles %} + + + +{% endblock %} diff --git a/resources/views/accounts/reconcile/index.twig b/resources/views/accounts/reconcile/index.twig new file mode 100644 index 0000000000..70b82ee4b2 --- /dev/null +++ b/resources/views/accounts/reconcile/index.twig @@ -0,0 +1,139 @@ +{% extends "./layout/default" %} + +{% block breadcrumbs %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, account, moment, start, end) }} +{% endblock %} + +{% block content %} + +
+
+
+
+

{{ 'reconcile_range'|_ }}

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{ 'start_balance'|_ }}{{ 'end_balance'|_ }}
+ {{ 'date'|_ }} + + {{ 'balance'|_ }} + + {{ 'date'|_ }} + + {{ 'balance'|_ }} +
+
+
+ +
+ +
+
+
+ {{ currency.symbol }} + +
+
+
+
+ +
+ +
+
+
+ {{ currency.symbol }} + +
+
+
+ {{ 'update_balance_dates_instruction'|_ }} +
+ + +
+ {{ 'start_reconcile'|_ }} + +
+
+
+
+
+
+
+

{{ 'reconcile_options'|_ }}

+
+
+

+ +
+ +
+
+
+
+ +
+ +
+
+
+
+

{{ 'transactions'|_ }}

+
+
+
+

{{ 'select_range_and_balance'|_ }}

+
+
+
+
+
+ + + +{% endblock %} + +{% block scripts %} + + +{% endblock %} diff --git a/resources/views/accounts/reconcile/overview.twig b/resources/views/accounts/reconcile/overview.twig new file mode 100644 index 0000000000..abc2fe9af3 --- /dev/null +++ b/resources/views/accounts/reconcile/overview.twig @@ -0,0 +1,102 @@ + + diff --git a/resources/views/accounts/reconcile/show.twig b/resources/views/accounts/reconcile/show.twig new file mode 100644 index 0000000000..0dab366f46 --- /dev/null +++ b/resources/views/accounts/reconcile/show.twig @@ -0,0 +1,107 @@ +{% extends "./layout/default" %} + +{% block breadcrumbs %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, journal) }} +{% endblock %} + +{% block content %} +
+
+
+
+

{{ 'transaction_journal_information'|_ }}

+ + + +
+
+ + + + + + + + + + + {# total amount #} + + + + + + + + + +
{{ trans('list.type') }}{{ journal.transactiontype.type|_ }}
{{ trans('list.description') }}{{ journal.description }}
{{ 'total_amount'|_ }} + {{ formatAmountByAccount(transaction.account, transaction.amount) }} + +
{{ trans('list.date') }}{{ journal.date.formatLocalized(monthAndDayFormat) }}
+
+ +
+
+
+ +
+
+

{{ 'transaction_journal_meta'|_ }}

+
+
+ + + + + + + {% if journal.tags|length > 0 %} + + + + + {% endif %} + +
{{ 'categories'|_ }}{{ journalCategories(journal)|raw }}
{{ 'tags'|_ }} + {% for tag in journal.tags %} + +

+ {% if tag.tagMode == 'nothing' %} + + {% endif %} + {% if tag.tagMode == 'balancingAct' %} + + {% endif %} + {% if tag.tagMode == 'advancePayment' %} + + {% endif %} + {{ tag.tag }} +

+ {% endfor %} +
+
+
+
+
+ +{% endblock %} +{% block scripts %} +{% endblock %} diff --git a/resources/views/accounts/reconcile/transactions.twig b/resources/views/accounts/reconcile/transactions.twig new file mode 100644 index 0000000000..fb1ddbf4eb --- /dev/null +++ b/resources/views/accounts/reconcile/transactions.twig @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + {# data for previous/next markers #} + {% set endSet = false %} + {% set startSet = false %} + {% for transaction in transactions %} + {# start marker #} + {% if transaction.date < start and startSet == false %} + + + + + + {% set startSet = true %} + {% endif %} + + {# end marker #} + {% if transaction.date <= end and endSet == false %} + + + + + + {% set endSet = true %} + {% endif %} + + + + {# icon #} + + + {# description #} + + + + + + + + + + {% endfor %} + + {# if the start marker has not been generated yet, do it now, at the end of the loop. #} + {% if startSet == false %} + + + + + + {% set startSet = true %} + {% endif %} + +
{{ trans('list.description') }}{{ trans('list.amount') }}
+   + + + {{ trans('firefly.start_of_reconcile_period', {period: start.formatLocalized(monthAndDayFormat) }) }} + + +   +
+   + + + {{ trans('firefly.end_of_reconcile_period', {period: end.formatLocalized(monthAndDayFormat) }) }} + + +   +
+ + {{ transaction|transactionDescription }} + + {# is a split journal #} + {{ transaction|transactionIsSplit }} + + {# count attachments #} + {{ transaction|transactionHasAtt }} + + + {{ transaction|transactionAmount }} + {% if transaction.reconciled %} + {{ transaction|transactionReconciled }} + + {% else %} + + {% endif %} +
+   + + + {{ trans('firefly.start_of_reconcile_period', {period: start.formatLocalized(monthAndDayFormat) }) }} + + +   +
\ No newline at end of file diff --git a/resources/views/accounts/show.twig b/resources/views/accounts/show.twig index 43c219fc54..194d232703 100644 --- a/resources/views/accounts/show.twig +++ b/resources/views/accounts/show.twig @@ -85,7 +85,7 @@

{{ 'transactions'|_ }}

- {% include 'list.journals' with {sorting:true, hideBills:true, hideBudgets: true, hideCategories: true} %} + {% include 'list.journals' with {sorting:true, hideBills:true, hideBudgets: true, hideCategories: true, showReconcile: true} %} {% if periods.count > 0 %}

diff --git a/resources/views/admin/link/show.twig b/resources/views/admin/link/show.twig index bf71cb1f5a..9515d56588 100644 --- a/resources/views/admin/link/show.twig +++ b/resources/views/admin/link/show.twig @@ -34,13 +34,14 @@ {{ link.source.description }} - {{ journalAmount(link.source) }} + {{ link.source|journalTotalAmount }} {{ linkType.outward }} {{ link.destination.description }} - {{ journalAmount(link.destination) }} + {{ link.destination|journalTotalAmount }} + {% endfor %} diff --git a/resources/views/admin/users/show.twig b/resources/views/admin/users/show.twig index 2922ed89ff..b627f4c2f0 100644 --- a/resources/views/admin/users/show.twig +++ b/resources/views/admin/users/show.twig @@ -32,9 +32,9 @@ {{ trans('list.is_admin') }} {% if information.is_admin %} - Yes + {{ 'yes'|_ }} {% else %} - No + {{ 'no'|_ }} {% endif %} @@ -42,9 +42,9 @@ {{ trans('list.has_two_factor') }} {% if information.has_2fa %} - Yes + {{ 'yes'|_ }} {% else %} - No + {{ 'no'|_ }} {% endif %} @@ -52,7 +52,7 @@ {{ trans('list.is_blocked') }} {% if information.blocked %} - Yes: + {{ 'yes'|_ }}: {% if information.blocked_code == "" %} ~ @@ -61,7 +61,7 @@ {% endif %} {% else %} - No + {{ 'no'|_ }} {% endif %} @@ -122,7 +122,7 @@ {{ trans('list.tags_count') }} - {{ information.tags }} tags + {{ information.tags }} {{ 'tag_or_tags'|_ }} diff --git a/resources/views/bills/create.twig b/resources/views/bills/create.twig index 5ee65cf3c8..3f2701cbcd 100644 --- a/resources/views/bills/create.twig +++ b/resources/views/bills/create.twig @@ -6,7 +6,7 @@ {% block content %} -

+
@@ -32,9 +32,12 @@

{{ 'optionalFields'|_ }}

+ {{ ExpandedForm.textarea('notes',null,{helpText: trans('firefly.field_supports_markdown')}) }} + {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }} {{ ExpandedForm.integer('skip',0) }} {{ ExpandedForm.checkbox('automatch',1,true) }} {{ ExpandedForm.checkbox('active',1,true) }} +
diff --git a/resources/views/bills/edit.twig b/resources/views/bills/edit.twig index ee48b4375b..e2983cd929 100644 --- a/resources/views/bills/edit.twig +++ b/resources/views/bills/edit.twig @@ -6,7 +6,7 @@ {% block content %} - {{ Form.model(bill, {'class' : 'form-horizontal','id' : 'update','url' : route('bills.update', bill.id)}) }} + {{ Form.model(bill, {'class' : 'form-horizontal','enctype': 'multipart/form-data','id' : 'update','url' : route('bills.update', bill.id)}) }} @@ -34,6 +34,8 @@

{{ 'optionalFields'|_ }}

+ {{ ExpandedForm.textarea('notes',null,{helpText: trans('firefly.field_supports_markdown')}) }} + {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }} {{ ExpandedForm.integer('skip') }} {{ ExpandedForm.checkbox('automatch',1) }} {{ ExpandedForm.checkbox('active',1) }} diff --git a/resources/views/bills/index.twig b/resources/views/bills/index.twig index ef136db47f..0870429463 100644 --- a/resources/views/bills/index.twig +++ b/resources/views/bills/index.twig @@ -19,7 +19,7 @@
@@ -39,4 +39,4 @@ {% block scripts %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/resources/views/bills/show.twig b/resources/views/bills/show.twig index d233a6de8c..24846d11c4 100644 --- a/resources/views/bills/show.twig +++ b/resources/views/bills/show.twig @@ -24,7 +24,7 @@
- +
{% if budgetInformation[budget.id]['currentLimit'] %} - {% set repAmount = budgetInformation[budget.id]['currentLimit'].amount %} + {% set repAmount = budgetInformation[budget.id]['budgeted'] %} {% else %} {% set repAmount = '0' %} {% endif %} @@ -174,8 +174,8 @@
{{ defaultCurrency.symbol|raw }}
+ data-id="{{ budget.id }}" value="{{ repAmount }}" autocomplete="off" + min="0" name="amount" type="number">
{{ 'matching_on'|_ }} @@ -84,12 +84,60 @@

{{ 'more'|_ }}

-
-

- {{ 'rescan_old'|_ }} -

+
+ {% if bill.notes.count == 1 %} + + + + + +
{{ trans('list.notes') }}{{ bill.notes.first.text|markdown }}
+ {% endif %} +
+ +
+ {% if bill.attachments|length > 0 %} +
+
+

{{ 'attachments'|_ }}

+
+
+ + {% for att in bill.attachments %} + + + + + + {% endfor %} +
+
+ + +
+
+ + + {% if att.title %} + {{ att.title }} + {% else %} + {{ att.filename }} + {% endif %} + + ({{ att.size|filesize }}) + {% if att.description %} +
+ {{ att.description }} + {% endif %} +
+ +
+
+
+ {% endif %} diff --git a/resources/views/budgets/index.twig b/resources/views/budgets/index.twig index 71ba5fd301..6c071bd65a 100644 --- a/resources/views/budgets/index.twig +++ b/resources/views/budgets/index.twig @@ -164,7 +164,7 @@ {% endif %}