From d16015d6257a57b34b41581fe1eacb7e165e2dc9 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 6 Feb 2015 04:27:37 +0100 Subject: [PATCH] Moved all old code for Laravel 5. --- app/breadcrumbs.php | 369 ---- app/commands/.gitkeep | 0 app/commands/Cleanup.php | 76 - app/config/.gitignore | 4 - app/config/app.php | 91 - app/config/auth.php | 16 - app/config/cache.php | 12 - app/config/compile.php | 3 - app/config/database.php | 31 - app/config/dev.php | 4 - app/config/firefly.php | 49 - app/config/homestead/app.php | 15 - app/config/homestead/cache.php | 12 - app/config/homestead/database.php | 37 - app/config/homestead/mail.php | 13 - app/config/mail.php | 13 - app/config/packages/.gitkeep | 0 .../barryvdh/laravel-debugbar/config.php | 127 -- .../barryvdh/laravel-ide-helper/config.php | 76 - .../laravel-breadcrumbs/config.php | 5 - app/config/queue.php | 45 - app/config/remote.php | 21 - app/config/services.php | 19 - app/config/session.php | 16 - app/config/testing/app.php | 2 - app/config/testing/auth.php | 8 - app/config/testing/cache.php | 3 - app/config/testing/database.php | 12 - app/config/testing/mail.php | 13 - app/config/testing/session.php | 3 - app/config/testingInMemory/app.php | 2 - app/config/testingInMemory/auth.php | 8 - app/config/testingInMemory/cache.php | 3 - app/config/testingInMemory/database.php | 12 - app/config/testingInMemory/mail.php | 13 - app/config/testingInMemory/session.php | 3 - app/config/view.php | 6 - app/config/workbench.php | 6 - app/controllers/.gitkeep | 0 app/controllers/AccountController.php | 233 --- app/controllers/BaseController.php | 30 - app/controllers/BillController.php | 215 --- app/controllers/BudgetController.php | 254 --- app/controllers/CategoryController.php | 189 -- app/controllers/CurrencyController.php | 199 -- app/controllers/GoogleChartController.php | 537 ------ app/controllers/HelpController.php | 84 - app/controllers/HomeController.php | 101 - app/controllers/JsonController.php | 65 - app/controllers/PiggybankController.php | 360 ---- app/controllers/PreferencesController.php | 75 - app/controllers/ProfileController.php | 85 - app/controllers/RelatedController.php | 148 -- app/controllers/ReminderController.php | 93 - app/controllers/RepeatedExpenseController.php | 227 --- app/controllers/ReportController.php | 136 -- app/controllers/SearchController.php | 38 - app/controllers/TransactionController.php | 328 ---- app/controllers/UserController.php | 176 -- app/database/migrations/.gitkeep | 0 .../2014_06_27_163032_create_users_table.php | 44 - ...6_27_163145_create_account_types_table.php | 44 - ...014_06_27_163259_create_accounts_table.php | 54 - ...4_06_27_163817_create_components_table.php | 51 - ...4_06_27_163818_create_piggybanks_table.php | 60 - ...42_create_transaction_currencies_table.php | 45 - ..._164512_create_transaction_types_table.php | 45 - ...19_create_recurring_transactions_table.php | 59 - ...4620_create_transaction_journals_table.php | 62 - ...06_27_164836_create_transactions_table.php | 60 - ...344_create_component_transaction_table.php | 50 - ...te_component_transaction_journal_table.php | 50 - ..._07_06_123842_create_preferences_table.php | 49 - ...2014_07_09_204843_create_session_table.php | 41 - .../2014_07_17_183717_create_limits_table.php | 51 - ...07_19_055011_create_limit_repeat_table.php | 49 - ..._component_recurring_transaction_table.php | 52 - ...919_create_piggybank_repetitions_table.php | 49 - ...8_100330_create_piggybank_events_table.php | 51 - ...14_08_23_113221_create_reminders_table.php | 50 - ...11_10_172053_create_account_meta_table.php | 49 - ...135749_create_transaction_groups_table.php | 48 - ...action_group_transaction_journal_table.php | 49 - .../2014_12_13_190730_changes_for_v321.php | 497 ----- .../2014_12_24_191544_changes_for_v322.php | 172 -- .../2015_01_18_082406_changes_for_v325.php | 62 - app/database/seeds/.gitkeep | 0 app/database/seeds/AccountTypeSeeder.php | 24 - app/database/seeds/DatabaseSeeder.php | 27 - app/database/seeds/TestDataSeeder.php | 609 ------ .../seeds/TransactionCurrencySeeder.php | 18 - app/database/seeds/TransactionTypeSeeder.php | 20 - app/filters.php | 104 - app/lang/en/pagination.php | 20 - app/lang/en/reminders.php | 24 - app/lang/en/validation.php | 105 -- app/lib/FireflyIII/Chart/Chart.php | 76 - app/lib/FireflyIII/Chart/ChartInterface.php | 31 - .../FireflyIII/Collection/PiggybankPart.php | 179 -- .../FireflyIII/Database/Account/Account.php | 534 ------ .../Database/Account/AccountInterface.php | 48 - .../Database/AccountType/AccountType.php | 143 -- app/lib/FireflyIII/Database/Bill/Bill.php | 356 ---- .../Database/Bill/BillInterface.php | 43 - app/lib/FireflyIII/Database/Budget/Budget.php | 339 ---- .../Database/Budget/BudgetInterface.php | 40 - app/lib/FireflyIII/Database/CUDInterface.php | 48 - .../FireflyIII/Database/Category/Category.php | 224 --- .../Database/CommonDatabaseCallsInterface.php | 47 - .../Database/PiggyBank/PiggyBank.php | 58 - .../Database/PiggyBank/PiggyBankShared.php | 186 -- .../Database/PiggyBank/PiggybankInterface.php | 19 - .../Database/PiggyBank/RepeatedExpense.php | 124 -- app/lib/FireflyIII/Database/SwitchUser.php | 27 - .../Database/Transaction/Transaction.php | 156 -- .../TransactionCurrency.php | 154 -- .../TransactionCurrencyInterface.php | 20 - .../TransactionJournal/TransactionJournal.php | 612 ------ .../TransactionJournalInterface.php | 36 - .../TransactionType/TransactionType.php | 148 -- app/lib/FireflyIII/Database/User/User.php | 73 - app/lib/FireflyIII/Event/Account.php | 53 - app/lib/FireflyIII/Event/Budget.php | 67 - app/lib/FireflyIII/Event/Event.php | 45 - app/lib/FireflyIII/Event/Piggybank.php | 293 --- app/lib/FireflyIII/Event/Transaction.php | 55 - .../FireflyIII/Event/TransactionJournal.php | 57 - .../FireflyIII/Exception/FireflyException.php | 14 - .../Exception/NotImplementedException.php | 13 - .../Exception/ValidationException.php | 12 - app/lib/FireflyIII/FF3ServiceProvider.php | 134 -- app/lib/FireflyIII/Form/Form.php | 290 --- app/lib/FireflyIII/Helper/Related/Related.php | 88 - .../Helper/Related/RelatedInterface.php | 29 - .../Helper/TransactionJournal/Helper.php | 96 - .../TransactionJournal/HelperInterface.php | 45 - app/lib/FireflyIII/Report/Report.php | 382 ---- app/lib/FireflyIII/Report/ReportHelper.php | 142 -- .../Report/ReportHelperInterface.php | 64 - app/lib/FireflyIII/Report/ReportInterface.php | 108 -- app/lib/FireflyIII/Report/ReportQuery.php | 540 ------ .../Report/ReportQueryInterface.php | 154 -- app/lib/FireflyIII/Search/Search.php | 109 -- app/lib/FireflyIII/Shared/Facade/Amount.php | 24 - app/lib/FireflyIII/Shared/Facade/DateKit.php | 24 - app/lib/FireflyIII/Shared/Facade/FFForm.php | 24 - app/lib/FireflyIII/Shared/Facade/Filter.php | 24 - .../FireflyIII/Shared/Facade/Navigation.php | 24 - .../FireflyIII/Shared/Facade/Reminders.php | 24 - app/lib/FireflyIII/Shared/Facade/Steam.php | 24 - .../FireflyIII/Shared/Mail/Registration.php | 110 -- .../Shared/Mail/RegistrationInterface.php | 34 - .../Shared/Preferences/Preferences.php | 54 - .../Preferences/PreferencesInterface.php | 29 - app/lib/FireflyIII/Shared/Toolkit/Amount.php | 165 -- app/lib/FireflyIII/Shared/Toolkit/Date.php | 258 --- app/lib/FireflyIII/Shared/Toolkit/Filter.php | 253 --- app/lib/FireflyIII/Shared/Toolkit/Form.php | 47 - .../FireflyIII/Shared/Toolkit/Navigation.php | 69 - .../FireflyIII/Shared/Toolkit/Reminders.php | 106 -- app/lib/FireflyIII/Shared/Toolkit/Steam.php | 85 - .../Shared/Validation/FireflyValidator.php | 31 - .../Validation/ValidationServiceProvider.php | 27 - app/models/Account.php | 156 -- app/models/AccountMeta.php | 51 - app/models/AccountType.php | 25 - app/models/Bill.php | 49 - app/models/Budget.php | 50 - app/models/BudgetLimit.php | 49 - app/models/Category.php | 49 - app/models/Component.php | 20 - app/models/LimitRepetition.php | 54 - app/models/Piggybank.php | 127 -- app/models/PiggybankEvent.php | 42 - app/models/PiggybankRepetition.php | 54 - app/models/Preference.php | 41 - app/models/Reminder.php | 58 - app/models/Transaction.php | 114 -- app/models/TransactionCurrency.php | 29 - app/models/TransactionGroup.php | 45 - app/models/TransactionJournal.php | 267 --- app/models/TransactionRelation.php | 10 - app/models/TransactionType.php | 22 - app/models/User.php | 102 - app/routes.php | 408 ---- app/start/artisan.php | 14 - app/start/global.php | 131 -- app/start/local.php | 3 - app/storage/.gitignore | 1 - app/storage/cache/.gitignore | 2 - app/storage/debugbar/.gitignore | 2 - app/storage/logs/.gitignore | 2 - app/storage/meta/.gitignore | 2 - app/storage/sessions/.gitignore | 2 - app/storage/views/.gitignore | 2 - app/tests/TestCase.php | 55 - app/tests/factories/Account.php | 10 - app/tests/factories/AccountMeta.php | 9 - app/tests/factories/AccountType.php | 8 - app/tests/factories/Budget.php | 8 - app/tests/factories/PiggyBank.php | 38 - app/tests/factories/PiggyBankRepetition.php | 13 - app/tests/factories/Preference.php | 9 - app/tests/factories/Reminder.php | 13 - app/tests/factories/Transaction.php | 12 - app/tests/factories/TransactionCurrency.php | 30 - app/tests/factories/TransactionGroup.php | 8 - app/tests/factories/TransactionJournal.php | 12 - app/tests/factories/TransactionType.php | 7 - app/tests/factories/User.php | 7 - app/views/accounts/create.blade.php | 55 - app/views/accounts/delete.blade.php | 33 - app/views/accounts/edit.blade.php | 51 - app/views/accounts/index.blade.php | 43 - app/views/accounts/show.blade.php | 77 - app/views/bills/create.blade.php | 64 - app/views/bills/delete.blade.php | 37 - app/views/bills/edit.blade.php | 62 - app/views/bills/index.blade.php | 32 - app/views/bills/show.blade.php | 116 -- app/views/budgets/create.blade.php | 42 - app/views/budgets/delete.blade.php | 37 - app/views/budgets/edit.blade.php | 42 - app/views/budgets/income.blade.php | 21 - app/views/budgets/index.blade.php | 154 -- app/views/budgets/noBudget.blade.php | 24 - app/views/budgets/show.blade.php | 91 - app/views/categories/create.blade.php | 41 - app/views/categories/delete.blade.php | 37 - app/views/categories/edit.blade.php | 38 - app/views/categories/index.blade.php | 39 - app/views/categories/noCategory.blade.php | 24 - app/views/categories/show.blade.php | 42 - app/views/currency/create.blade.php | 40 - app/views/currency/delete.blade.php | 25 - app/views/currency/edit.blade.php | 40 - app/views/currency/index.blade.php | 53 - app/views/emails/user/register-html.blade.php | 19 - app/views/emails/user/register-text.blade.php | 5 - app/views/emails/user/verify-html.blade.php | 19 - app/views/emails/user/verify-text.blade.php | 7 - app/views/error.blade.php | 16 - app/views/form/amount.blade.php | 20 - app/views/form/balance.blade.php | 20 - app/views/form/checkbox.blade.php | 11 - app/views/form/date.blade.php | 7 - app/views/form/feedback.blade.php | 12 - app/views/form/integer.blade.php | 9 - app/views/form/options.blade.php | 69 - app/views/form/select.blade.php | 8 - app/views/form/tags.blade.php | 7 - app/views/form/text.blade.php | 7 - app/views/help/show.blade.php | 14 - app/views/index.blade.php | 129 -- app/views/layouts/default.blade.php | 115 -- app/views/layouts/guest.blade.php | 46 - app/views/list/accounts.blade.php | 38 - app/views/list/bills.blade.php | 71 - app/views/list/categories.blade.php | 33 - app/views/list/journals-full.blade.php | 120 -- app/views/list/journals-small.blade.php | 44 - app/views/list/journals-tiny.blade.php | 35 - app/views/list/piggy-bank-events.blade.php | 33 - app/views/partials/date_nav.blade.php | 28 - app/views/partials/flashes.blade.php | 27 - app/views/partials/menu.blade.php | 190 -- app/views/piggy_banks/add.blade.php | 24 - app/views/piggy_banks/create.blade.php | 94 - app/views/piggy_banks/delete.blade.php | 37 - app/views/piggy_banks/edit.blade.php | 94 - app/views/piggy_banks/index.blade.php | 132 -- app/views/piggy_banks/remove.blade.php | 24 - app/views/piggy_banks/show.blade.php | 125 -- app/views/preferences/index.blade.php | 105 -- app/views/profile/change-password.blade.php | 44 - app/views/profile/index.blade.php | 18 - app/views/related/relate.blade.php | 27 - app/views/reminders/show.blade.php | 32 - app/views/repeatedExpense/create.blade.php | 97 - app/views/repeatedExpense/delete.blade.php | 37 - app/views/repeatedExpense/edit.blade.php | 97 - app/views/repeatedExpense/index.blade.php | 69 - app/views/repeatedExpense/show.blade.php | 61 - app/views/reports/budget.blade.php | 156 -- app/views/reports/index.blade.php | 50 - app/views/reports/month.blade.php | 231 --- app/views/reports/year.blade.php | 170 -- app/views/search/index.blade.php | 106 -- app/views/transactions/create.blade.php | 96 - app/views/transactions/delete.blade.php | 43 - app/views/transactions/edit.blade.php | 96 - app/views/transactions/index.blade.php | 16 - app/views/transactions/show.blade.php | 131 -- app/views/user/login.blade.php | 39 - app/views/user/register.blade.php | 33 - app/views/user/registered.blade.php | 19 - app/views/user/remindMe-html.blade.php | 19 - app/views/user/remindMe-text.blade.php | 5 - app/views/user/remindMe.blade.php | 27 - app/views/user/verification-pending.blade.php | 19 - build/logs/.gitignore | 1 - composer.json | 50 +- provider/assets/javascripts/jquery.min.js | 6 - provider/assets/stylesheets/readme.txt | 1 - public/.htaccess | 15 - public/android-chrome-144x144.png | Bin 3316 -> 0 bytes public/android-chrome-192x192.png | Bin 4465 -> 0 bytes public/android-chrome-36x36.png | Bin 904 -> 0 bytes public/android-chrome-48x48.png | Bin 1159 -> 0 bytes public/android-chrome-72x72.png | Bin 1693 -> 0 bytes public/android-chrome-96x96.png | Bin 2209 -> 0 bytes public/android-chrome-manifest.json | 41 - public/apple-touch-icon-114x114.png | Bin 2595 -> 0 bytes public/apple-touch-icon-120x120.png | Bin 2711 -> 0 bytes public/apple-touch-icon-144x144.png | Bin 3316 -> 0 bytes public/apple-touch-icon-152x152.png | Bin 3500 -> 0 bytes public/apple-touch-icon-180x180.png | Bin 4130 -> 0 bytes public/apple-touch-icon-57x57.png | Bin 1351 -> 0 bytes public/apple-touch-icon-60x60.png | Bin 1442 -> 0 bytes public/apple-touch-icon-72x72.png | Bin 1693 -> 0 bytes public/apple-touch-icon-76x76.png | Bin 1786 -> 0 bytes public/apple-touch-icon-precomposed.png | Bin 4130 -> 0 bytes public/apple-touch-icon.png | Bin 4130 -> 0 bytes public/assets/images/error.png | Bin 666 -> 0 bytes .../javascript/bootstrap/bootstrap.min.js | 6 - public/assets/javascript/firefly/accounts.js | 7 - public/assets/javascript/firefly/bills.js | 7 - public/assets/javascript/firefly/budgets.js | 153 -- .../assets/javascript/firefly/categories.js | 9 - public/assets/javascript/firefly/firefly.js | 24 - public/assets/javascript/firefly/gcharts.js | 91 - .../javascript/firefly/gcharts.options.js | 137 -- public/assets/javascript/firefly/help.js | 24 - public/assets/javascript/firefly/index.js | 9 - .../assets/javascript/firefly/piggy_banks.js | 22 - .../javascript/firefly/related-manager.js | 107 -- public/assets/javascript/firefly/reminders.js | 50 - public/assets/javascript/firefly/reports.js | 9 - .../assets/javascript/firefly/transactions.js | 21 - .../javascript/jquery/jquery-2.1.1.min.js | 4 - .../javascript/jquery/jquery-2.1.1.min.map | 1 - .../metisMenu/jquery.metisMenu.min.js | 9 - .../assets/javascript/sb-admin/sb-admin-2.js | 28 - .../tagsinput/bootstrap-tagsinput.min.js | 7 - .../typeahead/bootstrap3-typeahead.min.js | 1 - .../stylesheets/bootstrap/bootstrap.min.css | 7 - .../stylesheets/fa/css/font-awesome.css | 1672 ----------------- .../stylesheets/fa/css/font-awesome.min.css | 4 - .../stylesheets/fa/fonts/FontAwesome.otf | Bin 85908 -> 0 bytes .../fa/fonts/fontawesome-webfont.eot | Bin 56006 -> 0 bytes .../fa/fonts/fontawesome-webfont.svg | 520 ----- .../fa/fonts/fontawesome-webfont.ttf | Bin 112160 -> 0 bytes .../fa/fonts/fontawesome-webfont.woff | Bin 65452 -> 0 bytes .../fonts/glyphicons-halflings-regular.eot | Bin 20335 -> 0 bytes .../fonts/glyphicons-halflings-regular.svg | 229 --- .../fonts/glyphicons-halflings-regular.ttf | Bin 41280 -> 0 bytes .../fonts/glyphicons-halflings-regular.woff | Bin 23320 -> 0 bytes .../stylesheets/metisMenu/metisMenu.min.css | 10 - public/assets/stylesheets/sbadmin/sb.css | 352 ---- .../tagsinput/bootstrap-tagsinput.css | 47 - public/browserconfig.xml | 12 - public/favicon-16x16.png | Bin 501 -> 0 bytes public/favicon-32x32.png | Bin 815 -> 0 bytes public/favicon-96x96.png | Bin 2209 -> 0 bytes public/favicon.ico | Bin 15086 -> 0 bytes public/index.php | 59 - public/mstile-144x144.png | Bin 3485 -> 0 bytes public/mstile-150x150.png | Bin 3412 -> 0 bytes public/mstile-310x150.png | Bin 3674 -> 0 bytes public/mstile-310x310.png | Bin 7457 -> 0 bytes public/mstile-70x70.png | Bin 2393 -> 0 bytes public/packages/.gitkeep | 0 .../laravel-debugbar/laravel-debugbar.css | 33 - .../laravel-debugbar/laravel-icon.png | Bin 594 -> 0 bytes .../maximebf/php-debugbar/debugbar.css | 225 --- .../maximebf/php-debugbar/debugbar.js | 1080 ----------- .../packages/maximebf/php-debugbar/icons.png | Bin 500 -> 0 bytes .../maximebf/php-debugbar/openhandler.css | 60 - .../maximebf/php-debugbar/openhandler.js | 191 -- .../maximebf/php-debugbar/php-icon.png | Bin 3621 -> 0 bytes .../font-awesome/css/font-awesome.min.css | 4 - .../vendor/font-awesome/fonts/FontAwesome.otf | Bin 62856 -> 0 bytes .../fonts/fontawesome-webfont.eot | Bin 38205 -> 0 bytes .../fonts/fontawesome-webfont.svg | 414 ---- .../fonts/fontawesome-webfont.ttf | Bin 80652 -> 0 bytes .../fonts/fontawesome-webfont.woff | Bin 44432 -> 0 bytes .../vendor/highlightjs/highlight.pack.js | 1 - .../vendor/highlightjs/styles/github.css | 125 -- .../vendor/jquery/dist/jquery.min.js | 5 - .../maximebf/php-debugbar/widgets.css | 186 -- .../packages/maximebf/php-debugbar/widgets.js | 430 ----- .../php-debugbar/widgets/mails/widget.css | 12 - .../php-debugbar/widgets/mails/widget.js | 40 - .../widgets/sqlqueries/widget.css | 82 - .../php-debugbar/widgets/sqlqueries/widget.js | 94 - .../php-debugbar/widgets/templates/widget.css | 23 - .../php-debugbar/widgets/templates/widget.js | 38 - public/robots.txt | 2 - tests/_bootstrap.php | 9 - tests/_data/db.sh | 5 - tests/_support/AcceptanceHelper.php | 10 - tests/_support/FunctionalHelper.php | 9 - tests/_support/UnitHelper.php | 10 - tests/acceptance.suite.yml | 10 - tests/acceptance/_bootstrap.php | 2 - tests/functional.suite.yml | 20 - tests/functional/AccountControllerCest.php | 215 --- tests/functional/BillControllerCest.php | 276 --- tests/functional/BudgetControllerCest.php | 252 --- tests/functional/CategoryControllerCest.php | 201 -- tests/functional/CurrencyControllerCest.php | 202 -- .../functional/GoogleChartControllerCest.php | 201 -- tests/functional/HelpControllerCest.php | 89 - tests/functional/HomeControllerCest.php | 97 - tests/functional/JsonControllerCest.php | 56 - tests/functional/PiggyBankControllerCest.php | 356 ---- .../functional/PreferencesControllerCest.php | 48 - tests/functional/ProfileControllerCest.php | 150 -- tests/functional/RelatedControllerCest.php | 99 - tests/functional/ReminderControllerCest.php | 86 - .../RepeatedExpenseControllerCest.php | 298 --- tests/functional/ReportControllerCest.php | 79 - tests/functional/SearchControllerCest.php | 39 - .../functional/TransactionControllerCest.php | 356 ---- tests/functional/UserControllerCest.php | 150 -- tests/functional/_bootstrap.php | 8 - tests/unit.suite.yml | 6 - tests/unit/AccountTest.php | 40 - tests/unit/AccountTypeTest.php | 27 - tests/unit/BudgetTest.php | 26 - tests/unit/PiggyBankRepetitionTest.php | 29 - tests/unit/PiggyBankTest.php | 27 - tests/unit/ReminderTest.php | 38 - tests/unit/TransactionGroupTest.php | 25 - tests/unit/TransactionJournalTest.php | 33 - tests/unit/TransactionTest.php | 67 - tests/unit/TransactionTypeTest.php | 30 - tests/unit/UserTest.php | 36 - tests/unit/_bootstrap.php | 2 - 439 files changed, 19 insertions(+), 33123 deletions(-) delete mode 100644 app/breadcrumbs.php delete mode 100644 app/commands/.gitkeep delete mode 100644 app/commands/Cleanup.php delete mode 100644 app/config/.gitignore delete mode 100644 app/config/app.php delete mode 100644 app/config/auth.php delete mode 100644 app/config/cache.php delete mode 100644 app/config/compile.php delete mode 100644 app/config/database.php delete mode 100644 app/config/dev.php delete mode 100644 app/config/firefly.php delete mode 100644 app/config/homestead/app.php delete mode 100644 app/config/homestead/cache.php delete mode 100644 app/config/homestead/database.php delete mode 100644 app/config/homestead/mail.php delete mode 100644 app/config/mail.php delete mode 100644 app/config/packages/.gitkeep delete mode 100644 app/config/packages/barryvdh/laravel-debugbar/config.php delete mode 100644 app/config/packages/barryvdh/laravel-ide-helper/config.php delete mode 100644 app/config/packages/davejamesmiller/laravel-breadcrumbs/config.php delete mode 100644 app/config/queue.php delete mode 100644 app/config/remote.php delete mode 100644 app/config/services.php delete mode 100644 app/config/session.php delete mode 100644 app/config/testing/app.php delete mode 100644 app/config/testing/auth.php delete mode 100644 app/config/testing/cache.php delete mode 100644 app/config/testing/database.php delete mode 100644 app/config/testing/mail.php delete mode 100644 app/config/testing/session.php delete mode 100644 app/config/testingInMemory/app.php delete mode 100644 app/config/testingInMemory/auth.php delete mode 100644 app/config/testingInMemory/cache.php delete mode 100644 app/config/testingInMemory/database.php delete mode 100644 app/config/testingInMemory/mail.php delete mode 100644 app/config/testingInMemory/session.php delete mode 100644 app/config/view.php delete mode 100644 app/config/workbench.php delete mode 100644 app/controllers/.gitkeep delete mode 100644 app/controllers/AccountController.php delete mode 100644 app/controllers/BaseController.php delete mode 100644 app/controllers/BillController.php delete mode 100644 app/controllers/BudgetController.php delete mode 100644 app/controllers/CategoryController.php delete mode 100644 app/controllers/CurrencyController.php delete mode 100644 app/controllers/GoogleChartController.php delete mode 100644 app/controllers/HelpController.php delete mode 100644 app/controllers/HomeController.php delete mode 100644 app/controllers/JsonController.php delete mode 100644 app/controllers/PiggybankController.php delete mode 100644 app/controllers/PreferencesController.php delete mode 100644 app/controllers/ProfileController.php delete mode 100644 app/controllers/RelatedController.php delete mode 100644 app/controllers/ReminderController.php delete mode 100644 app/controllers/RepeatedExpenseController.php delete mode 100644 app/controllers/ReportController.php delete mode 100644 app/controllers/SearchController.php delete mode 100644 app/controllers/TransactionController.php delete mode 100644 app/controllers/UserController.php delete mode 100644 app/database/migrations/.gitkeep delete mode 100644 app/database/migrations/2014_06_27_163032_create_users_table.php delete mode 100644 app/database/migrations/2014_06_27_163145_create_account_types_table.php delete mode 100644 app/database/migrations/2014_06_27_163259_create_accounts_table.php delete mode 100644 app/database/migrations/2014_06_27_163817_create_components_table.php delete mode 100644 app/database/migrations/2014_06_27_163818_create_piggybanks_table.php delete mode 100644 app/database/migrations/2014_06_27_164042_create_transaction_currencies_table.php delete mode 100644 app/database/migrations/2014_06_27_164512_create_transaction_types_table.php delete mode 100644 app/database/migrations/2014_06_27_164619_create_recurring_transactions_table.php delete mode 100644 app/database/migrations/2014_06_27_164620_create_transaction_journals_table.php delete mode 100644 app/database/migrations/2014_06_27_164836_create_transactions_table.php delete mode 100644 app/database/migrations/2014_06_27_165344_create_component_transaction_table.php delete mode 100644 app/database/migrations/2014_07_05_171326_create_component_transaction_journal_table.php delete mode 100644 app/database/migrations/2014_07_06_123842_create_preferences_table.php delete mode 100644 app/database/migrations/2014_07_09_204843_create_session_table.php delete mode 100644 app/database/migrations/2014_07_17_183717_create_limits_table.php delete mode 100644 app/database/migrations/2014_07_19_055011_create_limit_repeat_table.php delete mode 100644 app/database/migrations/2014_08_06_044416_create_component_recurring_transaction_table.php delete mode 100644 app/database/migrations/2014_08_12_173919_create_piggybank_repetitions_table.php delete mode 100644 app/database/migrations/2014_08_18_100330_create_piggybank_events_table.php delete mode 100644 app/database/migrations/2014_08_23_113221_create_reminders_table.php delete mode 100644 app/database/migrations/2014_11_10_172053_create_account_meta_table.php delete mode 100644 app/database/migrations/2014_11_29_135749_create_transaction_groups_table.php delete mode 100644 app/database/migrations/2014_11_29_140217_create_transaction_group_transaction_journal_table.php delete mode 100644 app/database/migrations/2014_12_13_190730_changes_for_v321.php delete mode 100644 app/database/migrations/2014_12_24_191544_changes_for_v322.php delete mode 100644 app/database/migrations/2015_01_18_082406_changes_for_v325.php delete mode 100644 app/database/seeds/.gitkeep delete mode 100644 app/database/seeds/AccountTypeSeeder.php delete mode 100644 app/database/seeds/DatabaseSeeder.php delete mode 100644 app/database/seeds/TestDataSeeder.php delete mode 100644 app/database/seeds/TransactionCurrencySeeder.php delete mode 100644 app/database/seeds/TransactionTypeSeeder.php delete mode 100644 app/filters.php delete mode 100644 app/lang/en/pagination.php delete mode 100644 app/lang/en/reminders.php delete mode 100644 app/lang/en/validation.php delete mode 100644 app/lib/FireflyIII/Chart/Chart.php delete mode 100644 app/lib/FireflyIII/Chart/ChartInterface.php delete mode 100644 app/lib/FireflyIII/Collection/PiggybankPart.php delete mode 100644 app/lib/FireflyIII/Database/Account/Account.php delete mode 100644 app/lib/FireflyIII/Database/Account/AccountInterface.php delete mode 100644 app/lib/FireflyIII/Database/AccountType/AccountType.php delete mode 100644 app/lib/FireflyIII/Database/Bill/Bill.php delete mode 100644 app/lib/FireflyIII/Database/Bill/BillInterface.php delete mode 100644 app/lib/FireflyIII/Database/Budget/Budget.php delete mode 100644 app/lib/FireflyIII/Database/Budget/BudgetInterface.php delete mode 100644 app/lib/FireflyIII/Database/CUDInterface.php delete mode 100644 app/lib/FireflyIII/Database/Category/Category.php delete mode 100644 app/lib/FireflyIII/Database/CommonDatabaseCallsInterface.php delete mode 100644 app/lib/FireflyIII/Database/PiggyBank/PiggyBank.php delete mode 100644 app/lib/FireflyIII/Database/PiggyBank/PiggyBankShared.php delete mode 100644 app/lib/FireflyIII/Database/PiggyBank/PiggybankInterface.php delete mode 100644 app/lib/FireflyIII/Database/PiggyBank/RepeatedExpense.php delete mode 100644 app/lib/FireflyIII/Database/SwitchUser.php delete mode 100644 app/lib/FireflyIII/Database/Transaction/Transaction.php delete mode 100644 app/lib/FireflyIII/Database/TransactionCurrency/TransactionCurrency.php delete mode 100644 app/lib/FireflyIII/Database/TransactionCurrency/TransactionCurrencyInterface.php delete mode 100644 app/lib/FireflyIII/Database/TransactionJournal/TransactionJournal.php delete mode 100644 app/lib/FireflyIII/Database/TransactionJournal/TransactionJournalInterface.php delete mode 100644 app/lib/FireflyIII/Database/TransactionType/TransactionType.php delete mode 100644 app/lib/FireflyIII/Database/User/User.php delete mode 100644 app/lib/FireflyIII/Event/Account.php delete mode 100644 app/lib/FireflyIII/Event/Budget.php delete mode 100644 app/lib/FireflyIII/Event/Event.php delete mode 100644 app/lib/FireflyIII/Event/Piggybank.php delete mode 100644 app/lib/FireflyIII/Event/Transaction.php delete mode 100644 app/lib/FireflyIII/Event/TransactionJournal.php delete mode 100644 app/lib/FireflyIII/Exception/FireflyException.php delete mode 100644 app/lib/FireflyIII/Exception/NotImplementedException.php delete mode 100644 app/lib/FireflyIII/Exception/ValidationException.php delete mode 100644 app/lib/FireflyIII/FF3ServiceProvider.php delete mode 100644 app/lib/FireflyIII/Form/Form.php delete mode 100644 app/lib/FireflyIII/Helper/Related/Related.php delete mode 100644 app/lib/FireflyIII/Helper/Related/RelatedInterface.php delete mode 100644 app/lib/FireflyIII/Helper/TransactionJournal/Helper.php delete mode 100644 app/lib/FireflyIII/Helper/TransactionJournal/HelperInterface.php delete mode 100644 app/lib/FireflyIII/Report/Report.php delete mode 100644 app/lib/FireflyIII/Report/ReportHelper.php delete mode 100644 app/lib/FireflyIII/Report/ReportHelperInterface.php delete mode 100644 app/lib/FireflyIII/Report/ReportInterface.php delete mode 100644 app/lib/FireflyIII/Report/ReportQuery.php delete mode 100644 app/lib/FireflyIII/Report/ReportQueryInterface.php delete mode 100644 app/lib/FireflyIII/Search/Search.php delete mode 100644 app/lib/FireflyIII/Shared/Facade/Amount.php delete mode 100644 app/lib/FireflyIII/Shared/Facade/DateKit.php delete mode 100644 app/lib/FireflyIII/Shared/Facade/FFForm.php delete mode 100644 app/lib/FireflyIII/Shared/Facade/Filter.php delete mode 100644 app/lib/FireflyIII/Shared/Facade/Navigation.php delete mode 100644 app/lib/FireflyIII/Shared/Facade/Reminders.php delete mode 100644 app/lib/FireflyIII/Shared/Facade/Steam.php delete mode 100644 app/lib/FireflyIII/Shared/Mail/Registration.php delete mode 100644 app/lib/FireflyIII/Shared/Mail/RegistrationInterface.php delete mode 100644 app/lib/FireflyIII/Shared/Preferences/Preferences.php delete mode 100644 app/lib/FireflyIII/Shared/Preferences/PreferencesInterface.php delete mode 100644 app/lib/FireflyIII/Shared/Toolkit/Amount.php delete mode 100644 app/lib/FireflyIII/Shared/Toolkit/Date.php delete mode 100644 app/lib/FireflyIII/Shared/Toolkit/Filter.php delete mode 100644 app/lib/FireflyIII/Shared/Toolkit/Form.php delete mode 100644 app/lib/FireflyIII/Shared/Toolkit/Navigation.php delete mode 100644 app/lib/FireflyIII/Shared/Toolkit/Reminders.php delete mode 100644 app/lib/FireflyIII/Shared/Toolkit/Steam.php delete mode 100644 app/lib/FireflyIII/Shared/Validation/FireflyValidator.php delete mode 100644 app/lib/FireflyIII/Shared/Validation/ValidationServiceProvider.php delete mode 100644 app/models/Account.php delete mode 100644 app/models/AccountMeta.php delete mode 100644 app/models/AccountType.php delete mode 100644 app/models/Bill.php delete mode 100644 app/models/Budget.php delete mode 100644 app/models/BudgetLimit.php delete mode 100644 app/models/Category.php delete mode 100644 app/models/Component.php delete mode 100644 app/models/LimitRepetition.php delete mode 100644 app/models/Piggybank.php delete mode 100644 app/models/PiggybankEvent.php delete mode 100644 app/models/PiggybankRepetition.php delete mode 100644 app/models/Preference.php delete mode 100644 app/models/Reminder.php delete mode 100644 app/models/Transaction.php delete mode 100644 app/models/TransactionCurrency.php delete mode 100644 app/models/TransactionGroup.php delete mode 100644 app/models/TransactionJournal.php delete mode 100644 app/models/TransactionRelation.php delete mode 100644 app/models/TransactionType.php delete mode 100644 app/models/User.php delete mode 100644 app/routes.php delete mode 100644 app/start/artisan.php delete mode 100644 app/start/global.php delete mode 100644 app/start/local.php delete mode 100644 app/storage/.gitignore delete mode 100644 app/storage/cache/.gitignore delete mode 100644 app/storage/debugbar/.gitignore delete mode 100644 app/storage/logs/.gitignore delete mode 100644 app/storage/meta/.gitignore delete mode 100644 app/storage/sessions/.gitignore delete mode 100644 app/storage/views/.gitignore delete mode 100644 app/tests/TestCase.php delete mode 100644 app/tests/factories/Account.php delete mode 100644 app/tests/factories/AccountMeta.php delete mode 100644 app/tests/factories/AccountType.php delete mode 100644 app/tests/factories/Budget.php delete mode 100644 app/tests/factories/PiggyBank.php delete mode 100644 app/tests/factories/PiggyBankRepetition.php delete mode 100644 app/tests/factories/Preference.php delete mode 100644 app/tests/factories/Reminder.php delete mode 100644 app/tests/factories/Transaction.php delete mode 100644 app/tests/factories/TransactionCurrency.php delete mode 100644 app/tests/factories/TransactionGroup.php delete mode 100644 app/tests/factories/TransactionJournal.php delete mode 100644 app/tests/factories/TransactionType.php delete mode 100644 app/tests/factories/User.php delete mode 100644 app/views/accounts/create.blade.php delete mode 100644 app/views/accounts/delete.blade.php delete mode 100644 app/views/accounts/edit.blade.php delete mode 100644 app/views/accounts/index.blade.php delete mode 100644 app/views/accounts/show.blade.php delete mode 100644 app/views/bills/create.blade.php delete mode 100644 app/views/bills/delete.blade.php delete mode 100644 app/views/bills/edit.blade.php delete mode 100644 app/views/bills/index.blade.php delete mode 100644 app/views/bills/show.blade.php delete mode 100644 app/views/budgets/create.blade.php delete mode 100644 app/views/budgets/delete.blade.php delete mode 100644 app/views/budgets/edit.blade.php delete mode 100644 app/views/budgets/income.blade.php delete mode 100644 app/views/budgets/index.blade.php delete mode 100644 app/views/budgets/noBudget.blade.php delete mode 100644 app/views/budgets/show.blade.php delete mode 100644 app/views/categories/create.blade.php delete mode 100644 app/views/categories/delete.blade.php delete mode 100644 app/views/categories/edit.blade.php delete mode 100644 app/views/categories/index.blade.php delete mode 100644 app/views/categories/noCategory.blade.php delete mode 100644 app/views/categories/show.blade.php delete mode 100644 app/views/currency/create.blade.php delete mode 100644 app/views/currency/delete.blade.php delete mode 100644 app/views/currency/edit.blade.php delete mode 100644 app/views/currency/index.blade.php delete mode 100644 app/views/emails/user/register-html.blade.php delete mode 100644 app/views/emails/user/register-text.blade.php delete mode 100644 app/views/emails/user/verify-html.blade.php delete mode 100644 app/views/emails/user/verify-text.blade.php delete mode 100644 app/views/error.blade.php delete mode 100644 app/views/form/amount.blade.php delete mode 100644 app/views/form/balance.blade.php delete mode 100644 app/views/form/checkbox.blade.php delete mode 100644 app/views/form/date.blade.php delete mode 100644 app/views/form/feedback.blade.php delete mode 100644 app/views/form/integer.blade.php delete mode 100644 app/views/form/options.blade.php delete mode 100644 app/views/form/select.blade.php delete mode 100644 app/views/form/tags.blade.php delete mode 100644 app/views/form/text.blade.php delete mode 100644 app/views/help/show.blade.php delete mode 100644 app/views/index.blade.php delete mode 100644 app/views/layouts/default.blade.php delete mode 100644 app/views/layouts/guest.blade.php delete mode 100644 app/views/list/accounts.blade.php delete mode 100644 app/views/list/bills.blade.php delete mode 100644 app/views/list/categories.blade.php delete mode 100644 app/views/list/journals-full.blade.php delete mode 100644 app/views/list/journals-small.blade.php delete mode 100644 app/views/list/journals-tiny.blade.php delete mode 100644 app/views/list/piggy-bank-events.blade.php delete mode 100644 app/views/partials/date_nav.blade.php delete mode 100644 app/views/partials/flashes.blade.php delete mode 100644 app/views/partials/menu.blade.php delete mode 100644 app/views/piggy_banks/add.blade.php delete mode 100644 app/views/piggy_banks/create.blade.php delete mode 100644 app/views/piggy_banks/delete.blade.php delete mode 100644 app/views/piggy_banks/edit.blade.php delete mode 100644 app/views/piggy_banks/index.blade.php delete mode 100644 app/views/piggy_banks/remove.blade.php delete mode 100644 app/views/piggy_banks/show.blade.php delete mode 100644 app/views/preferences/index.blade.php delete mode 100644 app/views/profile/change-password.blade.php delete mode 100644 app/views/profile/index.blade.php delete mode 100644 app/views/related/relate.blade.php delete mode 100644 app/views/reminders/show.blade.php delete mode 100644 app/views/repeatedExpense/create.blade.php delete mode 100644 app/views/repeatedExpense/delete.blade.php delete mode 100644 app/views/repeatedExpense/edit.blade.php delete mode 100644 app/views/repeatedExpense/index.blade.php delete mode 100644 app/views/repeatedExpense/show.blade.php delete mode 100644 app/views/reports/budget.blade.php delete mode 100644 app/views/reports/index.blade.php delete mode 100644 app/views/reports/month.blade.php delete mode 100644 app/views/reports/year.blade.php delete mode 100644 app/views/search/index.blade.php delete mode 100644 app/views/transactions/create.blade.php delete mode 100644 app/views/transactions/delete.blade.php delete mode 100644 app/views/transactions/edit.blade.php delete mode 100644 app/views/transactions/index.blade.php delete mode 100644 app/views/transactions/show.blade.php delete mode 100644 app/views/user/login.blade.php delete mode 100644 app/views/user/register.blade.php delete mode 100644 app/views/user/registered.blade.php delete mode 100644 app/views/user/remindMe-html.blade.php delete mode 100644 app/views/user/remindMe-text.blade.php delete mode 100644 app/views/user/remindMe.blade.php delete mode 100644 app/views/user/verification-pending.blade.php delete mode 100644 build/logs/.gitignore delete mode 100644 provider/assets/javascripts/jquery.min.js delete mode 100644 provider/assets/stylesheets/readme.txt delete mode 100644 public/.htaccess delete mode 100644 public/android-chrome-144x144.png delete mode 100644 public/android-chrome-192x192.png delete mode 100644 public/android-chrome-36x36.png delete mode 100644 public/android-chrome-48x48.png delete mode 100644 public/android-chrome-72x72.png delete mode 100644 public/android-chrome-96x96.png delete mode 100644 public/android-chrome-manifest.json delete mode 100644 public/apple-touch-icon-114x114.png delete mode 100644 public/apple-touch-icon-120x120.png delete mode 100644 public/apple-touch-icon-144x144.png delete mode 100644 public/apple-touch-icon-152x152.png delete mode 100644 public/apple-touch-icon-180x180.png delete mode 100644 public/apple-touch-icon-57x57.png delete mode 100644 public/apple-touch-icon-60x60.png delete mode 100644 public/apple-touch-icon-72x72.png delete mode 100644 public/apple-touch-icon-76x76.png delete mode 100644 public/apple-touch-icon-precomposed.png delete mode 100644 public/apple-touch-icon.png delete mode 100755 public/assets/images/error.png delete mode 100644 public/assets/javascript/bootstrap/bootstrap.min.js delete mode 100644 public/assets/javascript/firefly/accounts.js delete mode 100644 public/assets/javascript/firefly/bills.js delete mode 100644 public/assets/javascript/firefly/budgets.js delete mode 100644 public/assets/javascript/firefly/categories.js delete mode 100644 public/assets/javascript/firefly/firefly.js delete mode 100644 public/assets/javascript/firefly/gcharts.js delete mode 100644 public/assets/javascript/firefly/gcharts.options.js delete mode 100644 public/assets/javascript/firefly/help.js delete mode 100644 public/assets/javascript/firefly/index.js delete mode 100644 public/assets/javascript/firefly/piggy_banks.js delete mode 100644 public/assets/javascript/firefly/related-manager.js delete mode 100644 public/assets/javascript/firefly/reminders.js delete mode 100644 public/assets/javascript/firefly/reports.js delete mode 100644 public/assets/javascript/firefly/transactions.js delete mode 100644 public/assets/javascript/jquery/jquery-2.1.1.min.js delete mode 100644 public/assets/javascript/jquery/jquery-2.1.1.min.map delete mode 100755 public/assets/javascript/metisMenu/jquery.metisMenu.min.js delete mode 100755 public/assets/javascript/sb-admin/sb-admin-2.js delete mode 100755 public/assets/javascript/tagsinput/bootstrap-tagsinput.min.js delete mode 100644 public/assets/javascript/typeahead/bootstrap3-typeahead.min.js delete mode 100644 public/assets/stylesheets/bootstrap/bootstrap.min.css delete mode 100644 public/assets/stylesheets/fa/css/font-awesome.css delete mode 100644 public/assets/stylesheets/fa/css/font-awesome.min.css delete mode 100644 public/assets/stylesheets/fa/fonts/FontAwesome.otf delete mode 100644 public/assets/stylesheets/fa/fonts/fontawesome-webfont.eot delete mode 100644 public/assets/stylesheets/fa/fonts/fontawesome-webfont.svg delete mode 100644 public/assets/stylesheets/fa/fonts/fontawesome-webfont.ttf delete mode 100644 public/assets/stylesheets/fa/fonts/fontawesome-webfont.woff delete mode 100644 public/assets/stylesheets/fonts/glyphicons-halflings-regular.eot delete mode 100644 public/assets/stylesheets/fonts/glyphicons-halflings-regular.svg delete mode 100644 public/assets/stylesheets/fonts/glyphicons-halflings-regular.ttf delete mode 100644 public/assets/stylesheets/fonts/glyphicons-halflings-regular.woff delete mode 100755 public/assets/stylesheets/metisMenu/metisMenu.min.css delete mode 100755 public/assets/stylesheets/sbadmin/sb.css delete mode 100644 public/assets/stylesheets/tagsinput/bootstrap-tagsinput.css delete mode 100644 public/browserconfig.xml delete mode 100644 public/favicon-16x16.png delete mode 100644 public/favicon-32x32.png delete mode 100644 public/favicon-96x96.png delete mode 100644 public/favicon.ico delete mode 100644 public/index.php delete mode 100644 public/mstile-144x144.png delete mode 100644 public/mstile-150x150.png delete mode 100644 public/mstile-310x150.png delete mode 100644 public/mstile-310x310.png delete mode 100644 public/mstile-70x70.png delete mode 100644 public/packages/.gitkeep delete mode 100644 public/packages/barryvdh/laravel-debugbar/laravel-debugbar.css delete mode 100644 public/packages/barryvdh/laravel-debugbar/laravel-icon.png delete mode 100644 public/packages/maximebf/php-debugbar/debugbar.css delete mode 100644 public/packages/maximebf/php-debugbar/debugbar.js delete mode 100644 public/packages/maximebf/php-debugbar/icons.png delete mode 100644 public/packages/maximebf/php-debugbar/openhandler.css delete mode 100644 public/packages/maximebf/php-debugbar/openhandler.js delete mode 100644 public/packages/maximebf/php-debugbar/php-icon.png delete mode 100644 public/packages/maximebf/php-debugbar/vendor/font-awesome/css/font-awesome.min.css delete mode 100644 public/packages/maximebf/php-debugbar/vendor/font-awesome/fonts/FontAwesome.otf delete mode 100644 public/packages/maximebf/php-debugbar/vendor/font-awesome/fonts/fontawesome-webfont.eot delete mode 100644 public/packages/maximebf/php-debugbar/vendor/font-awesome/fonts/fontawesome-webfont.svg delete mode 100644 public/packages/maximebf/php-debugbar/vendor/font-awesome/fonts/fontawesome-webfont.ttf delete mode 100644 public/packages/maximebf/php-debugbar/vendor/font-awesome/fonts/fontawesome-webfont.woff delete mode 100644 public/packages/maximebf/php-debugbar/vendor/highlightjs/highlight.pack.js delete mode 100644 public/packages/maximebf/php-debugbar/vendor/highlightjs/styles/github.css delete mode 100644 public/packages/maximebf/php-debugbar/vendor/jquery/dist/jquery.min.js delete mode 100644 public/packages/maximebf/php-debugbar/widgets.css delete mode 100644 public/packages/maximebf/php-debugbar/widgets.js delete mode 100644 public/packages/maximebf/php-debugbar/widgets/mails/widget.css delete mode 100644 public/packages/maximebf/php-debugbar/widgets/mails/widget.js delete mode 100644 public/packages/maximebf/php-debugbar/widgets/sqlqueries/widget.css delete mode 100644 public/packages/maximebf/php-debugbar/widgets/sqlqueries/widget.js delete mode 100644 public/packages/maximebf/php-debugbar/widgets/templates/widget.css delete mode 100644 public/packages/maximebf/php-debugbar/widgets/templates/widget.js delete mode 100644 public/robots.txt delete mode 100644 tests/_bootstrap.php delete mode 100755 tests/_data/db.sh delete mode 100644 tests/_support/AcceptanceHelper.php delete mode 100644 tests/_support/FunctionalHelper.php delete mode 100644 tests/_support/UnitHelper.php delete mode 100644 tests/acceptance.suite.yml delete mode 100644 tests/acceptance/_bootstrap.php delete mode 100644 tests/functional.suite.yml delete mode 100644 tests/functional/AccountControllerCest.php delete mode 100644 tests/functional/BillControllerCest.php delete mode 100644 tests/functional/BudgetControllerCest.php delete mode 100644 tests/functional/CategoryControllerCest.php delete mode 100644 tests/functional/CurrencyControllerCest.php delete mode 100644 tests/functional/GoogleChartControllerCest.php delete mode 100644 tests/functional/HelpControllerCest.php delete mode 100644 tests/functional/HomeControllerCest.php delete mode 100644 tests/functional/JsonControllerCest.php delete mode 100644 tests/functional/PiggyBankControllerCest.php delete mode 100644 tests/functional/PreferencesControllerCest.php delete mode 100644 tests/functional/ProfileControllerCest.php delete mode 100644 tests/functional/RelatedControllerCest.php delete mode 100644 tests/functional/ReminderControllerCest.php delete mode 100644 tests/functional/RepeatedExpenseControllerCest.php delete mode 100644 tests/functional/ReportControllerCest.php delete mode 100644 tests/functional/SearchControllerCest.php delete mode 100644 tests/functional/TransactionControllerCest.php delete mode 100644 tests/functional/UserControllerCest.php delete mode 100644 tests/functional/_bootstrap.php delete mode 100644 tests/unit.suite.yml delete mode 100644 tests/unit/AccountTest.php delete mode 100644 tests/unit/AccountTypeTest.php delete mode 100644 tests/unit/BudgetTest.php delete mode 100644 tests/unit/PiggyBankRepetitionTest.php delete mode 100644 tests/unit/PiggyBankTest.php delete mode 100644 tests/unit/ReminderTest.php delete mode 100644 tests/unit/TransactionGroupTest.php delete mode 100644 tests/unit/TransactionJournalTest.php delete mode 100644 tests/unit/TransactionTest.php delete mode 100644 tests/unit/TransactionTypeTest.php delete mode 100644 tests/unit/UserTest.php delete mode 100644 tests/unit/_bootstrap.php diff --git a/app/breadcrumbs.php b/app/breadcrumbs.php deleted file mode 100644 index 126c478c30..0000000000 --- a/app/breadcrumbs.php +++ /dev/null @@ -1,369 +0,0 @@ -push('Home', route('index')); - } -); - -// accounts -Breadcrumbs::register( - 'accounts.index', function (Generator $breadcrumbs, $what) { - $breadcrumbs->parent('home'); - $breadcrumbs->push(ucfirst(e($what)) . ' accounts', route('accounts.index', $what)); -} -); -Breadcrumbs::register( - 'accounts.show', function (Generator $breadcrumbs, \Account $account) { - switch ($account->accountType->type) { - default: - throw new FireflyException('Cannot handle account type "' . e($account->accountType->type) . '"'); - break; - case 'Default account': - case 'Asset account': - $what = 'asset'; - break; - case 'Cash account': - $what = 'cash'; - break; - case 'Expense account': - case 'Beneficiary account': - $what = 'expense'; - break; - case 'Revenue account': - $what = 'revenue'; - break; - } - $breadcrumbs->parent('accounts.index', $what); - $breadcrumbs->push(e($account->name), route('accounts.show', $account->id)); -} -); -Breadcrumbs::register( - 'accounts.delete', function (Generator $breadcrumbs, \Account $account) { - $breadcrumbs->parent('accounts.show', $account); - $breadcrumbs->push('Delete ' . e($account->name), route('accounts.delete', $account->id)); -} -); - -Breadcrumbs::register( - 'accounts.edit', function (Generator $breadcrumbs, \Account $account) { - $breadcrumbs->parent('accounts.show', $account); - $breadcrumbs->push('Edit ' . e($account->name), route('accounts.edit', $account->id)); -} -); - -// budgets. -Breadcrumbs::register( - 'budgets.index', function (Generator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push('Budgets', route('budgets.index')); -} -); -Breadcrumbs::register( - 'budgets.create', function (Generator $breadcrumbs) { - $breadcrumbs->parent('budgets.index'); - $breadcrumbs->push('Create new budget', route('budgets.create')); -} -); - -Breadcrumbs::register( - 'budgets.edit', function (Generator $breadcrumbs, Budget $budget) { - $breadcrumbs->parent('budgets.show', $budget); - $breadcrumbs->push('Edit ' . e($budget->name), route('budgets.edit', $budget->id)); -} -); -Breadcrumbs::register( - 'budgets.delete', function (Generator $breadcrumbs, Budget $budget) { - $breadcrumbs->parent('budgets.show', $budget); - $breadcrumbs->push('Delete ' . e($budget->name), route('budgets.delete', $budget->id)); -} -); - -Breadcrumbs::register( - 'budgets.show', function (Generator $breadcrumbs, Budget $budget, LimitRepetition $repetition = null) { - $breadcrumbs->parent('budgets.index'); - $breadcrumbs->push(e($budget->name), route('budgets.show', $budget->id)); - if (!is_null($repetition)) { - $breadcrumbs->push( - DateKit::periodShow($repetition->startdate, $repetition->budgetlimit->repeat_freq), route('budgets.show', $budget->id, $repetition->id) - ); - } -} -); - -// categories -Breadcrumbs::register( - 'categories.index', function (Generator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push('Categories', route('categories.index')); -} -); -Breadcrumbs::register( - 'categories.create', function (Generator $breadcrumbs) { - $breadcrumbs->parent('categories.index'); - $breadcrumbs->push('Create new category', route('categories.create')); -} -); - -Breadcrumbs::register( - 'categories.edit', function (Generator $breadcrumbs, Category $category) { - $breadcrumbs->parent('categories.show', $category); - $breadcrumbs->push('Edit ' . e($category->name), route('categories.edit', $category->id)); -} -); -Breadcrumbs::register( - 'categories.delete', function (Generator $breadcrumbs, Category $category) { - $breadcrumbs->parent('categories.show', $category); - $breadcrumbs->push('Delete ' . e($category->name), route('categories.delete', $category->id)); -} -); - -Breadcrumbs::register( - 'categories.show', function (Generator $breadcrumbs, Category $category) { - $breadcrumbs->parent('categories.index'); - $breadcrumbs->push(e($category->name), route('categories.show', $category->id)); - -} -); - - -// piggy banks -Breadcrumbs::register( - 'piggyBanks.index', function (Generator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push('Piggy banks', route('piggyBanks.index')); -} -); -Breadcrumbs::register( - 'piggyBanks.create', function (Generator $breadcrumbs) { - $breadcrumbs->parent('piggyBanks.index'); - $breadcrumbs->push('Create new piggy bank', route('piggyBanks.create')); -} -); - -Breadcrumbs::register( - 'piggyBanks.edit', function (Generator $breadcrumbs, PiggyBank $piggyBank) { - $breadcrumbs->parent('piggyBanks.show', $piggyBank); - $breadcrumbs->push('Edit ' . e($piggyBank->name), route('piggyBanks.edit', $piggyBank->id)); -} -); -Breadcrumbs::register( - 'piggyBanks.delete', function (Generator $breadcrumbs, PiggyBank $piggyBank) { - $breadcrumbs->parent('piggyBanks.show', $piggyBank); - $breadcrumbs->push('Delete ' . e($piggyBank->name), route('piggyBanks.delete', $piggyBank->id)); -} -); - -Breadcrumbs::register( - 'piggyBanks.show', function (Generator $breadcrumbs, PiggyBank $piggyBank) { - $breadcrumbs->parent('piggyBanks.index'); - $breadcrumbs->push(e($piggyBank->name), route('piggyBanks.show', $piggyBank->id)); - -} -); - -// preferences -Breadcrumbs::register( - 'preferences', function (Generator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push('Preferences', route('preferences')); - -} -); - -// profile -Breadcrumbs::register( - 'profile', function (Generator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push('Profile', route('profile')); - -} -); -Breadcrumbs::register( - 'change-password', function (Generator $breadcrumbs) { - $breadcrumbs->parent('profile'); - $breadcrumbs->push('Change your password', route('change-password')); - -} -); - -// bills -Breadcrumbs::register( - 'bills.index', function (Generator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push('Bills', route('bills.index')); -} -); -Breadcrumbs::register( - 'bills.create', function (Generator $breadcrumbs) { - $breadcrumbs->parent('bills.index'); - $breadcrumbs->push('Create new bill', route('bills.create')); -} -); - -Breadcrumbs::register( - 'bills.edit', function (Generator $breadcrumbs, Bill $bill) { - $breadcrumbs->parent('bills.show', $bill); - $breadcrumbs->push('Edit ' . e($bill->name), route('bills.edit', $bill->id)); -} -); -Breadcrumbs::register( - 'bills.delete', function (Generator $breadcrumbs, Bill $bill) { - $breadcrumbs->parent('bills.show', $bill); - $breadcrumbs->push('Delete ' . e($bill->name), route('bills.delete', $bill->id)); -} -); - -Breadcrumbs::register( - 'bills.show', function (Generator $breadcrumbs, Bill $bill) { - $breadcrumbs->parent('bills.index'); - $breadcrumbs->push(e($bill->name), route('bills.show', $bill->id)); - -} -); - -// reminders -Breadcrumbs::register( - 'reminders.show', function (Generator $breadcrumbs, Reminder $reminder) { - $breadcrumbs->parent('home'); - $breadcrumbs->push('Reminder #' . $reminder->id, route('reminders.show', $reminder->id)); - -} -); - -// repeated expenses -Breadcrumbs::register( - 'repeated.index', function (Generator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push('Repeated expenses', route('repeated.index')); -} -); -Breadcrumbs::register( - 'repeated.create', function (Generator $breadcrumbs) { - $breadcrumbs->parent('repeated.index'); - $breadcrumbs->push('Create new repeated expense', route('repeated.create')); -} -); - -Breadcrumbs::register( - 'repeated.edit', function (Generator $breadcrumbs, PiggyBank $piggyBank) { - $breadcrumbs->parent('repeated.show', $piggyBank); - $breadcrumbs->push('Edit ' . e($piggyBank->name), route('repeated.edit', $piggyBank->id)); -} -); -Breadcrumbs::register( - 'repeated.delete', function (Generator $breadcrumbs, PiggyBank $piggyBank) { - $breadcrumbs->parent('repeated.show', $piggyBank); - $breadcrumbs->push('Delete ' . e($piggyBank->name), route('repeated.delete', $piggyBank->id)); -} -); - -Breadcrumbs::register( - 'repeated.show', function (Generator $breadcrumbs, PiggyBank $piggyBank) { - $breadcrumbs->parent('repeated.index'); - $breadcrumbs->push(e($piggyBank->name), route('repeated.show', $piggyBank->id)); - -} -); - -// reports -Breadcrumbs::register( - 'reports.index', function (Generator $breadcrumbs) { - $breadcrumbs->parent('home'); - $breadcrumbs->push('Reports', route('reports.index')); -} -); - -Breadcrumbs::register( - 'reports.year', function (Generator $breadcrumbs, Carbon $date) { - $breadcrumbs->parent('reports.index'); - $breadcrumbs->push($date->format('Y'), route('reports.year', $date->format('Y'))); -} -); - -Breadcrumbs::register( - 'reports.month', function (Generator $breadcrumbs, Carbon $date) { - $breadcrumbs->parent('reports.index'); - $breadcrumbs->push('Monthly report for ' . $date->format('F Y'), route('reports.month', $date)); -} -); - -Breadcrumbs::register( - 'reports.budget', function (Generator $breadcrumbs, Carbon $date) { - $breadcrumbs->parent('reports.index'); - $breadcrumbs->push('Budget report for ' . $date->format('F Y'), route('reports.budget', $date)); -} -); - -// search -Breadcrumbs::register( - 'search', function (Generator $breadcrumbs, $query) { - $breadcrumbs->parent('home'); - $breadcrumbs->push('Search for "' . e($query) . '"', route('search')); -} -); - -// transactions -Breadcrumbs::register( - 'transactions.index', function (Generator $breadcrumbs, $what) { - $breadcrumbs->parent('home'); - - switch ($what) { - case 'expenses': - case 'withdrawal': - $subTitle = 'Expenses'; - break; - case 'revenue': - case 'deposit': - $subTitle = 'Revenue, income and deposits'; - break; - case 'transfer': - case 'transfers': - $subTitle = 'Transfers'; - break; - case 'opening balance': - $subTitle = 'Opening balances'; - break; - default: - throw new FireflyException('Cannot handle $what "' . e($what) . '" in bread crumbs'); - } - - $breadcrumbs->push($subTitle, route('transactions.index', $what)); -} -); -Breadcrumbs::register( - 'transactions.create', function (Generator $breadcrumbs, $what) { - $breadcrumbs->parent('transactions.index', $what); - $breadcrumbs->push('Create new ' .e($what), route('transactions.create', $what)); -} -); - -Breadcrumbs::register( - 'transactions.edit', function (Generator $breadcrumbs, TransactionJournal $journal) { - $breadcrumbs->parent('transactions.show', $journal); - $breadcrumbs->push('Edit ' . e($journal->description), route('transactions.edit', $journal->id)); -} -); -Breadcrumbs::register( - 'transactions.delete', function (Generator $breadcrumbs, TransactionJournal $journal) { - $breadcrumbs->parent('transactions.show', $journal); - $breadcrumbs->push('Delete ' . e($journal->description), route('transactions.delete', $journal->id)); -} -); - -Breadcrumbs::register( - 'transactions.show', function (Generator $breadcrumbs, TransactionJournal $journal) { - - $breadcrumbs->parent('transactions.index', strtolower($journal->transactionType->type)); - $breadcrumbs->push(e($journal->description), route('transactions.show', $journal->id)); - -} -); diff --git a/app/commands/.gitkeep b/app/commands/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/app/commands/Cleanup.php b/app/commands/Cleanup.php deleted file mode 100644 index db76195588..0000000000 --- a/app/commands/Cleanup.php +++ /dev/null @@ -1,76 +0,0 @@ -info('Start!'); - Artisan::call('clear-compiled'); - $this->info('Cleared compiled...'); - Artisan::call('ide-helper:generate'); - $this->info('IDE helper, done...'); - Artisan::call('ide-helper:models'); - $this->info('IDE models, done...'); - Artisan::call('optimize'); - $this->info('Optimized...'); - Artisan::call('dump-autoload'); - $this->info('Done!'); - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return [ - // ['example', InputArgument::REQUIRED, 'An example argument.'], - ]; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - // ['example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null], - ]; - } - -} diff --git a/app/config/.gitignore b/app/config/.gitignore deleted file mode 100644 index 10601ce198..0000000000 --- a/app/config/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -local/ -laptop/ -vagrant/ -production/ diff --git a/app/config/app.php b/app/config/app.php deleted file mode 100644 index 4771579bbb..0000000000 --- a/app/config/app.php +++ /dev/null @@ -1,91 +0,0 @@ - false, - 'url' => 'http://localhost', - 'timezone' => 'UTC', - 'locale' => 'en', - 'fallback_locale' => 'en', - 'log_level' => 'notice', - 'key' => 'D93oqmVsIARg23FC3cbsHuBGk0uXQc3r', - 'cipher' => MCRYPT_RIJNDAEL_128, - 'providers' => [ - - 'Illuminate\Foundation\Providers\ArtisanServiceProvider', - 'Illuminate\Auth\AuthServiceProvider', - 'Illuminate\Cache\CacheServiceProvider', - 'Illuminate\Session\CommandsServiceProvider', - 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', - 'Illuminate\Routing\ControllerServiceProvider', - 'Illuminate\Cookie\CookieServiceProvider', - 'Illuminate\Database\DatabaseServiceProvider', - 'Illuminate\Encryption\EncryptionServiceProvider', - 'Illuminate\Filesystem\FilesystemServiceProvider', - 'Illuminate\Hashing\HashServiceProvider', - 'Illuminate\Html\HtmlServiceProvider', - 'Illuminate\Log\LogServiceProvider', - 'Illuminate\Mail\MailServiceProvider', - 'Illuminate\Database\MigrationServiceProvider', - 'Illuminate\Pagination\PaginationServiceProvider', - 'Illuminate\Queue\QueueServiceProvider', - 'Illuminate\Redis\RedisServiceProvider', - 'Illuminate\Remote\RemoteServiceProvider', - 'Illuminate\Auth\Reminders\ReminderServiceProvider', - 'Illuminate\Database\SeedServiceProvider', - 'Illuminate\Session\SessionServiceProvider', - 'Illuminate\Translation\TranslationServiceProvider', - 'Illuminate\Validation\ValidationServiceProvider', - 'Illuminate\View\ViewServiceProvider', - 'Illuminate\Workbench\WorkbenchServiceProvider', - //'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', - //'Barryvdh\Debugbar\ServiceProvider', - 'FireflyIII\FF3ServiceProvider', - 'DaveJamesMiller\Breadcrumbs\ServiceProvider', - 'Grumpydictator\Gchart\GchartServiceProvider', - ], - 'manifest' => storage_path() . '/meta', - 'aliases' => [ - - 'App' => 'Illuminate\Support\Facades\App', - 'Artisan' => 'Illuminate\Support\Facades\Artisan', - 'Auth' => 'Illuminate\Support\Facades\Auth', - 'Blade' => 'Illuminate\Support\Facades\Blade', - 'Cache' => 'Illuminate\Support\Facades\Cache', - 'ClassLoader' => 'Illuminate\Support\ClassLoader', - 'Config' => 'Illuminate\Support\Facades\Config', - 'Controller' => 'Illuminate\Routing\Controller', - 'Cookie' => 'Illuminate\Support\Facades\Cookie', - 'Crypt' => 'Illuminate\Support\Facades\Crypt', - 'DB' => 'Illuminate\Support\Facades\DB', - 'Eloquent' => 'Illuminate\Database\Eloquent\Model', - 'Event' => 'Illuminate\Support\Facades\Event', - 'File' => 'Illuminate\Support\Facades\File', - 'Form' => 'Illuminate\Support\Facades\Form', - 'Hash' => 'Illuminate\Support\Facades\Hash', - 'HTML' => 'Illuminate\Support\Facades\HTML', - 'Input' => 'Illuminate\Support\Facades\Input', - 'Lang' => 'Illuminate\Support\Facades\Lang', - 'Log' => 'Illuminate\Support\Facades\Log', - 'Mail' => 'Illuminate\Support\Facades\Mail', - 'Paginator' => 'Illuminate\Support\Facades\Paginator', - 'Password' => 'Illuminate\Support\Facades\Password', - 'Queue' => 'Illuminate\Support\Facades\Queue', - 'Redirect' => 'Illuminate\Support\Facades\Redirect', - 'Redis' => 'Illuminate\Support\Facades\Redis', - 'Request' => 'Illuminate\Support\Facades\Request', - 'Response' => 'Illuminate\Support\Facades\Response', - 'Route' => 'Illuminate\Support\Facades\Route', - 'Schema' => 'Illuminate\Support\Facades\Schema', - 'Seeder' => 'Illuminate\Database\Seeder', - 'Session' => 'Illuminate\Support\Facades\Session', - 'SoftDeletingTrait' => 'Illuminate\Database\Eloquent\SoftDeletingTrait', - 'SSH' => 'Illuminate\Support\Facades\SSH', - 'Str' => 'Illuminate\Support\Str', - 'URL' => 'Illuminate\Support\Facades\URL', - 'Validator' => 'Illuminate\Support\Facades\Validator', - 'View' => 'Illuminate\Support\Facades\View', - 'Breadcrumbs' => 'DaveJamesMiller\Breadcrumbs\Facade' - - ], - -]; diff --git a/app/config/auth.php b/app/config/auth.php deleted file mode 100644 index 6e606f0ebe..0000000000 --- a/app/config/auth.php +++ /dev/null @@ -1,16 +0,0 @@ - 'eloquent', - 'model' => 'User', - 'table' => 'users', - 'reminder' => [ - 'email' => 'emails.auth.reminder', - 'table' => 'password_reminders', - 'expire' => 60, - ], - 'verify_mail' => true, - 'verify_reset' => true, - 'allow_register' => true - -]; diff --git a/app/config/cache.php b/app/config/cache.php deleted file mode 100644 index 8fa089055b..0000000000 --- a/app/config/cache.php +++ /dev/null @@ -1,12 +0,0 @@ - 'file', - 'path' => storage_path() . '/cache', - 'connection' => null, - 'table' => 'cache', - 'memcached' => [ - ['host' => '127.0.0.1', 'port' => 11211, 'weight' => 100], - ], - 'prefix' => 'laravel', -]; diff --git a/app/config/compile.php b/app/config/compile.php deleted file mode 100644 index 0b67a5fe47..0000000000 --- a/app/config/compile.php +++ /dev/null @@ -1,3 +0,0 @@ - PDO::FETCH_CLASS, - 'default' => 'mysql', - 'connections' => [ - 'mysql' => [ - 'driver' => 'mysql', - 'host' => 'localhost', - 'database' => 'forge', - 'username' => 'forge', - 'password' => '', - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - ], - ], - 'migrations' => 'migrations', - 'redis' => [ - - 'cluster' => false, - - 'default' => [ - 'host' => '127.0.0.1', - 'port' => 6379, - 'database' => 0, - ], - - ], - -]; diff --git a/app/config/dev.php b/app/config/dev.php deleted file mode 100644 index a5f5e8f277..0000000000 --- a/app/config/dev.php +++ /dev/null @@ -1,4 +0,0 @@ - '' -]; diff --git a/app/config/firefly.php b/app/config/firefly.php deleted file mode 100644 index c17ca873e3..0000000000 --- a/app/config/firefly.php +++ /dev/null @@ -1,49 +0,0 @@ - ['1D', '1W', '1M', '3M', '6M', '1Y', 'custom'], - 'budget_periods' => ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly'], - 'piggy_bank_periods' => [ - 'week' => 'Week', - 'month' => 'Month', - 'quarter' => 'Quarter', - 'year' => 'Year' - ], - 'periods_to_text' => [ - 'weekly' => 'A week', - 'monthly' => 'A month', - 'quarterly' => 'A quarter', - 'half-year' => 'Six months', - 'yearly' => 'A year', - ], - - 'accountRoles' => [ - 'defaultExpense' => 'Default expense account', - 'sharedExpense' => 'Shared expense account' - ], - - 'range_to_text' => [ - '1D' => 'day', - '1W' => 'week', - '1M' => 'month', - '3M' => 'three months', - '6M' => 'half year', - 'custom' => '(custom)' - ], - 'range_to_name' => [ - '1D' => 'one day', - '1W' => 'one week', - '1M' => 'one month', - '3M' => 'three months', - '6M' => 'six months', - '1Y' => 'one year', - ], - 'range_to_repeat_freq' => [ - '1D' => 'weekly', - '1W' => 'weekly', - '1M' => 'monthly', - '3M' => 'quarterly', - '6M' => 'half-year', - 'custom' => 'monthly' - ], -]; diff --git a/app/config/homestead/app.php b/app/config/homestead/app.php deleted file mode 100644 index 0f1dd6a103..0000000000 --- a/app/config/homestead/app.php +++ /dev/null @@ -1,15 +0,0 @@ - true, - 'log_level' => 'debug', -]; diff --git a/app/config/homestead/cache.php b/app/config/homestead/cache.php deleted file mode 100644 index 8fa089055b..0000000000 --- a/app/config/homestead/cache.php +++ /dev/null @@ -1,12 +0,0 @@ - 'file', - 'path' => storage_path() . '/cache', - 'connection' => null, - 'table' => 'cache', - 'memcached' => [ - ['host' => '127.0.0.1', 'port' => 11211, 'weight' => 100], - ], - 'prefix' => 'laravel', -]; diff --git a/app/config/homestead/database.php b/app/config/homestead/database.php deleted file mode 100644 index d585027ae3..0000000000 --- a/app/config/homestead/database.php +++ /dev/null @@ -1,37 +0,0 @@ - 'mysql', - 'connections' => [ - - 'mysql' => [ - 'driver' => 'mysql', - 'host' => 'localhost', - 'database' => 'homestead', - 'username' => 'homestead', - 'password' => 'secret', - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - ], - 'sqlite' => [ - 'driver' => 'sqlite', - 'database' => realpath(__DIR__.'/../../../tests/_data/testing.sqlite'), - 'prefix' => '' - ], - - 'pgsql' => [ - 'driver' => 'pgsql', - 'host' => 'localhost', - 'database' => 'homestead', - 'username' => 'homestead', - 'password' => 'secret', - 'charset' => 'utf8', - 'prefix' => '', - 'schema' => 'public', - ], - - ], - -]; diff --git a/app/config/homestead/mail.php b/app/config/homestead/mail.php deleted file mode 100644 index 28ee90f10c..0000000000 --- a/app/config/homestead/mail.php +++ /dev/null @@ -1,13 +0,0 @@ - 'smtp', - 'host' => 'smtp.gmail.com', - 'port' => 587, - 'from' => ['address' => 'empty@example.com', 'name' => 'Firefly III'], - 'encryption' => 'tls', - 'username' => 'empty@example.com', - 'password' => '', - 'sendmail' => '/usr/sbin/sendmail -bs', - 'pretend' => false, -]; diff --git a/app/config/mail.php b/app/config/mail.php deleted file mode 100644 index 9fe35072ad..0000000000 --- a/app/config/mail.php +++ /dev/null @@ -1,13 +0,0 @@ - 'smtp', - 'host' => '', - 'port' => 587, - 'from' => ['address' => '', 'name' => 'Firefly III'], - 'encryption' => 'tls', - 'username' => '', - 'password' => '', - 'sendmail' => '/usr/sbin/sendmail -bs', - 'pretend' => false, -]; diff --git a/app/config/packages/.gitkeep b/app/config/packages/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/app/config/packages/barryvdh/laravel-debugbar/config.php b/app/config/packages/barryvdh/laravel-debugbar/config.php deleted file mode 100644 index 3baf4b799a..0000000000 --- a/app/config/packages/barryvdh/laravel-debugbar/config.php +++ /dev/null @@ -1,127 +0,0 @@ - Config::get('app.debug'), - - 'storage' => [ - 'enabled' => true, - 'path' => storage_path() . '/debugbar', - ], - - /* - |-------------------------------------------------------------------------- - | Vendors - |-------------------------------------------------------------------------- - | - | Vendor files are included by default, but can be set to false. - | This can also be set to 'js' or 'css', to only include javascript or css vendor files. - | Vendor files are for css: font-awesome (including fonts) and highlight.js (css files) - | and for js: jquery and and highlight.js - | So if you want syntax highlighting, set it to true. - | jQuery is set to not conflict with existing jQuery scripts. - | - */ - - 'include_vendors' => true, - - /* - |-------------------------------------------------------------------------- - | Capture Ajax Requests - |-------------------------------------------------------------------------- - | - | The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors), - | you can use this option to disable sending the data through the headers. - | - */ - - 'capture_ajax' => true, - - /* - |-------------------------------------------------------------------------- - | Capture Console Commands - |-------------------------------------------------------------------------- - | - | The Debugbar can listen to Artisan commands. You can view them with the browse button in the Debugbar. - | - */ - - 'capture_console' => false, - - /* - |-------------------------------------------------------------------------- - | DataCollectors - |-------------------------------------------------------------------------- - | - | Enable/disable DataCollectors - | - */ - - 'collectors' => [ - 'phpinfo' => true, // Php version - 'messages' => true, // Messages - 'time' => true, // Time Datalogger - 'memory' => true, // Memory usage - 'exceptions' => true, // Exception displayer - 'log' => true, // Logs from Monolog (merged in messages if enabled) - 'db' => true, // Show database (PDO) queries and bindings - 'views' => true, // Views with their data - 'route' => true, // Current route information - 'laravel' => false, // Laravel version and environment - 'events' => false, // All events fired - 'default_request' => false, // Regular or special Symfony request logger - 'symfony_request' => true, // Only one can be enabled.. - 'mail' => true, // Catch mail messages - 'logs' => false, // Add the latest log messages - 'files' => false, // Show the included files - 'config' => false, // Display config settings - 'auth' => false, // Display Laravel authentication status - ], - - /* - |-------------------------------------------------------------------------- - | Extra options - |-------------------------------------------------------------------------- - | - | Configure some DataCollectors - | - */ - - 'options' => [ - 'auth' => [ - 'show_name' => false, // Also show the users name/email in the debugbar - ], - 'db' => [ - 'with_params' => true, // Render SQL with the parameters substituted - 'timeline' => false, // Add the queries to the timeline - ], - 'mail' => [ - 'full_log' => false - ], - 'views' => [ - 'data' => false, //Note: Can slow down the application, because the data can be quite large.. - ], - 'route' => [ - 'label' => true // show complete route on bar - ], - 'logs' => [ - 'file' => null - ], - ], - - /* - |-------------------------------------------------------------------------- - | Inject Debugbar in Response - |-------------------------------------------------------------------------- - | - | Usually, the debugbar is added just before , by listening to the - | Response after the App is done. If you disable this, you have to add them - | in your template yourself. See http://phpdebugbar.com/docs/rendering.html - | - */ - - 'inject' => true, - -]; diff --git a/app/config/packages/barryvdh/laravel-ide-helper/config.php b/app/config/packages/barryvdh/laravel-ide-helper/config.php deleted file mode 100644 index a49a469e62..0000000000 --- a/app/config/packages/barryvdh/laravel-ide-helper/config.php +++ /dev/null @@ -1,76 +0,0 @@ - '_ide_helper.php', - - /* - |-------------------------------------------------------------------------- - | Helper files to include - |-------------------------------------------------------------------------- - | - | Include helper files. By default not included, but can be toggled with the - | -- helpers (-H) option. Extra helper files can be included. - | - */ - - 'include_helpers' => false, - - 'helper_files' => [ - base_path() . '/vendor/laravel/framework/src/Illuminate/Support/helpers.php', - ], - - /* - |-------------------------------------------------------------------------- - | Model locations to include - |-------------------------------------------------------------------------- - | - | Define in which directories the ide-helper:models command should look - | for models. - | - */ - - 'model_locations' => [ - 'app/models', - ], - - - /* - |-------------------------------------------------------------------------- - | Extra classes - |-------------------------------------------------------------------------- - | - | These implementations are not really extended, but called with magic functions - | - */ - - 'extra' => [ - 'Artisan' => ['Illuminate\Foundation\Artisan'], - 'Eloquent' => ['Illuminate\Database\Eloquent\Builder', 'Illuminate\Database\Query\Builder'], - 'Session' => ['Illuminate\Session\Store'], - ], - - 'magic' => [ - 'Log' => [ - 'debug' => 'Monolog\Logger::addDebug', - 'info' => 'Monolog\Logger::addInfo', - 'notice' => 'Monolog\Logger::addNotice', - 'warning' => 'Monolog\Logger::addWarning', - 'error' => 'Monolog\Logger::addError', - 'critical' => 'Monolog\Logger::addCritical', - 'alert' => 'Monolog\Logger::addAlert', - 'emergency' => 'Monolog\Logger::addEmergency', - ] - ] - - -]; diff --git a/app/config/packages/davejamesmiller/laravel-breadcrumbs/config.php b/app/config/packages/davejamesmiller/laravel-breadcrumbs/config.php deleted file mode 100644 index e58b40faa9..0000000000 --- a/app/config/packages/davejamesmiller/laravel-breadcrumbs/config.php +++ /dev/null @@ -1,5 +0,0 @@ - 'laravel-breadcrumbs::bootstrap3', -]; diff --git a/app/config/queue.php b/app/config/queue.php deleted file mode 100644 index 79da1ff9c7..0000000000 --- a/app/config/queue.php +++ /dev/null @@ -1,45 +0,0 @@ - 'sync', - 'connections' => [ - - 'sync' => [ - 'driver' => 'sync', - ], - - 'beanstalkd' => [ - 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', - 'ttr' => 60, - ], - - 'sqs' => [ - 'driver' => 'sqs', - 'key' => 'your-public-key', - 'secret' => 'your-secret-key', - 'queue' => 'your-queue-url', - 'region' => 'us-east-1', - ], - - 'iron' => [ - 'driver' => 'iron', - 'host' => 'mq-aws-us-east-1.iron.io', - 'token' => 'your-token', - 'project' => 'your-project-id', - 'queue' => 'your-queue-name', - 'encrypt' => true, - ], - - 'redis' => [ - 'driver' => 'redis', - 'queue' => 'default', - ], - - ], - 'failed' => [ - 'database' => 'mysql', 'table' => 'failed_jobs', - ], - -]; diff --git a/app/config/remote.php b/app/config/remote.php deleted file mode 100644 index 3104bf7e34..0000000000 --- a/app/config/remote.php +++ /dev/null @@ -1,21 +0,0 @@ - 'production', - 'connections' => [ - - 'production' => [ - 'host' => '', - 'username' => '', - 'password' => '', - 'key' => '', - 'keyphrase' => '', - 'root' => '/var/www', - ], - ], - 'groups' => [ - 'web' => ['production'] - - ], - -]; diff --git a/app/config/services.php b/app/config/services.php deleted file mode 100644 index c252b2be65..0000000000 --- a/app/config/services.php +++ /dev/null @@ -1,19 +0,0 @@ - [ - 'domain' => '', - 'secret' => '', - ], - - 'mandrill' => [ - 'secret' => '', - ], - - 'stripe' => [ - 'model' => 'User', - 'secret' => '', - ], - -]; diff --git a/app/config/session.php b/app/config/session.php deleted file mode 100644 index a41728b267..0000000000 --- a/app/config/session.php +++ /dev/null @@ -1,16 +0,0 @@ - 'file', - 'lifetime' => 120, - 'expire_on_close' => false, - 'files' => storage_path() . '/sessions', - 'connection' => null, - 'table' => 'sessions', - 'lottery' => [2, 100], - 'cookie' => 'firefly_session', - 'path' => '/', - 'domain' => null, - 'secure' => false, - -]; diff --git a/app/config/testing/app.php b/app/config/testing/app.php deleted file mode 100644 index 7f9d13d6fb..0000000000 --- a/app/config/testing/app.php +++ /dev/null @@ -1,2 +0,0 @@ - 'debug',]; diff --git a/app/config/testing/auth.php b/app/config/testing/auth.php deleted file mode 100644 index 0fe9e0172d..0000000000 --- a/app/config/testing/auth.php +++ /dev/null @@ -1,8 +0,0 @@ - false, - 'verify_reset' => true, - 'allow_register' => true - -]; diff --git a/app/config/testing/cache.php b/app/config/testing/cache.php deleted file mode 100644 index fef1e78b52..0000000000 --- a/app/config/testing/cache.php +++ /dev/null @@ -1,3 +0,0 @@ - 'array',]; diff --git a/app/config/testing/database.php b/app/config/testing/database.php deleted file mode 100644 index e0be6a4063..0000000000 --- a/app/config/testing/database.php +++ /dev/null @@ -1,12 +0,0 @@ - 'sqlite', - 'connections' => [ - 'sqlite' => [ - 'driver' => 'sqlite', - 'database' => realpath(__DIR__.'/../../../tests/_data/db.sqlite'), - 'prefix' => '' - ] - - ] -]; diff --git a/app/config/testing/mail.php b/app/config/testing/mail.php deleted file mode 100644 index d2df78f4cd..0000000000 --- a/app/config/testing/mail.php +++ /dev/null @@ -1,13 +0,0 @@ - 'smtp', - 'host' => '', - 'port' => 587, - 'from' => ['address' => '', 'name' => 'Firefly III'], - 'encryption' => 'tls', - 'username' => '', - 'password' => '', - 'sendmail' => '/usr/sbin/sendmail -bs', - 'pretend' => true, -]; diff --git a/app/config/testing/session.php b/app/config/testing/session.php deleted file mode 100644 index fef1e78b52..0000000000 --- a/app/config/testing/session.php +++ /dev/null @@ -1,3 +0,0 @@ - 'array',]; diff --git a/app/config/testingInMemory/app.php b/app/config/testingInMemory/app.php deleted file mode 100644 index 7f9d13d6fb..0000000000 --- a/app/config/testingInMemory/app.php +++ /dev/null @@ -1,2 +0,0 @@ - 'debug',]; diff --git a/app/config/testingInMemory/auth.php b/app/config/testingInMemory/auth.php deleted file mode 100644 index 0fe9e0172d..0000000000 --- a/app/config/testingInMemory/auth.php +++ /dev/null @@ -1,8 +0,0 @@ - false, - 'verify_reset' => true, - 'allow_register' => true - -]; diff --git a/app/config/testingInMemory/cache.php b/app/config/testingInMemory/cache.php deleted file mode 100644 index fef1e78b52..0000000000 --- a/app/config/testingInMemory/cache.php +++ /dev/null @@ -1,3 +0,0 @@ - 'array',]; diff --git a/app/config/testingInMemory/database.php b/app/config/testingInMemory/database.php deleted file mode 100644 index 06b50aa143..0000000000 --- a/app/config/testingInMemory/database.php +++ /dev/null @@ -1,12 +0,0 @@ - 'sqlite', - 'connections' => [ - 'sqlite' => [ - 'driver' => 'sqlite', - 'database' => ':memory:', - 'prefix' => '' - ] - - ] -]; diff --git a/app/config/testingInMemory/mail.php b/app/config/testingInMemory/mail.php deleted file mode 100644 index d2df78f4cd..0000000000 --- a/app/config/testingInMemory/mail.php +++ /dev/null @@ -1,13 +0,0 @@ - 'smtp', - 'host' => '', - 'port' => 587, - 'from' => ['address' => '', 'name' => 'Firefly III'], - 'encryption' => 'tls', - 'username' => '', - 'password' => '', - 'sendmail' => '/usr/sbin/sendmail -bs', - 'pretend' => true, -]; diff --git a/app/config/testingInMemory/session.php b/app/config/testingInMemory/session.php deleted file mode 100644 index fef1e78b52..0000000000 --- a/app/config/testingInMemory/session.php +++ /dev/null @@ -1,3 +0,0 @@ - 'array',]; diff --git a/app/config/view.php b/app/config/view.php deleted file mode 100644 index f3b156d455..0000000000 --- a/app/config/view.php +++ /dev/null @@ -1,6 +0,0 @@ - [__DIR__ . '/../views'], - 'pagination' => 'pagination::slider-3', -]; diff --git a/app/config/workbench.php b/app/config/workbench.php deleted file mode 100644 index 62c843d71d..0000000000 --- a/app/config/workbench.php +++ /dev/null @@ -1,6 +0,0 @@ - '', - 'email' => '', -]; diff --git a/app/controllers/.gitkeep b/app/controllers/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php deleted file mode 100644 index fb38a501c0..0000000000 --- a/app/controllers/AccountController.php +++ /dev/null @@ -1,233 +0,0 @@ - ['Default account', 'Asset account'], - 'expense' => ['Expense account', 'Beneficiary account'], - 'revenue' => ['Revenue account'], - ]; - - /** @var AccountRepository */ - protected $_repository; - - /** @var array */ - protected $_shortNamesByFullName - = [ - 'Default account' => 'asset', - 'Asset account' => 'asset', - 'Expense account' => 'expense', - 'Beneficiary account' => 'expense', - 'Revenue account' => 'revenue', - 'Cash account' => 'cash', - ]; - - /** @var array */ - protected $_subIconsByIdentifier - = [ - 'asset' => 'fa-money', - 'Asset account' => 'fa-money', - 'Default account' => 'fa-money', - 'Cash account' => 'fa-money', - 'expense' => 'fa-shopping-cart', - 'Expense account' => 'fa-shopping-cart', - 'Beneficiary account' => 'fa-shopping-cart', - 'revenue' => 'fa-download', - 'Revenue account' => 'fa-download', - ]; - /** @var array */ - protected $_subTitlesByIdentifier - = [ - 'asset' => 'Asset accounts', - 'expense' => 'Expense accounts', - 'revenue' => 'Revenue accounts', - ]; - - /** - * @param AccountRepository $repository - */ - public function __construct(AccountRepository $repository) - { - $this->_repository = $repository; - View::share('mainTitleIcon', 'fa-credit-card'); - View::share('title', 'Accounts'); - } - - /** - * @param $what - * - * @return \Illuminate\View\View - */ - public function create($what) - { - $subTitleIcon = $this->_subIconsByIdentifier[$what]; - $subTitle = 'Create a new ' . e($what) . ' account'; - - return View::make('accounts.create', compact('subTitleIcon', 'what', 'subTitle')); - } - - /** - * @param Account $account - * - * @return $this - */ - public function delete(Account $account) - { - $subTitle = 'Delete ' . strtolower(e($account->accountType->type)) . ' "' . e($account->name) . '"'; - - return View::make('accounts.delete', compact('account', 'subTitle')); - } - - /** - * @param Account $account - * - * @return $this|\Illuminate\Http\RedirectResponse - */ - public function destroy(Account $account) - { - - $type = $account->accountType->type; - $typeName = $this->_shortNamesByFullName[$type]; - $name = $account->name; - - $this->_repository->destroy($account); - - Session::flash('success', 'The ' . e($typeName) . ' account "' . e($name) . '" was deleted.'); - - return Redirect::route('accounts.index', $typeName); - } - - /** - * @param Account $account - * - * @return $this - */ - public function edit(Account $account) - { - - $openingBalance = $this->_repository->openingBalanceTransaction($account); - $subTitleIcon = $this->_subIconsByIdentifier[$account->accountType->type]; - $subTitle = 'Edit ' . strtolower(e($account->accountType->type)) . ' "' . e($account->name) . '"'; - $what = $this->_shortNamesByFullName[$account->accountType->type]; - - // pre fill some useful values. - $preFilled = [ - 'account_role' => $account->getMeta('accountRole'), - 'openingBalanceDate' => $openingBalance ? $openingBalance->date->format('Y-m-d') : null, - 'openingBalance' => $openingBalance ? $openingBalance->getAmount($account) : null - ]; - Session::flash('preFilled', $preFilled); - - return View::make('accounts.edit', compact('account', 'what', 'subTitle', 'openingBalance', 'subTitleIcon')); - } - - /** - * - * @param string $what - * - * @return View - * @throws FireflyException - */ - public function index($what = 'default') - { - $subTitle = $this->_subTitlesByIdentifier[$what]; - $subTitleIcon = $this->_subIconsByIdentifier[$what]; - - $accounts = $this->_repository->getAccountsByType($this->_accountTypesByIdentifier[$what]); - - return View::make('accounts.index', compact('what', 'subTitleIcon', 'subTitle', 'accounts')); - } - - /** - * @param Account $account - * @param string $range - * - * @return $this - */ - public function show(Account $account, $range = 'session') - { - $subTitleIcon = $this->_subIconsByIdentifier[$account->accountType->type]; - $what = $this->_shortNamesByFullName[$account->accountType->type]; - $journals = $this->_repository->getTransactionJournals($account, 50, $range); - $subTitle = 'Details for ' . strtolower(e($account->accountType->type)) . ' "' . e($account->name) . '"'; - - return View::make('accounts.show', compact('account', 'what', 'range', 'subTitleIcon', 'journals', 'subTitle')); - } - - /** - * @return $this|\Illuminate\Http\RedirectResponse - * @throws FireflyException - */ - public function store() - { - $data = Input::except('_token'); - $messages = $this->_repository->validate($data); - - - // flash messages: - Session::flash('successes', $messages['successes']); - Session::flash('errors', $messages['errors']); - if ($messages['errors']->count() > 0) { - Session::flash('error', 'Could not store account: ' . $messages['errors']->first()); - } - - // return to create screen: - if ($data['post_submit_action'] == 'validate_only' || $messages['errors']->count() > 0) { - return Redirect::route('accounts.create', e($data['what']))->withInput(); - } - - // store - $this->_repository->store($data); - Session::flash('success', 'Account "' . e($data['name']) . '" stored.'); - if ($data['post_submit_action'] == 'store') { - return Redirect::route('accounts.index', e($data['what'])); - } - - return Redirect::route('accounts.create', e($data['what']))->withInput(); - } - - /** - * @param Account $account - * - * @return $this - * @throws FireflyException - */ - public function update(Account $account) - { - $data = Input::except('_token'); - $messages = $this->_repository->validate($data); - - // flash messages: - Session::flash('successes', $messages['successes']); - Session::flash('errors', $messages['errors']); - if ($messages['errors']->count() > 0) { - Session::flash('error', 'Could not update account: ' . $messages['errors']->first()); - } - - // return to update screen: - if ($data['post_submit_action'] == 'validate_only' || $messages['errors']->count() > 0) { - return Redirect::route('accounts.edit', $account->id)->withInput(); - } - - // update - $this->_repository->update($account, $data); - Session::flash('success', 'Account "' . e($data['name']) . '" updated.'); - - // go back to list - if ($data['post_submit_action'] == 'update') { - return Redirect::route('accounts.index', e($data['what'])); - } - - // go back to update screen. - return Redirect::route('accounts.edit', $account->id)->withInput(['post_submit_action' => 'return_to_edit']); - } -} diff --git a/app/controllers/BaseController.php b/app/controllers/BaseController.php deleted file mode 100644 index df09e3091d..0000000000 --- a/app/controllers/BaseController.php +++ /dev/null @@ -1,30 +0,0 @@ -layout)) { - $this->layout = View::make($this->layout); - } - } - -} diff --git a/app/controllers/BillController.php b/app/controllers/BillController.php deleted file mode 100644 index 0fdd0f7309..0000000000 --- a/app/controllers/BillController.php +++ /dev/null @@ -1,215 +0,0 @@ -_repository = $repository; - - View::share('title', 'Bills'); - View::share('mainTitleIcon', 'fa-calendar-o'); - } - - /** - * @return $this - */ - public function create() - { - $periods = \Config::get('firefly.periods_to_text'); - - return View::make('bills.create')->with('periods', $periods)->with('subTitle', 'Create new'); - } - - /** - * @param Bill $bill - * - * @return $this - */ - public function delete(Bill $bill) - { - return View::make('bills.delete')->with('bill', $bill)->with( - 'subTitle', 'Delete "' . e($bill->name) . '"' - ); - } - - /** - * @param Bill $bill - * - * @return \Illuminate\Http\RedirectResponse - */ - public function destroy(Bill $bill) - { - $this->_repository->destroy($bill); - Session::flash('success', 'The bill was deleted.'); - - return Redirect::route('bills.index'); - - } - - /** - * @param Bill $bill - * - * @return $this - */ - public function edit(Bill $bill) - { - $periods = \Config::get('firefly.periods_to_text'); - - return View::make('bills.edit')->with('periods', $periods)->with('bill', $bill)->with( - 'subTitle', 'Edit "' . e($bill->name) . '"' - ); - } - - /** - * @return $this - */ - public function index() - { - $bills = $this->_repository->get(); - $bills->each( - function (Bill $bill) { - $bill->nextExpectedMatch = $this->_repository->nextExpectedMatch($bill); - $bill->lastFoundMatch = $this->_repository->lastFoundMatch($bill); - } - ); - - return View::make('bills.index', compact('bills')); - } - - /** - * @param Bill $bill - * - * @return mixed - */ - public function rescan(Bill $bill) - { - if (intval($bill->active) == 0) { - Session::flash('warning', 'Inactive bills cannot be scanned.'); - - return Redirect::intended('/'); - } - - $this->_repository->scanEverything($bill); - - Session::flash('success', 'Rescanned everything.'); - - return Redirect::intended('/'); - } - - /** - * @param Bill $bill - * - * @return mixed - */ - public function show(Bill $bill) - { - $journals = $bill->transactionjournals()->withRelevantData()->orderBy('date', 'DESC')->get(); - $bill->nextExpectedMatch = $this->_repository->nextExpectedMatch($bill); - $hideBill = true; - - - return View::make('bills.show', compact('journals', 'hideBill', 'bill'))->with( - 'subTitle', e($bill->name) - ); - } - - /** - * @return $this - * @throws FireflyException - */ - public function store() - { - $data = Input::except(['_token', 'post_submit_action']); - $data['user_id'] = Auth::user()->id; - - - // always validate: - $messages = $this->_repository->validate($data); - - // flash messages: - Session::flash('warnings', $messages['warnings']); - Session::flash('successes', $messages['successes']); - Session::flash('errors', $messages['errors']); - if ($messages['errors']->count() > 0) { - Session::flash('error', 'Could not store bill: ' . $messages['errors']->first()); - - return Redirect::route('bills.create')->withInput(); - } - - // return to create screen: - if (Input::get('post_submit_action') == 'validate_only') { - return Redirect::route('bills.create')->withInput(); - } - - // store - $this->_repository->store($data); - Session::flash('success', 'Bill "' . e($data['name']) . '" stored.'); - if (Input::get('post_submit_action') == 'store') { - return Redirect::route('bills.index'); - } - - return Redirect::route('bills.create')->withInput(); - - } - - /** - * @param Bill $bill - * - * @return $this - * @throws FireflyException - */ - public function update(Bill $bill) - { - $data = Input::except('_token'); - $data['active'] = intval(Input::get('active')); - $data['automatch'] = intval(Input::get('automatch')); - $data['user_id'] = Auth::user()->id; - - // always validate: - $messages = $this->_repository->validate($data); - - // flash messages: - Session::flash('warnings', $messages['warnings']); - Session::flash('successes', $messages['successes']); - Session::flash('errors', $messages['errors']); - if ($messages['errors']->count() > 0) { - Session::flash('error', 'Could not update bill: ' . $messages['errors']->first()); - - return Redirect::route('bills.edit', $bill->id)->withInput(); - } - - // return to update screen: - if ($data['post_submit_action'] == 'validate_only') { - return Redirect::route('bills.edit', $bill->id)->withInput(); - } - - // update - $this->_repository->update($bill, $data); - Session::flash('success', 'Bill "' . e($data['name']) . '" updated.'); - - // go back to list - if ($data['post_submit_action'] == 'update') { - return Redirect::route('bills.index'); - } - - // go back to update screen. - return Redirect::route('bills.edit', $bill->id)->withInput(['post_submit_action' => 'return_to_edit']); - - } -} diff --git a/app/controllers/BudgetController.php b/app/controllers/BudgetController.php deleted file mode 100644 index 5a42967adc..0000000000 --- a/app/controllers/BudgetController.php +++ /dev/null @@ -1,254 +0,0 @@ -_repository = $repository; - $this->_preferences = $preferences; - View::share('title', 'Budgets'); - View::share('mainTitleIcon', 'fa-tasks'); - } - - /** - * @param Budget $budget - * - * @return \Illuminate\Http\JsonResponse - * @throws Exception - */ - public function amount(Budget $budget) - { - $amount = intval(Input::get('amount')); - $date = Session::get('start', Carbon::now()->startOfMonth()); - $limitRepetition = $this->_repository->updateLimitAmount($budget, $date, $amount); - - return Response::json(['name' => $budget->name, 'repetition' => $limitRepetition ? $limitRepetition->id : 0]); - - } - - /** - * @return $this - */ - public function create() - { - return View::make('budgets.create')->with('subTitle', 'Create a new budget'); - } - - /** - * @param Budget $budget - * - * @return $this - */ - public function delete(Budget $budget) - { - $subTitle = 'Delete budget "' . e($budget->name) . '"'; - - return View::make('budgets.delete', compact('budget', 'subTitle')); - } - - /** - * @param Budget $budget - * - * @return \Illuminate\Http\RedirectResponse - */ - public function destroy(Budget $budget) - { - Session::flash('success', 'Budget "' . e($budget->name) . '" was deleted.'); - $this->_repository->destroy($budget); - - - return Redirect::route('budgets.index'); - - } - - /** - * @param Budget $budget - * - * @return $this - */ - public function edit(Budget $budget) - { - $subTitle = 'Edit budget "' . e($budget->name) . '"'; - - return View::make('budgets.edit', compact('budget', 'subTitle')); - - } - - /** - * The index of the budget controller contains all budgets and the current relevant limit repetition. - * - * @return $this - */ - public function index() - { - $budgets = $this->_repository->get(); - - // loop the budgets: - $budgets->each( - function (Budget $budget) { - $budget->spent = $this->_repository->spentInMonth($budget, \Session::get('start', Carbon::now()->startOfMonth())); - $budget->currentRep = $this->_repository->getRepetitionByDate($budget, \Session::get('start', Carbon::now()->startOfMonth())); - } - ); - - $spent = $budgets->sum('spent'); - $amount = $this->_preferences->get('budgetIncomeTotal' . \Session::get('start', Carbon::now()->startOfMonth())->format('FY'), 1000)->data; - $overspent = $spent > $amount; - $spentPCT = $overspent ? ceil($amount / $spent * 100) : ceil($spent / $amount * 100); - $budgetMax = $this->_preferences->get('budgetMaximum', 1000); - $budgetMaximum = $budgetMax->data; - - return View::make('budgets.index', compact('budgetMaximum', 'budgets', 'spent', 'spentPCT', 'overspent', 'amount')); - } - - /** - * @return \Illuminate\View\View - */ - public function noBudget() - { - $start = \Session::get('start', Carbon::now()->startOfMonth()); - $end = \Session::get('end', Carbon::now()->startOfMonth()); - $list = $this->_repository->journalsNoBudget($start, $end); - $subTitle = 'Transactions without a budget in ' . $start->format('F Y'); - - return View::make('budgets.noBudget', compact('list', 'subTitle')); - } - - /** - * @return \Illuminate\Http\RedirectResponse - */ - public function postUpdateIncome() - { - $this->_preferences->set('budgetIncomeTotal' . Session::get('start', Carbon::now()->startOfMonth())->format('FY'), intval(Input::get('amount'))); - - return Redirect::route('budgets.index'); - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - * - * @param Budget $budget - * @param LimitRepetition $repetition - * - * @return \Illuminate\View\View - */ - public function show(Budget $budget, LimitRepetition $repetition = null) - { - if (!is_null($repetition) && $repetition->budgetLimit->budget->id != $budget->id) { - return View::make('error')->with('message', 'Invalid selection.'); - } - - $hideBudget = true; // used in transaction list. - $journals = $this->_repository->getJournals($budget, $repetition); - $limits = $repetition ? [$repetition->budgetLimit] : $budget->budgetLimits()->orderBy('startdate', 'DESC')->get(); - $subTitle = $repetition ? e($budget->name) . ' in ' . $repetition->startdate->format('F Y') : e($budget->name); - - return View::make('budgets.show', compact('limits', 'budget', 'repetition', 'journals', 'subTitle', 'hideBudget')); - } - - /** - * @return $this|\Illuminate\Http\RedirectResponse - */ - public function store() - { - $data = Input::except('_token'); - $data['user_id'] = Auth::user()->id; - - // always validate: - $messages = $this->_repository->validate($data); - - // flash messages: - Session::flash('warnings', $messages['warnings']); - Session::flash('successes', $messages['successes']); - Session::flash('errors', $messages['errors']); - if ($messages['errors']->count() > 0) { - Session::flash('error', 'Could not validate budget: ' . $messages['errors']->first()); - return Redirect::route('budgets.create')->withInput(); - } - - // return to create screen: - if ($data['post_submit_action'] == 'validate_only') { - return Redirect::route('budgets.create')->withInput(); - } - - // store - $this->_repository->store($data); - Session::flash('success', 'Budget "' . e($data['name']) . '" stored.'); - if ($data['post_submit_action'] == 'store') { - return Redirect::route('budgets.index'); - } - - // create another. - return Redirect::route('budgets.create')->withInput(); - } - - /** - * @param Budget $budget - * - * @return $this|\Illuminate\Http\RedirectResponse - */ - public function update(Budget $budget) - { - - $data = Input::except('_token'); - $data['user_id'] = Auth::user()->id; - - // always validate: - $messages = $this->_repository->validate($data); - - // flash messages: - Session::flash('warnings', $messages['warnings']); - Session::flash('successes', $messages['successes']); - Session::flash('errors', $messages['errors']); - if ($messages['errors']->count() > 0) { - Session::flash('error', 'Could not update budget: ' . $messages['errors']->first()); - return Redirect::route('budgets.edit', $budget->id)->withInput(); - } - - // return to update screen: - if ($data['post_submit_action'] == 'validate_only') { - return Redirect::route('budgets.edit', $budget->id)->withInput(); - } - - // update - $this->_repository->update($budget, $data); - Session::flash('success', 'Budget "' . e($data['name']) . '" updated.'); - - // go back to list - if ($data['post_submit_action'] == 'update') { - return Redirect::route('budgets.index'); - } - - return Redirect::route('budgets.edit', $budget->id)->withInput(['post_submit_action' => 'return_to_edit']); - } - - /** - * @return $this - */ - public function updateIncome() - { - $budgetAmount = $this->_preferences->get('budgetIncomeTotal' . Session::get('start', Carbon::now()->startOfMonth())->format('FY'), 1000); - - return View::make('budgets.income')->with('amount', $budgetAmount); - } -} diff --git a/app/controllers/CategoryController.php b/app/controllers/CategoryController.php deleted file mode 100644 index bc5d0846f1..0000000000 --- a/app/controllers/CategoryController.php +++ /dev/null @@ -1,189 +0,0 @@ -_repository = $repository; - } - - /** - * @return \Illuminate\View\View - */ - public function create() - { - return View::make('categories.create')->with('subTitle', 'Create a new category'); - } - - /** - * @return \Illuminate\View\View - */ - public function noCategory() - { - $start = \Session::get('start', Carbon::now()->startOfMonth()); - $end = \Session::get('end', Carbon::now()->startOfMonth()); - $list = $this->_repository->journalsNoCategory($start, $end); - $subTitle = 'Transactions without a category in ' . $start->format('F Y'); - - return View::make('categories.noCategory', compact('list', 'subTitle')); - } - - /** - * @param Category $category - * - * @return $this - */ - public function delete(Category $category) - { - return View::make('categories.delete')->with('category', $category)->with('subTitle', 'Delete category "' . e($category->name) . '"'); - } - - /** - * @param Category $category - * - * @return \Illuminate\Http\RedirectResponse - */ - public function destroy(Category $category) - { - Session::flash('success', 'Category "' . e($category->name) . '" was deleted.'); - $this->_repository->destroy($category); - - - return Redirect::route('categories.index'); - } - - /** - * @param Category $category - * - * @return $this - */ - public function edit(Category $category) - { - return View::make('categories.edit')->with('category', $category)->with('subTitle', 'Edit category "' . e($category->name) . '"'); - } - - /** - * @return $this - */ - public function index() - { - $categories = $this->_repository->get(); - - return View::make('categories.index', compact('categories')); - } - - /** - * @param Category $category - * - * @return $this - */ - public function show(Category $category) - { - $hideCategory = true; // used in list. - $journals = $this->_repository->getTransactionJournals($category, 50); - - return View::make('categories.show', compact('category', 'journals', 'hideCategory')); - } - - /** - * - * @return $this - * @throws FireflyException - */ - public function store() - { - $data = Input::except('_token'); - $data['user_id'] = Auth::user()->id; - - // always validate: - $messages = $this->_repository->validate($data); - - // flash messages: - Session::flash('warnings', $messages['warnings']); - Session::flash('successes', $messages['successes']); - Session::flash('errors', $messages['errors']); - if ($messages['errors']->count() > 0) { - Session::flash('error', 'Could not store category: ' . $messages['errors']->first()); - return Redirect::route('categories.create')->withInput(); - } - - // return to create screen: - if ($data['post_submit_action'] == 'validate_only') { - return Redirect::route('categories.create')->withInput(); - } - - // store - $this->_repository->store($data); - Session::flash('success', 'Category "' . e($data['name']) . '" stored.'); - if ($data['post_submit_action'] == 'store') { - return Redirect::route('categories.index'); - } - - return Redirect::route('categories.create')->withInput(); - } - - /** - * - * @param Category $category - * - * @return $this - * @throws FireflyException - */ - public function update(Category $category) - { - $data = Input::except('_token'); - $data['user_id'] = Auth::user()->id; - - // always validate: - $messages = $this->_repository->validate($data); - - // flash messages: - Session::flash('warnings', $messages['warnings']); - Session::flash('successes', $messages['successes']); - Session::flash('errors', $messages['errors']); - if ($messages['errors']->count() > 0) { - Session::flash('error', 'Could not update category: ' . $messages['errors']->first()); - return Redirect::route('categories.edit', $category->id)->withInput(); - } - - // return to update screen: - if ($data['post_submit_action'] == 'validate_only') { - return Redirect::route('categories.edit', $category->id)->withInput(); - } - - // update - $this->_repository->update($category, $data); - Session::flash('success', 'Category "' . e($data['name']) . '" updated.'); - - // go back to list - if ($data['post_submit_action'] == 'update') { - return Redirect::route('categories.index'); - } - - // go back to update screen. - return Redirect::route('categories.edit', $category->id)->withInput(['post_submit_action' => 'return_to_edit']); - - - } - - -} diff --git a/app/controllers/CurrencyController.php b/app/controllers/CurrencyController.php deleted file mode 100644 index 9b55132333..0000000000 --- a/app/controllers/CurrencyController.php +++ /dev/null @@ -1,199 +0,0 @@ -_repository = $repository; - - - View::share('title', 'Currencies'); - View::share('mainTitleIcon', 'fa-usd'); - } - - /** - * @return \Illuminate\View\View - */ - public function create() - { - $subTitleIcon = 'fa-plus'; - $subTitle = 'Create a new currency'; - - return View::make('currency.create', compact('subTitleIcon', 'subTitle')); - } - - /** - * @param TransactionCurrency $currency - * - * @return \Illuminate\Http\RedirectResponse - */ - public function defaultCurrency(TransactionCurrency $currency) - { - /** @var \FireflyIII\Shared\Preferences\Preferences $preferences */ - $preferences = App::make('FireflyIII\Shared\Preferences\Preferences'); - - $currencyPreference = $preferences->get('currencyPreference', 'EUR'); - $currencyPreference->data = $currency->code; - $currencyPreference->save(); - - Session::flash('success', $currency->name.' is now the default currency.'); - Cache::forget('FFCURRENCYSYMBOL'); - Cache::forget('FFCURRENCYCODE'); - - return Redirect::route('currency.index'); - - } - - /** - * @param TransactionCurrency $currency - * - * @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View - */ - public function delete(TransactionCurrency $currency) - { - if ($currency->transactionJournals()->count() > 0) { - Session::flash('error', 'Cannot delete ' . e($currency->name) . ' because there are still transactions attached to it.'); - - return Redirect::route('currency.index'); - } - - - return View::make('currency.delete', compact('currency')); - } - - /** - * @param TransactionCurrency $currency - * - * @return \Illuminate\Http\RedirectResponse - */ - public function destroy(TransactionCurrency $currency) - { - Session::flash('success', 'Currency "' . e($currency->name) . '" deleted'); - - $this->_repository->destroy($currency); - - return Redirect::route('currency.index'); - } - - /** - * @param TransactionCurrency $currency - * - * @return \Illuminate\View\View - */ - public function edit(TransactionCurrency $currency) - { - $subTitleIcon = 'fa-pencil'; - $subTitle = 'Edit currency "' . e($currency->name) . '"'; - $currency->symbol = htmlentities($currency->symbol); - - return View::make('currency.edit', compact('currency', 'subTitle', 'subTitleIcon')); - - } - - /** - * @return \Illuminate\View\View - */ - public function index() - { - $currencies = $this->_repository->get(); - - /** @var \FireflyIII\Shared\Preferences\Preferences $preferences */ - $preferences = App::make('FireflyIII\Shared\Preferences\Preferences'); - - $currencyPreference = $preferences->get('currencyPreference', 'EUR'); - $defaultCurrency = $this->_repository->findByCode($currencyPreference->data); - - - return View::make('currency.index', compact('currencies', 'defaultCurrency')); - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - * - * @return $this|\Illuminate\Http\RedirectResponse - */ - public function store() - { - $data = Input::except('_token'); - - // always validate: - $messages = $this->_repository->validate($data); - - // flash messages: - Session::flash('warnings', $messages['warnings']); - Session::flash('successes', $messages['successes']); - Session::flash('errors', $messages['errors']); - if ($messages['errors']->count() > 0) { - Session::flash('error', 'Could not store currency: ' . $messages['errors']->first()); - } - - // return to create screen: - if ($data['post_submit_action'] == 'validate_only' || $messages['errors']->count() > 0) { - return Redirect::route('currency.create')->withInput(); - } - - // store - $this->_repository->store($data); - Session::flash('success', 'Currency "' . e($data['name']) . '" stored.'); - if ($data['post_submit_action'] == 'store') { - return Redirect::route('currency.index'); - } - - return Redirect::route('currency.create')->withInput(); - - } - - /** - * @param TransactionCurrency $currency - * - * @return $this|\Illuminate\Http\RedirectResponse - */ - public function update(TransactionCurrency $currency) - { - $data = Input::except('_token'); - - // always validate: - $messages = $this->_repository->validate($data); - - // flash messages: - Session::flash('warnings', $messages['warnings']); - Session::flash('successes', $messages['successes']); - Session::flash('errors', $messages['errors']); - if ($messages['errors']->count() > 0) { - Session::flash('error', 'Could not update currency: ' . $messages['errors']->first()); - return Redirect::route('currency.edit', $currency->id)->withInput(); - } - - // return to update screen: - if ($data['post_submit_action'] == 'validate_only') { - return Redirect::route('currency.edit', $currency->id)->withInput(); - } - - // update - $this->_repository->update($currency, $data); - Session::flash('success', 'Currency "' . e($data['name']) . '" updated.'); - - // go back to list - if ($data['post_submit_action'] == 'update') { - return Redirect::route('currency.index'); - } - - return Redirect::route('currency.edit', $currency->id)->withInput(['post_submit_action' => 'return_to_edit']); - - } - -} diff --git a/app/controllers/GoogleChartController.php b/app/controllers/GoogleChartController.php deleted file mode 100644 index 4e882653b1..0000000000 --- a/app/controllers/GoogleChartController.php +++ /dev/null @@ -1,537 +0,0 @@ -_chart = $chart; - $this->_repository = $repository; - $this->_start = Session::get('start', Carbon::now()->startOfMonth()); - $this->_end = Session::get('end', Carbon::now()->endOfMonth()); - - } - - /** - * @param Account $account - * @param string $view - * - * @return \Illuminate\Http\JsonResponse - */ - public function accountBalanceChart(Account $account, $view = 'session') - { - $this->_chart->addColumn('Day of month', 'date'); - $this->_chart->addColumn('Balance for ' . $account->name, 'number'); - $this->_chart->addCertainty(1); - - $start = $this->_start; - $end = $this->_end; - $count = $account->transactions()->count(); - - if ($view == 'all' && $count > 0) { - $first = $account->transactions()->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')->orderBy( - 'date', 'ASC' - )->first(['transaction_journals.date']); - $last = $account->transactions()->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')->orderBy( - 'date', 'DESC' - )->first(['transaction_journals.date']); - $start = new Carbon($first->date); - $end = new Carbon($last->date); - } - - $current = clone $start; - - while ($end >= $current) { - $this->_chart->addRow(clone $current, Steam::balance($account, $current), false); - $current->addDay(); - } - - - $this->_chart->generate(); - - return Response::json($this->_chart->getData()); - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - */ - public function allAccountsBalanceChart() - { - $this->_chart->addColumn('Day of the month', 'date'); - - /** @var \FireflyIII\Shared\Preferences\Preferences $preferences */ - $preferences = App::make('FireflyIII\Shared\Preferences\Preferences'); - $pref = $preferences->get('frontPageAccounts', []); - - /** @var \FireflyIII\Database\Account\Account $acct */ - $acct = App::make('FireflyIII\Database\Account\Account'); - $accounts = count($pref->data) > 0 ? $acct->getByIds($pref->data) : $acct->getAccountsByType(['Default account', 'Asset account']); - - $index = 1; - /** @var Account $account */ - foreach ($accounts as $account) { - $this->_chart->addColumn('Balance for ' . $account->name, 'number'); - $this->_chart->addCertainty($index); - $index++; - } - $current = clone $this->_start; - $current->subDay(); - $today = Carbon::now(); - while ($this->_end >= $current) { - $row = [clone $current]; - $certain = $current < $today; - foreach ($accounts as $account) { - - $row[] = Steam::balance($account, $current); - $row[] = $certain; - } - $this->_chart->addRowArray($row); - $current->addDay(); - } - - $this->_chart->generate(); - - return Response::json($this->_chart->getData()); - - } - - /** - * @param int $year - * - * @return $this|\Illuminate\Http\JsonResponse - */ - public function allBudgetsAndSpending($year) - { - try { - new Carbon('01-01-' . $year); - } catch (Exception $e) { - return View::make('error')->with('message', 'Invalid year.'); - } - /** @var \FireflyIII\Database\Budget\Budget $budgetRepository */ - $budgetRepository = App::make('FireflyIII\Database\Budget\Budget'); - $budgets = $budgetRepository->get(); - $budgets->sortBy('name'); - $this->_chart->addColumn('Month', 'date'); - foreach ($budgets as $budget) { - $this->_chart->addColumn($budget->name, 'number'); - } - $start = Carbon::createFromDate(intval($year), 1, 1); - $end = clone $start; - $end->endOfYear(); - - - while ($start <= $end) { - $row = [clone $start]; - foreach ($budgets as $budget) { - $spent = $budgetRepository->spentInMonth($budget, $start); - //$repetition = $budgetRepository->repetitionOnStartingOnDate($budget, $start); - $row[] = $spent; - } - $this->_chart->addRowArray($row); - $start->addMonth(); - } - - - $this->_chart->generate(); - - return Response::json($this->_chart->getData()); - - } - - /** - * @return \Illuminate\Http\JsonResponse - */ - public function allBudgetsHomeChart() - { - $this->_chart->addColumn('Budget', 'string'); - $this->_chart->addColumn('Budgeted', 'number'); - $this->_chart->addColumn('Spent', 'number'); - - /** @var \FireflyIII\Database\Budget\Budget $bdt */ - $bdt = App::make('FireflyIII\Database\Budget\Budget'); - $budgets = $bdt->get(); - - /** @var Budget $budget */ - foreach ($budgets as $budget) { - - /** @var \LimitRepetition $repetition */ - $repetition = $bdt->repetitionOnStartingOnDate($budget, $this->_start); - if (is_null($repetition)) { // use the session start and end for our search query - $searchStart = $this->_start; - $searchEnd = $this->_end; - $limit = 0; // the limit is zero: - } else { - // use the limit's start and end for our search query - $searchStart = $repetition->startdate; - $searchEnd = $repetition->enddate; - $limit = floatval($repetition->amount); // the limit is the repetitions limit: - } - - $expenses = floatval($budget->transactionjournals()->before($searchEnd)->after($searchStart)->lessThan(0)->sum('amount')) * -1; - if ($expenses > 0) { - $this->_chart->addRow($budget->name, $limit, $expenses); - } - } - - $noBudgetSet = $bdt->expenseNoBudget($this->_start, $this->_end); - $sum = $noBudgetSet->sum('amount') * -1; - $this->_chart->addRow('No budget', 0, $sum); - $this->_chart->generate(); - - return Response::json($this->_chart->getData()); - } - - /** - * @return \Illuminate\Http\JsonResponse - */ - public function allCategoriesHomeChart() - { - $this->_chart->addColumn('Category', 'string'); - $this->_chart->addColumn('Spent', 'number'); - - // query! - $set = $this->_repository->getCategorySummary($this->_start, $this->_end); - - foreach ($set as $entry) { - $entry->name = strlen($entry->name) == 0 ? '(no category)' : $entry->name; - $this->_chart->addRow($entry->name, floatval($entry->sum)); - } - - $this->_chart->generate(); - - return Response::json($this->_chart->getData()); - - } - - /** - * @param Bill $bill - * - * @return \Illuminate\Http\JsonResponse - */ - public function billOverview(Bill $bill) - { - - $this->_chart->addColumn('Date', 'date'); - $this->_chart->addColumn('Max amount', 'number'); - $this->_chart->addColumn('Min amount', 'number'); - $this->_chart->addColumn('Current entry', 'number'); - - // get first transaction or today for start: - $first = $bill->transactionjournals()->orderBy('date', 'ASC')->first(); - if ($first) { - $start = $first->date; - } else { - $start = new Carbon; - } - $end = new Carbon; - while ($start <= $end) { - $result = $bill->transactionjournals()->before($end)->after($start)->first(); - if ($result) { - $amount = $result->getAmount(); - } else { - $amount = 0; - } - unset($result); - $this->_chart->addRow(clone $start, $bill->amount_max, $bill->amount_min, $amount); - $start = DateKit::addPeriod($start, $bill->repeat_freq, 0); - } - - $this->_chart->generate(); - - return Response::json($this->_chart->getData()); - - } - - /** - * - * @return \Illuminate\Http\JsonResponse - * @throws \FireflyIII\Exception\FireflyException - */ - public function billsOverview() - { - $paid = ['items' => [], 'amount' => 0]; - $unpaid = ['items' => [], 'amount' => 0]; - $this->_chart->addColumn('Name', 'string'); - $this->_chart->addColumn('Amount', 'number'); - - $set = $this->_repository->getBillsSummary($this->_start, $this->_end); - - foreach ($set as $entry) { - if (intval($entry->journalId) == 0) { - $unpaid['items'][] = $entry->name; - $unpaid['amount'] += floatval($entry->averageAmount); - } else { - $description = intval($entry->encrypted) == 1 ? Crypt::decrypt($entry->description) : $entry->description; - $paid['items'][] = $description; - $paid['amount'] += floatval($entry->actualAmount); - } - } - $this->_chart->addRow('Unpaid: ' . join(', ', $unpaid['items']), $unpaid['amount']); - $this->_chart->addRow('Paid: ' . join(', ', $paid['items']), $paid['amount']); - $this->_chart->generate(); - - return Response::json($this->_chart->getData()); - } - - /** - * - * @param Budget $budget - * @param LimitRepetition $repetition - * - * @return \Illuminate\Http\JsonResponse - */ - public function budgetLimitSpending(\Budget $budget, \LimitRepetition $repetition) - { - $start = clone $repetition->startdate; - $end = $repetition->enddate; - - $this->_chart->addColumn('Day', 'date'); - $this->_chart->addColumn('Left', 'number'); - - - $amount = $repetition->amount; - - while ($start <= $end) { - /* - * Sum of expenses on this day: - */ - $sum = floatval($budget->transactionjournals()->lessThan(0)->transactionTypes(['Withdrawal'])->onDate($start)->sum('amount')); - $amount += $sum; - $this->_chart->addRow(clone $start, $amount); - $start->addDay(); - } - $this->_chart->generate(); - - return Response::json($this->_chart->getData()); - - } - - /** - * - * @param Budget $budget - * - * @param int $year - * - * @return \Illuminate\Http\JsonResponse - */ - public function budgetsAndSpending(Budget $budget, $year = 0) - { - /** @var \FireflyIII\Database\Budget\Budget $budgetRepository */ - $budgetRepository = App::make('FireflyIII\Database\Budget\Budget'); - - $this->_chart->addColumn('Month', 'date'); - $this->_chart->addColumn('Budgeted', 'number'); - $this->_chart->addColumn('Spent', 'number'); - if ($year == 0) { - // grab the first budgetlimit ever: - $firstLimit = $budget->budgetlimits()->orderBy('startdate', 'ASC')->first(); - if ($firstLimit) { - $start = new Carbon($firstLimit->startdate); - } else { - $start = Carbon::now()->startOfYear(); - } - - // grab the last budget limit ever: - $lastLimit = $budget->budgetlimits()->orderBy('startdate', 'DESC')->first(); - if ($lastLimit) { - $end = new Carbon($lastLimit->startdate); - } else { - $end = Carbon::now()->endOfYear(); - } - } else { - $start = Carbon::createFromDate(intval($year), 1, 1); - $end = clone $start; - $end->endOfYear(); - } - - while ($start <= $end) { - $spent = $budgetRepository->spentInMonth($budget, $start); - $repetition = $budgetRepository->repetitionOnStartingOnDate($budget, $start); - - if ($repetition) { - $budgeted = floatval($repetition->amount); - \Log::debug('Found a repetition on ' . $start->format('Y-m-d') . ' for budget ' . $budget->name . '!'); - } else { - \Log::debug('No repetition on ' . $start->format('Y-m-d') . ' for budget ' . $budget->name); - $budgeted = null; - } - $this->_chart->addRow(clone $start, $budgeted, $spent); - $start->addMonth(); - } - - $this->_chart->generate(); - - return Response::json($this->_chart->getData()); - - - } - - /** - * - * @param Category $component - * @param $year - * - * @return \Illuminate\Http\JsonResponse - */ - public function categoriesAndSpending(Category $component, $year) - { - try { - new Carbon('01-01-' . $year); - } catch (Exception $e) { - return View::make('error')->with('message', 'Invalid year.'); - } - - /** @var \FireflyIII\Database\Category\Category $categoryRepository */ - $categoryRepository = App::make('FireflyIII\Database\Category\Category'); - - $this->_chart->addColumn('Month', 'date'); - $this->_chart->addColumn('Budgeted', 'number'); - $this->_chart->addColumn('Spent', 'number'); - - $start = new Carbon('01-01-' . $year); - $end = clone $start; - $end->endOfYear(); - while ($start <= $end) { - - $spent = $categoryRepository->spentInMonth($component, $start); - $budgeted = null; - - $this->_chart->addRow(clone $start, $budgeted, $spent); - - $start->addMonth(); - } - - - $this->_chart->generate(); - - return Response::json($this->_chart->getData()); - - - } - - /** - * @param PiggyBank $piggyBank - * - * @return \Illuminate\Http\JsonResponse - */ - public function piggyBankHistory(\PiggyBank $piggyBank) - { - $this->_chart->addColumn('Date', 'date'); - $this->_chart->addColumn('Balance', 'number'); - - $set = \DB::table('piggy_bank_events')->where('piggy_bank_id', $piggyBank->id)->groupBy('date')->get(['date', DB::Raw('SUM(`amount`) AS `sum`')]); - - foreach ($set as $entry) { - $this->_chart->addRow(new Carbon($entry->date), floatval($entry->sum)); - } - - $this->_chart->generate(); - - return Response::json($this->_chart->getData()); - - } - - /** - * - * @param $year - * - * @return \Illuminate\Http\JsonResponse - */ - public function yearInExp($year) - { - try { - $start = new Carbon('01-01-' . $year); - } catch (Exception $e) { - return View::make('error')->with('message', 'Invalid year.'); - } - $this->_chart->addColumn('Month', 'date'); - $this->_chart->addColumn('Income', 'number'); - $this->_chart->addColumn('Expenses', 'number'); - - /** @var \FireflyIII\Database\TransactionJournal\TransactionJournal $repository */ - $repository = App::make('FireflyIII\Database\TransactionJournal\TransactionJournal'); - - $end = clone $start; - $end->endOfYear(); - while ($start < $end) { - - // total income: - $income = $repository->getSumOfIncomesByMonth($start); - $expense = $repository->getSumOfExpensesByMonth($start); - - $this->_chart->addRow(clone $start, $income, $expense); - $start->addMonth(); - } - - - $this->_chart->generate(); - - return Response::json($this->_chart->getData()); - - } - - /** - * - * @param $year - * - * @return \Illuminate\Http\JsonResponse - */ - public function yearInExpSum($year) - { - try { - $start = new Carbon('01-01-' . $year); - } catch (Exception $e) { - return View::make('error')->with('message', 'Invalid year.'); - } - $this->_chart->addColumn('Summary', 'string'); - $this->_chart->addColumn('Income', 'number'); - $this->_chart->addColumn('Expenses', 'number'); - - /** @var \FireflyIII\Database\TransactionJournal\TransactionJournal $repository */ - $repository = App::make('FireflyIII\Database\TransactionJournal\TransactionJournal'); - - $end = clone $start; - $end->endOfYear(); - $income = 0; - $expense = 0; - $count = 0; - while ($start < $end) { - - // total income: - $income += $repository->getSumOfIncomesByMonth($start); - $expense += $repository->getSumOfExpensesByMonth($start); - $count++; - - $start->addMonth(); - } - $this->_chart->addRow('Sum', $income, $expense); - $count = $count > 0 ? $count : 1; - $this->_chart->addRow('Average', ($income / $count), ($expense / $count)); - - - $this->_chart->generate(); - - return Response::json($this->_chart->getData()); - - } -} diff --git a/app/controllers/HelpController.php b/app/controllers/HelpController.php deleted file mode 100644 index dbb9f7a2aa..0000000000 --- a/app/controllers/HelpController.php +++ /dev/null @@ -1,84 +0,0 @@ - '

There is no help for this route!

', - 'title' => 'Help', - ]; - - if (!Route::has($route)) { - \Log::error('No such route: ' . $route); - - return Response::json($content); - } - - if ($this->_inCache($route)) { - $content = [ - 'text' => Cache::get('help.' . $route . '.text'), - 'title' => Cache::get('help.' . $route . '.title'), - ]; - - return Response::json($content); - } - $content = $this->_getFromGithub($route); - - - Cache::put('help.' . $route . '.text', $content['text'], 10080); // a week. - Cache::put('help.' . $route . '.title', $content['title'], 10080); - - return Response::json($content); - - } - - /** - * @param $route - * - * @return bool - */ - protected function _inCache($route) - { - return Cache::has('help.' . $route . '.title') && Cache::has('help.' . $route . '.text'); - } - - /** - * @param $route - * - * @return array - */ - protected function _getFromGithub($route) - { - $uri = 'https://raw.githubusercontent.com/JC5/firefly-iii-help/master/' . e($route) . '.md'; - $content = [ - 'text' => '

There is no help for this route!

', - 'title' => $route, - ]; - try { - $content['text'] = file_get_contents($uri); - } catch (ErrorException $e) { - \Log::error(trim($e->getMessage())); - } - if (strlen(trim($content['text'])) == 0) { - $content['text'] = '

There is no help for this route.

'; - } - $content['text'] = \Michelf\Markdown::defaultTransform($content['text']); - - return $content; - - - } -} - diff --git a/app/controllers/HomeController.php b/app/controllers/HomeController.php deleted file mode 100644 index b9e15a285a..0000000000 --- a/app/controllers/HomeController.php +++ /dev/null @@ -1,101 +0,0 @@ -countAccountsByType(['Default account', 'Asset account']); - - $start = Session::get('start', Carbon::now()->startOfMonth()); - $end = Session::get('end', Carbon::now()->endOfMonth()); - - - // get the preference for the home accounts to show: - $frontPage = $preferences->get('frontPageAccounts', []); - if ($frontPage->data == []) { - $accounts = $acct->getAccountsByType(['Default account', 'Asset account']); - } else { - $accounts = $acct->getByIds($frontPage->data); - } - - $transactions = []; - foreach ($accounts as $account) { - $set = $journalRepository->getInDateRangeAccount($account, $start, $end, 10); - if (count($set) > 0) { - $transactions[] = [$set, $account]; - } - } - - // build the home screen: - return View::make('index')->with('count', $count)->with('transactions', $transactions)->with('title', 'Firefly')->with('subTitle', 'What\'s playing?') - ->with('mainTitleIcon', 'fa-fire'); - } - - /** - * @param $range - * - * @return \Illuminate\Http\RedirectResponse - */ - public function rangeJump($range) - { - - $valid = ['1D', '1W', '1M', '3M', '6M', '1Y',]; - - /** @var \FireflyIII\Shared\Preferences\PreferencesInterface $preferences */ - $preferences = App::make('FireflyIII\Shared\Preferences\PreferencesInterface'); - - if (in_array($range, $valid)) { - $preferences->set('viewRange', $range); - Session::forget('range'); - } - return Redirect::to(URL::previous()); - } - - /** - * @return \Illuminate\Http\RedirectResponse - */ - public function sessionNext() - { - Navigation::next(); - return Redirect::to(URL::previous()); - - } - - /** - * @return \Illuminate\Http\RedirectResponse - */ - public function sessionPrev() - { - Navigation::prev(); - return Redirect::to(URL::previous()); - } -} diff --git a/app/controllers/JsonController.php b/app/controllers/JsonController.php deleted file mode 100644 index a0e6f08262..0000000000 --- a/app/controllers/JsonController.php +++ /dev/null @@ -1,65 +0,0 @@ -get(); - $return = []; - foreach ($list as $entry) { - $return[] = $entry->name; - } - - return Response::json($return); - - - } - - /** - * Returns a JSON list of all beneficiaries. - * - * @return \Illuminate\Http\JsonResponse - */ - public function expenseAccounts() - { - /** @var \FireflyIII\Database\Account\Account $accounts */ - $accounts = App::make('FireflyIII\Database\Account\Account'); - $list = $accounts->getAccountsByType(['Expense account', 'Beneficiary account']); - $return = []; - foreach ($list as $entry) { - $return[] = $entry->name; - } - - return Response::json($return); - - } - - /** - * @return \Illuminate\Http\JsonResponse - */ - public function revenueAccounts() - { - /** @var \FireflyIII\Database\Account\Account $accounts */ - $accounts = App::make('FireflyIII\Database\Account\Account'); - $list = $accounts->getAccountsByType(['Revenue account']); - $return = []; - foreach ($list as $entry) { - $return[] = $entry->name; - } - - return Response::json($return); - - } -} diff --git a/app/controllers/PiggybankController.php b/app/controllers/PiggybankController.php deleted file mode 100644 index 5b9851eb84..0000000000 --- a/app/controllers/PiggybankController.php +++ /dev/null @@ -1,360 +0,0 @@ -_repository = $repository; - View::share('title', 'Piggy banks'); - View::share('mainTitleIcon', 'fa-sort-amount-asc'); - } - - /** - * Add money to piggy bank - * - * @param PiggyBank $piggyBank - * - * @return $this - */ - public function add(PiggyBank $piggyBank) - { - $leftOnAccount = $this->_repository->leftOnAccount($piggyBank->account); - $savedSoFar = $piggyBank->currentRelevantRep()->currentamount; - $leftToSave = $piggyBank->targetamount - $savedSoFar; - $maxAmount = min($leftOnAccount, $leftToSave); - - - \Log::debug('Now going to view for piggy bank #' . $piggyBank->id . ' (' . $piggyBank->name . ')'); - - return View::make('piggy_banks.add', compact('piggyBank', 'maxAmount')); - } - - /** - * @return mixed - */ - public function create() - { - - /** @var \FireflyIII\Database\Account\Account $acct */ - $acct = App::make('FireflyIII\Database\Account\Account'); - - $periods = Config::get('firefly.piggy_bank_periods'); - $accounts = FFForm::makeSelectList($acct->getAccountsByType(['Default account', 'Asset account'])); - $subTitle = 'Create new piggy bank'; - $subTitleIcon = 'fa-plus'; - - return View::make('piggy_banks.create', compact('accounts', 'periods', 'subTitle', 'subTitleIcon')); - } - - /** - * @param PiggyBank $piggyBank - * - * @return $this - */ - public function delete(PiggyBank $piggyBank) - { - $subTitle = 'Delete "' . e($piggyBank->name) . '"'; - - return View::make('piggy_banks.delete', compact('piggyBank', 'subTitle')); - } - - /** - * @param PiggyBank $piggyBank - * - * @return \Illuminate\Http\RedirectResponse - */ - public function destroy(PiggyBank $piggyBank) - { - - Session::flash('success', 'Piggy bank "' . e($piggyBank->name) . '" deleted.'); - $this->_repository->destroy($piggyBank); - - return Redirect::route('piggy_banks.index'); - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - * - * @param PiggyBank $piggyBank - * - * @return $this - */ - public function edit(PiggyBank $piggyBank) - { - - /** @var \FireflyIII\Database\Account\Account $acct */ - $acct = App::make('FireflyIII\Database\Account\Account'); - - $periods = Config::get('firefly.piggy_bank_periods'); - $accounts = FFForm::makeSelectList($acct->getAccountsByType(['Default account', 'Asset account'])); - $subTitle = 'Edit piggy bank "' . e($piggyBank->name) . '"'; - $subTitleIcon = 'fa-pencil'; - - /* - * Flash some data to fill the form. - */ - if (is_null($piggyBank->targetdate) || $piggyBank->targetdate == '') { - $targetDate = null; - } else { - $targetDate = new Carbon($piggyBank->targetdate); - $targetDate = $targetDate->format('Y-m-d'); - } - $preFilled = ['name' => $piggyBank->name, - 'account_id' => $piggyBank->account_id, - 'targetamount' => $piggyBank->targetamount, - 'targetdate' => $targetDate, - 'reminder' => $piggyBank->reminder, - 'remind_me' => intval($piggyBank->remind_me) == 1 || !is_null($piggyBank->reminder) ? true : false - ]; - Session::flash('preFilled', $preFilled); - - return View::make('piggy_banks.edit', compact('subTitle', 'subTitleIcon', 'piggyBank', 'accounts', 'periods', 'preFilled')); - } - - /** - * @return $this - */ - public function index() - { - /** @var Collection $piggyBanks */ - $piggyBanks = $this->_repository->get(); - - $accounts = []; - /** @var PiggyBank $piggyBank */ - foreach ($piggyBanks as $piggyBank) { - $piggyBank->savedSoFar = floatval($piggyBank->currentRelevantRep()->currentamount); - $piggyBank->percentage = intval($piggyBank->savedSoFar / $piggyBank->targetamount * 100); - $piggyBank->leftToSave = $piggyBank->targetamount - $piggyBank->savedSoFar; - - /* - * Fill account information: - */ - $account = $piggyBank->account; - if (!isset($accounts[$account->id])) { - $accounts[$account->id] = [ - 'name' => $account->name, - 'balance' => Steam::balance($account), - 'leftForPiggyBanks' => $this->_repository->leftOnAccount($account), - 'sumOfSaved' => $piggyBank->savedSoFar, - 'sumOfTargets' => floatval($piggyBank->targetamount), - 'leftToSave' => $piggyBank->leftToSave - ]; - } else { - $accounts[$account->id]['sumOfSaved'] += $piggyBank->savedSoFar; - $accounts[$account->id]['sumOfTargets'] += floatval($piggyBank->targetamount); - $accounts[$account->id]['leftToSave'] += $piggyBank->leftToSave; - } - } - - return View::make('piggy_banks.index', compact('piggyBanks', 'accounts')); - } - - /** - * POST add money to piggy bank - * - * @param PiggyBank $piggyBank - * - * @return \Illuminate\Http\RedirectResponse - */ - public function postAdd(PiggyBank $piggyBank) - { - $amount = round(floatval(Input::get('amount')), 2); - - /** @var \FireflyIII\Database\PiggyBank\PiggyBank $acct */ - $piggyRepository = App::make('FireflyIII\Database\PiggyBank\PiggyBank'); - - $leftOnAccount = $piggyRepository->leftOnAccount($piggyBank->account); - $savedSoFar = $piggyBank->currentRelevantRep()->currentamount; - $leftToSave = $piggyBank->targetamount - $savedSoFar; - $maxAmount = round(min($leftOnAccount, $leftToSave), 2); - - if ($amount <= $maxAmount) { - $repetition = $piggyBank->currentRelevantRep(); - $repetition->currentamount += $amount; - $repetition->save(); - - /* - * Create event! - */ - Event::fire('piggy_bank.addMoney', [$piggyBank, $amount]); // new and used. - - Session::flash('success', 'Added ' . Amount::format($amount, false) . ' to "' . e($piggyBank->name) . '".'); - } else { - Session::flash('error', 'Could not add ' . Amount::format($amount, false) . ' to "' . e($piggyBank->name) . '".'); - } - - return Redirect::route('piggy_banks.index'); - } - - /** - * @param PiggyBank $piggyBank - * - * @return \Illuminate\Http\RedirectResponse - */ - public function postRemove(PiggyBank $piggyBank) - { - $amount = floatval(Input::get('amount')); - - $savedSoFar = $piggyBank->currentRelevantRep()->currentamount; - - if ($amount <= $savedSoFar) { - $repetition = $piggyBank->currentRelevantRep(); - $repetition->currentamount -= $amount; - $repetition->save(); - - /* - * Create event! - */ - Event::fire('piggy_bank.removeMoney', [$piggyBank, $amount]); // new and used. - - Session::flash('success', 'Removed ' . Amount::format($amount, false) . ' from "' . e($piggyBank->name) . '".'); - } else { - Session::flash('error', 'Could not remove ' . Amount::format($amount, false) . ' from "' . e($piggyBank->name) . '".'); - } - - return Redirect::route('piggy_banks.index'); - } - - /** - * @param PiggyBank $piggyBank - * - * @SuppressWarnings("Unused") - * - * @return \Illuminate\View\View - */ - public function remove(PiggyBank $piggyBank) - { - return View::make('piggy_banks.remove', compact('piggyBank')); - } - - /** - * @param PiggyBank $piggyBank - * - * @return $this - */ - public function show(PiggyBank $piggyBank) - { - - $events = $piggyBank->piggyBankEvents()->orderBy('date', 'DESC')->orderBy('id', 'DESC')->get(); - - /* - * Number of reminders: - */ - - $subTitle = e($piggyBank->name); - - return View::make('piggy_banks.show', compact('piggyBank', 'events', 'subTitle')); - - } - - /** - * - */ - public function store() - { - $data = Input::all(); - $data['repeats'] = 0; - $data['user_id'] = Auth::user()->id; - $data['rep_every'] = 0; - $data['reminder_skip'] = 0; - $data['remind_me'] = intval(Input::get('remind_me')); - $data['order'] = 0; - - - // always validate: - $messages = $this->_repository->validate($data); - - // flash messages: - Session::flash('warnings', $messages['warnings']); - Session::flash('successes', $messages['successes']); - Session::flash('errors', $messages['errors']); - if ($messages['errors']->count() > 0) { - Session::flash('error', 'Could not store piggy bank: ' . $messages['errors']->first()); - return Redirect::route('piggy_banks.create')->withInput(); - } - - - // return to create screen: - if ($data['post_submit_action'] == 'validate_only') { - return Redirect::route('piggy_banks.create')->withInput(); - } - - // store - $piggyBank = $this->_repository->store($data); - Event::fire('piggy_bank.store', [$piggyBank]); // new and used. - Session::flash('success', 'Piggy bank "' . e($data['name']) . '" stored.'); - if ($data['post_submit_action'] == 'store') { - return Redirect::route('piggy_banks.index'); - } - - return Redirect::route('piggy_banks.create')->withInput(); - } - - /** - * @param PiggyBank $piggyBank - * - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - * - * @return $this - * @throws FireflyException - */ - public function update(PiggyBank $piggyBank) - { - - $data = Input::except('_token'); - $data['rep_every'] = 0; - $data['reminder_skip'] = 0; - $data['order'] = 0; - $data['remind_me'] = isset($data['remind_me']) ? 1 : 0; - $data['user_id'] = Auth::user()->id; - $data['repeats'] = 0; - - $messages = $this->_repository->validate($data); - - Session::flash('warnings', $messages['warnings']); - Session::flash('successes', $messages['successes']); - Session::flash('errors', $messages['errors']); - if ($messages['errors']->count() > 0) { - Session::flash('error', 'Could not update piggy bank: ' . $messages['errors']->first()); - return Redirect::route('piggy_banks.edit', $piggyBank->id)->withInput(); - } - - // return to update screen: - if ($data['post_submit_action'] == 'validate_only') { - return Redirect::route('piggy_banks.edit', $piggyBank->id)->withInput(); - } - - // update - $this->_repository->update($piggyBank, $data); - Session::flash('success', 'Piggy bank "' . e($data['name']) . '" updated.'); - - // go back to list - if ($data['post_submit_action'] == 'update') { - return Redirect::route('piggy_banks.index'); - } - - // go back to update screen. - return Redirect::route('piggy_banks.edit', $piggyBank->id)->withInput(['post_submit_action' => 'return_to_edit']); - - } -} diff --git a/app/controllers/PreferencesController.php b/app/controllers/PreferencesController.php deleted file mode 100644 index d0d62d797d..0000000000 --- a/app/controllers/PreferencesController.php +++ /dev/null @@ -1,75 +0,0 @@ -getAccountsByType(['Default account', 'Asset account']); - $viewRange = $preferences->get('viewRange', '1M'); - $viewRangeValue = $viewRange->data; - $frontPage = $preferences->get('frontPageAccounts', []); - $budgetMax = $preferences->get('budgetMaximum', 1000); - $budgetMaximum = $budgetMax->data; - - return View::make('preferences.index', compact('budgetMaximum'))->with('accounts', $accounts)->with('frontPageAccounts', $frontPage)->with( - 'viewRange', $viewRangeValue - ); - } - - /** - * @return \Illuminate\Http\RedirectResponse - */ - public function postIndex() - { - /** @var \FireflyIII\Shared\Preferences\Preferences $preferences */ - $preferences = App::make('FireflyIII\Shared\Preferences\Preferences'); - - // front page accounts - $frontPageAccounts = []; - foreach (Input::get('frontPageAccounts') as $id) { - $frontPageAccounts[] = intval($id); - } - $preferences->set('frontPageAccounts', $frontPageAccounts); - - // view range: - $preferences->set('viewRange', Input::get('viewRange')); - // forget session values: - Session::forget('start'); - Session::forget('end'); - Session::forget('range'); - - // budget maximum: - $budgetMaximum = intval(Input::get('budgetMaximum')); - $preferences->set('budgetMaximum', $budgetMaximum); - - - Session::flash('success', 'Preferences saved!'); - - return Redirect::route('preferences'); - } - -} diff --git a/app/controllers/ProfileController.php b/app/controllers/ProfileController.php deleted file mode 100644 index 8ac759f571..0000000000 --- a/app/controllers/ProfileController.php +++ /dev/null @@ -1,85 +0,0 @@ -with('title', Auth::user()->email)->with('subTitle', 'Change your password')->with( - 'mainTitleIcon', 'fa-user' - ); - } - - /** - * @return \Illuminate\View\View - * - */ - public function index() - { - return View::make('profile.index')->with('title', 'Profile')->with('subTitle', Auth::user()->email)->with('mainTitleIcon', 'fa-user'); - } - - /** - * @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View - */ - public function postChangePassword() - { - - // old, new1, new2 - if (!Hash::check(Input::get('old'), Auth::user()->password)) { - Session::flash('error', 'Invalid current password!'); - - return View::make('profile.change-password'); - } - $result = $this->_validatePassword(Input::get('old'), Input::get('new1'), Input::get('new2')); - if (!($result === true)) { - Session::flash('error', $result); - - return View::make('profile.change-password'); - } - - // update the user with the new password. - /** @var \FireflyIII\Database\User\User $repository */ - $repository = \App::make('FireflyIII\Database\User\User'); - $repository->updatePassword(Auth::user(), Input::get('new1')); - - Session::flash('success', 'Password changed!'); - - return Redirect::route('profile'); - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - * - * @param string $old - * @param string $new1 - * @param string $new2 - * - * @return string|bool - */ - protected function _validatePassword($old, $new1, $new2) - { - if (strlen($new1) == 0 || strlen($new2) == 0) { - return 'Do fill in a password!'; - - } - if ($new1 == $old) { - return 'The idea is to change your password.'; - } - - if ($new1 !== $new2) { - return 'New passwords do not match!'; - } - - return true; - - } - -} diff --git a/app/controllers/RelatedController.php b/app/controllers/RelatedController.php deleted file mode 100644 index fb77ee320c..0000000000 --- a/app/controllers/RelatedController.php +++ /dev/null @@ -1,148 +0,0 @@ -_repository = $repository; - - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - * - * @param TransactionJournal $journal - * - * @return \Illuminate\Http\JsonResponse - */ - public function alreadyRelated(TransactionJournal $journal) - { - $ids = []; - /** @var TransactionGroup $group */ - foreach ($journal->transactiongroups()->get() as $group) { - /** @var TransactionJournal $loopJournal */ - foreach ($group->transactionjournals()->get() as $loopJournal) { - if ($loopJournal->id != $journal->id) { - $ids[] = $loopJournal->id; - } - } - } - $unique = array_unique($ids); - if (count($unique) > 0) { - - $set = $this->_repository->getJournalsByIds($unique); - $set->each( - function (TransactionJournal $journal) { - $journal->amount = Amount::format($journal->getAmount()); - } - ); - - return Response::json($set->toArray()); - } else { - return Response::json((new Collection)->toArray()); - } - } - - /** - * @param TransactionJournal $parentJournal - * @param TransactionJournal $childJournal - * - * @return \Illuminate\Http\JsonResponse - */ - public function relate(TransactionJournal $parentJournal, TransactionJournal $childJournal) - { - $group = new TransactionGroup; - $group->relation = 'balance'; - $group->user_id = $this->_repository->getUser()->id; - $group->save(); - $group->transactionjournals()->save($parentJournal); - $group->transactionjournals()->save($childJournal); - - return Response::json(true); - - } - - /** - * @param TransactionJournal $journal - * - * @return \Illuminate\View\View - */ - public function related(TransactionJournal $journal) - { - $groups = $journal->transactiongroups()->get(); - $members = new Collection; - /** @var TransactionGroup $group */ - foreach ($groups as $group) { - /** @var TransactionJournal $loopJournal */ - foreach ($group->transactionjournals()->get() as $loopJournal) { - if ($loopJournal->id != $journal->id) { - $members->push($loopJournal); - } - } - } - - return View::make('related.relate', compact('journal', 'members')); - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - * - * @param TransactionJournal $parentJournal - * @param TransactionJournal $childJournal - * - * @return \Illuminate\Http\JsonResponse - * @throws Exception - */ - public function removeRelation(TransactionJournal $parentJournal, TransactionJournal $childJournal) - { - $groups = $parentJournal->transactiongroups()->get(); - /** @var TransactionGroup $group */ - foreach ($groups as $group) { - foreach ($group->transactionjournals()->get() as $loopJournal) { - if ($loopJournal->id == $childJournal->id) { - // remove from group: - $group->transactionjournals()->detach($childJournal); - } - } - if ($group->transactionjournals()->count() == 1) { - $group->delete(); - } - } - - return Response::json(true); - } - - /** - * @param TransactionJournal $journal - * - * @return \Illuminate\Http\JsonResponse - */ - public function search(TransactionJournal $journal) - { - - $search = e(trim(Input::get('searchValue'))); - - $result = $this->_repository->search($search, $journal); - $result->each( - function (TransactionJournal $j) { - $j->amount = Amount::format($j->getAmount()); - } - ); - - return Response::json($result->toArray()); - } - -} diff --git a/app/controllers/ReminderController.php b/app/controllers/ReminderController.php deleted file mode 100644 index 7b34fadb04..0000000000 --- a/app/controllers/ReminderController.php +++ /dev/null @@ -1,93 +0,0 @@ -remindersable); - - if ($class == 'PiggyBank') { - $amount = Reminders::amountForReminder($reminder); - $preFilled = [ - 'amount' => round($amount, 2), - 'description' => 'Money for ' . $reminder->remindersable->name, - 'piggy_bank_id' => $reminder->remindersable_id, - 'account_to_id' => $reminder->remindersable->account_id - ]; - Session::flash('preFilled', $preFilled); - - return Redirect::route('transactions.create', 'transfer'); - } - - return View::make('error')->with('message', 'This reminder has an invalid class connected to it.'); - } - - /** - * @param Reminder $reminder - * - * @return \Illuminate\Http\RedirectResponse - */ - public function dismiss(Reminder $reminder) - { - $reminder->active = 0; - $reminder->save(); - Session::flash('success', 'Reminder dismissed'); - - return Redirect::route('index'); - } - - /** - * @param Reminder $reminder - * - * @return \Illuminate\Http\RedirectResponse - */ - public function notNow(Reminder $reminder) - { - $reminder->active = 0; - $reminder->notnow = 1; - $reminder->save(); - Session::flash('success', 'Reminder dismissed'); - - return Redirect::route('index'); - } - - /** - * @param Reminder $reminder - * - * @return \Illuminate\View\View - */ - public function show(Reminder $reminder) - { - - $amount = null; - if (get_class($reminder->remindersable) == 'PiggyBank') { - - $amount = Reminders::amountForReminder($reminder); - } - - return View::make('reminders.show', compact('reminder', 'amount')); - } - -} diff --git a/app/controllers/RepeatedExpenseController.php b/app/controllers/RepeatedExpenseController.php deleted file mode 100644 index 73494b0377..0000000000 --- a/app/controllers/RepeatedExpenseController.php +++ /dev/null @@ -1,227 +0,0 @@ -_repository = $repository; - } - - /** - * @return $this - */ - public function create() - { - /** @var \FireflyIII\Database\Account\Account $acct */ - $acct = App::make('FireflyIII\Database\Account\Account'); - $periods = Config::get('firefly.piggy_bank_periods'); - $accounts = FFForm::makeSelectList($acct->getAccountsByType(['Default account', 'Asset account'])); - - return View::make('repeatedExpense.create', compact('accounts', 'periods'))->with('subTitle', 'Create new repeated expense')->with( - 'subTitleIcon', 'fa-plus' - ); - } - - /** - * @param PiggyBank $repeatedExpense - * - * @return $this - */ - public function delete(PiggyBank $repeatedExpense) - { - $subTitle = 'Delete "' . e($repeatedExpense->name) . '"'; - - return View::make('repeatedExpense.delete', compact('repeatedExpense', 'subTitle')); - } - - /** - * @param PiggyBank $repeatedExpense - * - * @return \Illuminate\Http\RedirectResponse - */ - public function destroy(PiggyBank $repeatedExpense) - { - - Session::flash('success', 'Repeated expense "' . e($repeatedExpense->name) . '" deleted.'); - $this->_repository->destroy($repeatedExpense); - - return Redirect::route('repeated.index'); - } - - /** - * @param PiggyBank $repeatedExpense - * - * @return $this - */ - public function edit(PiggyBank $repeatedExpense) - { - - /** @var \FireflyIII\Database\Account\Account $acct */ - $acct = App::make('FireflyIII\Database\Account\Account'); - - $periods = Config::get('firefly.piggy_bank_periods'); - $accounts = FFForm::makeSelectList($acct->getAccountsByType(['Default account', 'Asset account'])); - $subTitle = 'Edit repeated expense "' . e($repeatedExpense->name) . '"'; - $subTitleIcon = 'fa-pencil'; - - /* - * Flash some data to fill the form. - */ - $preFilled = ['name' => $repeatedExpense->name, - 'account_id' => $repeatedExpense->account_id, - 'targetamount' => $repeatedExpense->targetamount, - 'targetdate' => $repeatedExpense->targetdate->format('Y-m-d'), - 'reminder' => $repeatedExpense->reminder, - 'remind_me' => intval($repeatedExpense->remind_me) == 1 || !is_null($repeatedExpense->reminder) ? true : false - ]; - Session::flash('preFilled', $preFilled); - - return View::make('repeatedExpense.edit', compact('subTitle', 'subTitleIcon', 'repeatedExpense', 'accounts', 'periods', 'preFilled')); - } - - /** - * @return \Illuminate\View\View - */ - public function index() - { - - $subTitle = 'Overview'; - - $expenses = $this->_repository->get(); - $expenses->each( - function (PiggyBank $piggyBank) { - $piggyBank->currentRelevantRep(); - } - ); - - return View::make('repeatedExpense.index', compact('expenses', 'subTitle')); - } - - /** - * @param PiggyBank $repeatedExpense - * - * @return \Illuminate\View\View - */ - public function show(PiggyBank $repeatedExpense) - { - $subTitle = $repeatedExpense->name; - $today = Carbon::now(); - $repetitions = $repeatedExpense->piggyBankRepetitions()->get(); - - $repetitions->each( - function (PiggyBankRepetition $repetition) { - $repetition->bars = $this->_repository->calculateParts($repetition); - } - ); - - return View::make('repeatedExpense.show', compact('repetitions', 'repeatedExpense', 'today', 'subTitle')); - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - */ - public function store() - { - $data = Input::all(); - $data['repeats'] = 1; - $data['user_id'] = Auth::user()->id; - $targetDate = new Carbon($data['targetdate']); - $startDate = \DateKit::subtractPeriod($targetDate, $data['rep_length']); - $data['startdate'] = $startDate->format('Y-m-d'); - $data['targetdate'] = $targetDate->format('Y-m-d'); - $data['reminder_skip'] = 0; - $data['remind_me'] = isset($data['remind_me']) ? 1 : 0; - $data['order'] = 0; - - $messages = $this->_repository->validate($data); - - Session::flash('warnings', $messages['warnings']); - Session::flash('successes', $messages['successes']); - Session::flash('errors', $messages['errors']); - if ($messages['errors']->count() > 0) { - Session::flash('error', 'Could not store repeated expense: ' . $messages['errors']->first()); - return Redirect::route('repeated.create')->withInput(); - } - - - // return to create screen: - if ($data['post_submit_action'] == 'validate_only') { - return Redirect::route('repeated.create')->withInput(); - } - - // store - $piggyBank = $this->_repository->store($data); - Event::fire('piggy_bank.store', [$piggyBank]); // new and used. - Session::flash('success', 'Piggy bank "' . e($data['name']) . '" stored.'); - if ($data['post_submit_action'] == 'store') { - return Redirect::route('repeated.index'); - } - - return Redirect::route('repeated.create')->withInput(); - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - * - * @param PiggyBank $repeatedExpense - * - * @return $this - * @throws FireflyException - */ - public function update(PiggyBank $repeatedExpense) - { - - $data = Input::except('_token'); - $data['rep_every'] = 0; - $data['reminder_skip'] = 0; - $data['order'] = 0; - $data['repeats'] = 1; - $data['remind_me'] = isset($data['remind_me']) ? 1 : 0; - $data['user_id'] = Auth::user()->id; - - $messages = $this->_repository->validate($data); - - Session::flash('warnings', $messages['warnings']); - Session::flash('successes', $messages['successes']); - Session::flash('errors', $messages['errors']); - if ($messages['errors']->count() > 0) { - Session::flash('error', 'Could not update repeated expense: ' . $messages['errors']->first()); - return Redirect::route('repeated.edit', $repeatedExpense->id)->withInput(); - } - - // return to update screen: - if ($data['post_submit_action'] == 'validate_only') { - return Redirect::route('repeated.edit', $repeatedExpense->id)->withInput(); - } - - // update - $this->_repository->update($repeatedExpense, $data); - Session::flash('success', 'Repeated expense "' . e($data['name']) . '" updated.'); - - // go back to list - if ($data['post_submit_action'] == 'update') { - return Redirect::route('repeated.index'); - } - - // go back to update screen. - return Redirect::route('repeated.edit', $repeatedExpense->id)->withInput(['post_submit_action' => 'return_to_edit']); - - } -} diff --git a/app/controllers/ReportController.php b/app/controllers/ReportController.php deleted file mode 100644 index 6577ca5271..0000000000 --- a/app/controllers/ReportController.php +++ /dev/null @@ -1,136 +0,0 @@ -_journals = $journals; - $this->_repository = $repository; - /** @var \FireflyIII\Database\Budget\Budget _budgets */ - $this->_budgets = App::make('FireflyIII\Database\Budget\Budget'); - - - View::share('title', 'Reports'); - View::share('mainTitleIcon', 'fa-line-chart'); - - } - - /** - * @param string $year - * @param string $month - * - * @return \Illuminate\View\View - */ - public function budget($year = '2014', $month = '1') - { - try { - new Carbon($year . '-' . $month . '-01'); - } catch (Exception $e) { - return View::make('error')->with('message', 'Invalid date'); - } - $date = new Carbon($year . '-' . $month . '-01'); - $dayEarly = clone $date; - $subTitle = 'Budget report for ' . $date->format('F Y'); - $subTitleIcon = 'fa-calendar'; - $dayEarly = $dayEarly->subDay(); - $accounts = $this->_repository->getAccountListBudgetOverview($date); - $budgets = $this->_repository->getBudgetsForMonth($date); - - return View::make('reports.budget', compact('subTitle', 'subTitleIcon', 'date', 'accounts', 'budgets', 'dayEarly')); - - } - - /** - * - */ - public function index() - { - $start = $this->_journals->firstDate(); - $months = $this->_repository->listOfMonths(clone $start); - $years = $this->_repository->listOfYears(clone $start); - $title = 'Reports'; - $mainTitleIcon = 'fa-line-chart'; - - return View::make('reports.index', compact('years', 'months', 'title', 'mainTitleIcon')); - } - - /** - * @param string $year - * @param string $month - * - * @return \Illuminate\View\View - */ - public function month($year = '2014', $month = '1') - { - try { - new Carbon($year . '-' . $month . '-01'); - } catch (Exception $e) { - return View::make('error')->with('message', 'Invalid date.'); - } - $date = new Carbon($year . '-' . $month . '-01'); - $subTitle = 'Report for ' . $date->format('F Y'); - $subTitleIcon = 'fa-calendar'; - $displaySum = true; // to show sums in report. - $income = $this->_repository->getIncomeForMonth($date); - $expenses = $this->_repository->getExpenseGroupedForMonth($date, 10); - $budgets = $this->_repository->getBudgetsForMonth($date); - $categories = $this->_repository->getCategoriesForMonth($date, 10); - $accounts = $this->_repository->getAccountsForMonth($date); - - return View::make( - 'reports.month', - compact('date', 'accounts', 'categories', 'budgets', 'expenses', 'subTitle', 'displaySum', 'subTitleIcon', 'income') - ); - } - - /** - * @param $year - * - * @return $this - */ - public function year($year) - { - try { - new Carbon('01-01-' . $year); - } catch (Exception $e) { - return View::make('error')->with('message', 'Invalid date.'); - } - $date = new Carbon('01-01-' . $year); - $end = clone $date; - $end->endOfYear(); - $title = 'Reports'; - $subTitle = $year; - $subTitleIcon = 'fa-bar-chart'; - $mainTitleIcon = 'fa-line-chart'; - - $balances = $this->_repository->yearBalanceReport($date); - $groupedIncomes = $this->_repository->revenueGroupedByAccount($date, $end); - $groupedExpenses = $this->_repository->expensesGroupedByAccount($date, $end, 15); - - return View::make( - 'reports.year', - compact('date', 'groupedIncomes', 'groupedExpenses', 'year', 'balances', 'title', 'subTitle', 'subTitleIcon', 'mainTitleIcon') - ); - } - -} diff --git a/app/controllers/SearchController.php b/app/controllers/SearchController.php deleted file mode 100644 index 6bcbb73d35..0000000000 --- a/app/controllers/SearchController.php +++ /dev/null @@ -1,38 +0,0 @@ - 0) { - $rawQuery = trim(Input::get('q')); - $words = explode(' ', $rawQuery); - $subTitle = 'Results for "' . e($rawQuery) . '"'; - - $transactions = $searcher->searchTransactions($words); - $accounts = $searcher->searchAccounts($words); - $categories = $searcher->searchCategories($words); - $budgets = $searcher->searchBudgets($words); - $tags = $searcher->searchTags($words); - $result = ['transactions' => $transactions, 'accounts' => $accounts, 'categories' => $categories, 'budgets' => $budgets, 'tags' => $tags]; - - } - - return View::make('search.index')->with('title', 'Search')->with('subTitle', $subTitle)->with( - 'mainTitleIcon', 'fa-search' - )->with('query', $rawQuery)->with('result', $result); - } -} diff --git a/app/controllers/TransactionController.php b/app/controllers/TransactionController.php deleted file mode 100644 index f1e6184fc1..0000000000 --- a/app/controllers/TransactionController.php +++ /dev/null @@ -1,328 +0,0 @@ -_repository = $repository; - $this->_helper = $helper; - View::share('title', 'Transactions'); - View::share('mainTitleIcon', 'fa-repeat'); - } - - - /** - * Shows the view helping the user to create a new transaction journal. - * - * @param string $what - * - * @return \Illuminate\View\View - */ - public function create($what = 'deposit') - { - $accounts = FFForm::makeSelectList($this->_helper->getAssetAccounts()); - $budgets = FFForm::makeSelectList($this->_helper->getBudgets()); - $budgets[0] = '(no budget)'; - $piggyBanks = $this->_helper->getPiggyBanks(); - $repeatedExpenses = $this->_helper->getRepeatedExpenses(); - $list = $piggyBanks->merge($repeatedExpenses); - $piggies = FFForm::makeSelectList($list); - $piggies[0] = '(no piggy bank)'; - $preFilled = Session::has('preFilled') ? Session::get('preFilled') : []; - $respondTo = ['account_id', 'account_from_id']; - $subTitle = 'Add a new ' . e($what); - - foreach ($respondTo as $r) { - if (!is_null(Input::get($r))) { - $preFilled[$r] = Input::get($r); - } - } - Session::put('preFilled', $preFilled); - - asort($piggies); - - - return View::make('transactions.create', compact('accounts', 'budgets', 'what', 'piggies', 'subTitle')); - } - - /** - * Shows the form that allows a user to delete a transaction journal. - * - * @param TransactionJournal $journal - * - * @return $this - */ - public function delete(TransactionJournal $journal) - { - $type = strtolower($journal->transactionType->type); - $subTitle = 'Delete ' . e($type) . ' "' . e($journal->description) . '"'; - - return View::make('transactions.delete', compact('journal', 'subTitle')); - - - } - - /** - * @param TransactionJournal $transactionJournal - * - * @return \Illuminate\Http\RedirectResponse - */ - public function destroy(TransactionJournal $transactionJournal) - { - $type = $transactionJournal->transactionType->type; - $return = 'withdrawal'; - - Session::flash('success', 'Transaction "' . e($transactionJournal->description) . '" destroyed.'); - - $this->_repository->destroy($transactionJournal); - - switch ($type) { - case 'Deposit': - $return = 'deposit'; - break; - case 'Transfer': - $return = 'transfers'; - break; - } - - return Redirect::route('transactions.index', $return); - } - - /** - * Shows the view to edit a transaction. - * - * @param TransactionJournal $journal - * - * @return $this - */ - public function edit(TransactionJournal $journal) - { - $what = strtolower($journal->transactiontype->type); - $subTitle = 'Edit ' . e($what) . ' "' . e($journal->description) . '"'; - $budgets = FFForm::makeSelectList($this->_helper->getBudgets(), true); - $accounts = FFForm::makeSelectList($this->_helper->getAssetAccounts()); - $piggies = FFForm::makeSelectList($this->_helper->getPiggyBanks(), true); - $transactions = $journal->transactions()->orderBy('amount', 'DESC')->get(); - $preFilled = [ - 'date' => $journal->date->format('Y-m-d'), - 'category' => '', - 'budget_id' => 0, - 'piggy_bank_id' => 0 - ]; - - $category = $journal->categories()->first(); - if (!is_null($category)) { - $preFilled['category'] = $category->name; - } - - $budget = $journal->budgets()->first(); - if (!is_null($budget)) { - $preFilled['budget_id'] = $budget->id; - } - - if ($journal->piggyBankEvents()->count() > 0) { - $preFilled['piggy_bank_id'] = $journal->piggyBankEvents()->first()->piggy_bank_id; - } - - $preFilled['amount'] = $journal->getAmount(); - $preFilled['account_id'] = $this->_helper->getAssetAccount($what, $transactions); - $preFilled['expense_account'] = $transactions[0]->account->name; - $preFilled['revenue_account'] = $transactions[1]->account->name; - $preFilled['account_from_id'] = $transactions[1]->account->id; - $preFilled['account_to_id'] = $transactions[0]->account->id; - - - return View::make('transactions.edit', compact('journal', 'accounts', 'what', 'budgets', 'piggies', 'subTitle'))->with('data', $preFilled); - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's 7. More than 5 but alright. - * - * @param $what - * - * @return $this - */ - public function index($what) - { - switch ($what) { - case 'expenses': - case 'withdrawal': - $subTitleIcon = 'fa-long-arrow-left'; - $subTitle = 'Expenses'; - $journals = $this->_repository->getWithdrawalsPaginated(50); - break; - case 'revenue': - case 'deposit': - $subTitleIcon = 'fa-long-arrow-right'; - $subTitle = 'Revenue, income and deposits'; - $journals = $this->_repository->getDepositsPaginated(50); - break; - case 'transfer': - case 'transfers': - $subTitleIcon = 'fa-arrows-h'; - $subTitle = 'Transfers'; - $journals = $this->_repository->getTransfersPaginated(50); - break; - } - - return View::make('transactions.index', compact('subTitle', 'what', 'subTitleIcon', 'journals')); - - } - - - /** - * @param TransactionJournal $journal - * - * @return $this - */ - public function show(TransactionJournal $journal) - { - $journal->transactions->each( - function (\Transaction $t) use ($journal) { - $t->before = floatval( - $t->account->transactions()->leftJoin( - 'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id' - )->where('transaction_journals.date', '<=', $journal->date->format('Y-m-d'))->where( - 'transaction_journals.created_at', '<=', $journal->created_at->format('Y-m-d H:i:s') - )->where('transaction_journals.id', '!=', $journal->id)->sum('transactions.amount') - ); - $t->after = $t->before + $t->amount; - } - ); - $members = new Collection; - /** @var TransactionGroup $group */ - foreach ($journal->transactiongroups()->get() as $group) { - /** @var TransactionJournal $loopJournal */ - foreach ($group->transactionjournals()->get() as $loopJournal) { - if ($loopJournal->id != $journal->id) { - $members->push($loopJournal); - } - } - } - - return View::make('transactions.show', compact('journal', 'members'))->with( - 'subTitle', e($journal->transactionType->type) . ' "' . e($journal->description) . '"' - ); - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - * - * @param $what - * - * @return $this|\Illuminate\Http\RedirectResponse - * @throws FireflyException - */ - public function store($what) - { - $data = Input::except('_token'); - $transactionType = $this->_repository->getJournalType($what); - $transactionCurrency = $this->_repository->getJournalCurrencyById(intval($data['amount_currency_id'])); - $data['transaction_type_id'] = $transactionType->id; - $data['transaction_currency_id'] = $transactionCurrency->id; - $data['completed'] = 0; - $data['what'] = $what; - $messages = $this->_repository->validate($data); - - Session::flash('warnings', $messages['warnings']); - Session::flash('successes', $messages['successes']); - Session::flash('errors', $messages['errors']); - if ($messages['errors']->count() > 0) { - Session::flash('error', 'Could not store transaction: ' . $messages['errors']->first()); - - return Redirect::route('transactions.create', $data['what'])->withInput(); - } - - if ($data['post_submit_action'] == 'validate_only') { - return Redirect::route('transactions.create', $data['what'])->withInput(); - } - - $journal = $this->_repository->store($data); - Event::fire('transactionJournal.store', [$journal, Input::get('piggy_bank_id')]); // new and used. - - /** @var Transaction $transaction */ - foreach ($journal->transactions as $transaction) { - Event::fire('transaction.store', [$transaction]); - } - - Session::flash('success', 'Transaction "' . e($data['description']) . '" stored.'); - if ($data['post_submit_action'] == 'store') { - return Redirect::route('transactions.index', $data['what']); - } - - return Redirect::route('transactions.create', $data['what'])->withInput(); - } - - - /** - * @param TransactionJournal $journal - * - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - * - * @return $this - * @throws FireflyException - */ - public function update(TransactionJournal $journal) - { - $data = Input::except('_token'); - $data['what'] = strtolower($journal->transactionType->type); - $data['transaction_type_id'] = $journal->transaction_type_id; - $data['transaction_currency_id'] = intval($data['amount_currency_id']); - $data['completed'] = 1; - $messages = $this->_repository->validate($data); - - Session::flash('warnings', $messages['warnings']); - Session::flash('successes', $messages['successes']); - Session::flash('errors', $messages['errors']); - if ($messages['errors']->count() > 0) { - Session::flash('error', 'Could not update transaction: ' . $messages['errors']->first()); - - return Redirect::route('transactions.edit', $journal->id)->withInput(); - } - if ($data['post_submit_action'] == 'validate_only') { - return Redirect::route('transactions.edit', $journal->id)->withInput(); - } - $this->_repository->update($journal, $data); - Session::flash('success', 'Transaction "' . e($data['description']) . '" updated.'); - Event::fire('transactionJournal.update', [$journal]); // new and used. - /** @var Transaction $transaction */ - foreach ($journal->transactions()->get() as $transaction) { - Event::fire('transaction.update', [$transaction]); - } - if ($data['post_submit_action'] == 'update') { - return Redirect::route('transactions.index', $data['what']); - } - - // go back to update screen. - return Redirect::route('transactions.edit', $journal->id)->withInput(['post_submit_action' => 'return_to_edit']); - - - } - -} diff --git a/app/controllers/UserController.php b/app/controllers/UserController.php deleted file mode 100644 index e4c96900f2..0000000000 --- a/app/controllers/UserController.php +++ /dev/null @@ -1,176 +0,0 @@ - Input::get('email'), 'password' => Input::get('password')]; - $result = Auth::attempt($data, $rememberMe); - if ($result) { - return Redirect::route('index'); - } - - Session::flash('error', 'No good!'); - - return View::make('user.login'); - } - - /** - * If allowed, register the user. - * - * Then: - * - * - Send password OR - * - Send reset code. - * - * @return $this|\Illuminate\View\View - */ - public function postRegister() - { - - /** @var \FireflyIII\Database\User\User $repository */ - $repository = App::make('FireflyIII\Database\User\User'); - - /** @var \FireflyIII\Shared\Mail\RegistrationInterface $email */ - $email = App::make('FireflyIII\Shared\Mail\RegistrationInterface'); - - $user = $repository->register(Input::all()); - - if ($user) { - $result = $email->sendVerificationMail($user); - if ($result === false && Config::get('mail.pretend') === false) { - // @codeCoverageIgnoreStart - $user->delete(); - - return View::make('error')->with('message', 'The email message could not be send. See the log files.'); - // @codeCoverageIgnoreEnd - } - - return View::make('user.verification-pending'); - } - - - return View::make('user.register'); - } - - /** - * If need to verify, send new reset code. - * Otherwise, send new password. - * - * @return \Illuminate\View\View - */ - public function postRemindMe() - { - - /** @var \FireflyIII\Database\User\User $repository */ - $repository = App::make('FireflyIII\Database\User\User'); - - /** @var \FireflyIII\Shared\Mail\RegistrationInterface $email */ - $email = App::make('FireflyIII\Shared\Mail\RegistrationInterface'); - - - $user = $repository->findByEmail(Input::get('email')); - if (!$user) { - Session::flash('error', 'No good!'); - - return View::make('user.remindMe'); - } - $email->sendResetVerification($user); - - return View::make('user.verification-pending'); - - } - - /** - * If allowed, show the register form. - * - * @return $this|\Illuminate\View\View - */ - public function register() - { - if ((Config::get('mail.from.address') == '@gmail.com' || Config::get('mail.from.address') == '') - && Config::get('mail.pretend') === false - ) { - return View::make('error')->with('message', 'Configuration error in app/config/' . App::environment() . '/mail.php'); - } - - return View::make('user.register'); - } - - /** - * Show form to help user get a new password. - * - * @return \Illuminate\View\View - */ - public function remindMe() - { - return View::make('user.remindMe'); - } - - /** - * Send a user a password based on his reset code. - * - * @param $reset - * - * @return $this|\Illuminate\View\View - */ - public function reset($reset) - { - - /** @var \FireflyIII\Database\User\User $repository */ - $repository = App::make('FireflyIII\Database\User\User'); - - /** @var \FireflyIII\Shared\Mail\RegistrationInterface $email */ - $email = App::make('FireflyIII\Shared\Mail\RegistrationInterface'); - - $user = $repository->findByReset($reset); - if ($user) { - $email->sendPasswordMail($user); - - return View::make('user.registered'); - } - - return View::make('error')->with('message', 'No reset code found!'); - } - -} diff --git a/app/database/migrations/.gitkeep b/app/database/migrations/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/app/database/migrations/2014_06_27_163032_create_users_table.php b/app/database/migrations/2014_06_27_163032_create_users_table.php deleted file mode 100644 index cd554148db..0000000000 --- a/app/database/migrations/2014_06_27_163032_create_users_table.php +++ /dev/null @@ -1,44 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->string('email', 100); - $table->string('password', 60); - $table->string('reset', 32)->nullable(); - $table->string('remember_token', 255)->nullable(); - $table->unique('email'); - } - ); - } - -} diff --git a/app/database/migrations/2014_06_27_163145_create_account_types_table.php b/app/database/migrations/2014_06_27_163145_create_account_types_table.php deleted file mode 100644 index 783ec4d15d..0000000000 --- a/app/database/migrations/2014_06_27_163145_create_account_types_table.php +++ /dev/null @@ -1,44 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->string('type', 30); - $table->boolean('editable'); - - $table->unique('type'); - } - ); - } - -} diff --git a/app/database/migrations/2014_06_27_163259_create_accounts_table.php b/app/database/migrations/2014_06_27_163259_create_accounts_table.php deleted file mode 100644 index 3fb5541655..0000000000 --- a/app/database/migrations/2014_06_27_163259_create_accounts_table.php +++ /dev/null @@ -1,54 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('user_id')->unsigned(); - $table->integer('account_type_id')->unsigned(); - $table->string('name', 100); - $table->boolean('active'); - - // connect accounts to users - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - - // connect accounts to account_types - $table->foreign('account_type_id')->references('id')->on('account_types')->onDelete('cascade'); - - // for a user, the account name must be unique. - $table->unique(['user_id', 'account_type_id', 'name']); - } - ); - } - -} diff --git a/app/database/migrations/2014_06_27_163817_create_components_table.php b/app/database/migrations/2014_06_27_163817_create_components_table.php deleted file mode 100644 index 465b1ecaff..0000000000 --- a/app/database/migrations/2014_06_27_163817_create_components_table.php +++ /dev/null @@ -1,51 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->string('name', 50); - $table->integer('user_id')->unsigned(); - $table->string('class', 20); - - // connect components to users - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - - // for a user, the component type & name must be unique. - $table->unique(['user_id', 'class', 'name']); - } - ); - - } - -} diff --git a/app/database/migrations/2014_06_27_163818_create_piggybanks_table.php b/app/database/migrations/2014_06_27_163818_create_piggybanks_table.php deleted file mode 100644 index 67d527a66d..0000000000 --- a/app/database/migrations/2014_06_27_163818_create_piggybanks_table.php +++ /dev/null @@ -1,60 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->integer('account_id')->unsigned(); - $table->string('name', 100); - $table->decimal('targetamount', 10, 2); - $table->date('startdate')->nullable(); - $table->date('targetdate')->nullable(); - $table->boolean('repeats'); - $table->enum('rep_length', ['day', 'week', 'quarter', 'month', 'year'])->nullable(); - $table->smallInteger('rep_every')->unsigned(); - $table->smallInteger('rep_times')->unsigned()->nullable(); - $table->enum('reminder', ['day', 'week', 'quarter', 'month', 'year'])->nullable(); - $table->smallInteger('reminder_skip')->unsigned(); - $table->boolean('remind_me'); - $table->integer('order')->unsigned(); - - // connect account to piggy bank. - $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); - - // for an account, the name must be unique. - $table->unique(['account_id', 'name']); - - } - ); - } - -} diff --git a/app/database/migrations/2014_06_27_164042_create_transaction_currencies_table.php b/app/database/migrations/2014_06_27_164042_create_transaction_currencies_table.php deleted file mode 100644 index 809a837bc9..0000000000 --- a/app/database/migrations/2014_06_27_164042_create_transaction_currencies_table.php +++ /dev/null @@ -1,45 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->string('code', 3); - - // code must be unique. - $table->unique(['code']); - } - ); - } - -} diff --git a/app/database/migrations/2014_06_27_164512_create_transaction_types_table.php b/app/database/migrations/2014_06_27_164512_create_transaction_types_table.php deleted file mode 100644 index 746f037a84..0000000000 --- a/app/database/migrations/2014_06_27_164512_create_transaction_types_table.php +++ /dev/null @@ -1,45 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->string('type', 50); - - // type must be unique. - $table->unique(['type']); - } - ); - } - -} diff --git a/app/database/migrations/2014_06_27_164619_create_recurring_transactions_table.php b/app/database/migrations/2014_06_27_164619_create_recurring_transactions_table.php deleted file mode 100644 index 724059c859..0000000000 --- a/app/database/migrations/2014_06_27_164619_create_recurring_transactions_table.php +++ /dev/null @@ -1,59 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->integer('user_id')->unsigned(); - $table->string('name', 50); - $table->string('match', 255); - $table->decimal('amount_min', 10, 2); - $table->decimal('amount_max', 10, 2); - $table->date('date'); - $table->boolean('active'); - - $table->boolean('automatch'); - $table->enum('repeat_freq', ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly']); - $table->smallInteger('skip')->unsigned(); - - // connect user id to users - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - - // for a user, the name must be unique - $table->unique(['user_id', 'name']); - - - } - ); - } - -} diff --git a/app/database/migrations/2014_06_27_164620_create_transaction_journals_table.php b/app/database/migrations/2014_06_27_164620_create_transaction_journals_table.php deleted file mode 100644 index 44ede35eb0..0000000000 --- a/app/database/migrations/2014_06_27_164620_create_transaction_journals_table.php +++ /dev/null @@ -1,62 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('user_id')->unsigned(); - $table->integer('transaction_type_id')->unsigned(); - $table->integer('recurring_transaction_id')->unsigned()->nullable(); - $table->integer('transaction_currency_id')->unsigned(); - $table->string('description', 255)->nullable(); - $table->boolean('completed'); - $table->date('date'); - - // connect users - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - - // connect transaction journals to transaction types - $table->foreign('transaction_type_id')->references('id')->on('transaction_types')->onDelete('cascade'); - - // connect transaction journals to recurring transactions - $table->foreign('recurring_transaction_id')->references('id')->on('recurring_transactions')->onDelete('set null'); - - // connect transaction journals to transaction currencies - $table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade'); - - - } - ); - } - -} diff --git a/app/database/migrations/2014_06_27_164836_create_transactions_table.php b/app/database/migrations/2014_06_27_164836_create_transactions_table.php deleted file mode 100644 index 66b2772534..0000000000 --- a/app/database/migrations/2014_06_27_164836_create_transactions_table.php +++ /dev/null @@ -1,60 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('account_id')->unsigned(); - $table->integer('piggybank_id')->nullable()->unsigned(); - $table->integer('transaction_journal_id')->unsigned(); - $table->string('description', 255)->nullable(); - $table->decimal('amount', 10, 2); - - // connect account id: - $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); - - // connect piggy banks - $table->foreign('piggybank_id')->references('id')->on('piggybanks')->onDelete('set null'); - - // connect transactions to transaction journals - $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade'); - - - - - - } - ); - } - -} diff --git a/app/database/migrations/2014_06_27_165344_create_component_transaction_table.php b/app/database/migrations/2014_06_27_165344_create_component_transaction_table.php deleted file mode 100644 index 6eee751926..0000000000 --- a/app/database/migrations/2014_06_27_165344_create_component_transaction_table.php +++ /dev/null @@ -1,50 +0,0 @@ -increments('id'); - $table->integer('component_id')->unsigned(); - $table->integer('transaction_id')->unsigned(); - - // connect to components - $table->foreign('component_id')->references('id')->on('components')->onDelete('cascade'); - - // connect to transactions - $table->foreign('transaction_id')->references('id')->on('transactions')->onDelete('cascade'); - - // combo must be unique: - $table->unique(['component_id', 'transaction_id']); - } - ); - } - -} diff --git a/app/database/migrations/2014_07_05_171326_create_component_transaction_journal_table.php b/app/database/migrations/2014_07_05_171326_create_component_transaction_journal_table.php deleted file mode 100644 index e6de376c42..0000000000 --- a/app/database/migrations/2014_07_05_171326_create_component_transaction_journal_table.php +++ /dev/null @@ -1,50 +0,0 @@ -increments('id'); - $table->integer('component_id')->unsigned(); - $table->integer('transaction_journal_id')->unsigned(); - - // link components with component_id - $table->foreign('component_id')->references('id')->on('components')->onDelete('cascade'); - - // link transaction journals with transaction_journal_id - $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade'); - - // combo must be unique: - $table->unique(['component_id', 'transaction_journal_id'], 'cid_tjid_unique'); - } - ); - } - -} diff --git a/app/database/migrations/2014_07_06_123842_create_preferences_table.php b/app/database/migrations/2014_07_06_123842_create_preferences_table.php deleted file mode 100644 index 7cd7069c8e..0000000000 --- a/app/database/migrations/2014_07_06_123842_create_preferences_table.php +++ /dev/null @@ -1,49 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->integer('user_id')->unsigned(); - $table->string('name'); - $table->text('data'); - - // connect preferences to users - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - - // only one preference per name per user - $table->unique(['user_id', 'name']); - } - ); - } - -} diff --git a/app/database/migrations/2014_07_09_204843_create_session_table.php b/app/database/migrations/2014_07_09_204843_create_session_table.php deleted file mode 100644 index 240f66ba88..0000000000 --- a/app/database/migrations/2014_07_09_204843_create_session_table.php +++ /dev/null @@ -1,41 +0,0 @@ -string('id')->unique(); - $table->text('payload'); - $table->integer('last_activity'); - } - ); - } - -} diff --git a/app/database/migrations/2014_07_17_183717_create_limits_table.php b/app/database/migrations/2014_07_17_183717_create_limits_table.php deleted file mode 100644 index f6c507216a..0000000000 --- a/app/database/migrations/2014_07_17_183717_create_limits_table.php +++ /dev/null @@ -1,51 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->integer('component_id')->unsigned(); - $table->date('startdate'); - $table->decimal('amount', 10, 2); - $table->boolean('repeats'); - $table->enum('repeat_freq', ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly']); - - $table->unique(['component_id', 'startdate', 'repeat_freq'], 'unique_ci_combi'); - - // connect component - $table->foreign('component_id')->references('id')->on('components')->onDelete('cascade'); - } - ); - } - -} diff --git a/app/database/migrations/2014_07_19_055011_create_limit_repeat_table.php b/app/database/migrations/2014_07_19_055011_create_limit_repeat_table.php deleted file mode 100644 index 46edc87ac9..0000000000 --- a/app/database/migrations/2014_07_19_055011_create_limit_repeat_table.php +++ /dev/null @@ -1,49 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->integer('limit_id')->unsigned(); - $table->date('startdate'); - $table->date('enddate'); - $table->decimal('amount', 10, 2); - - $table->unique(['limit_id', 'startdate', 'enddate']); - - // connect limit - $table->foreign('limit_id')->references('id')->on('limits')->onDelete('cascade'); - } - ); - } - -} diff --git a/app/database/migrations/2014_08_06_044416_create_component_recurring_transaction_table.php b/app/database/migrations/2014_08_06_044416_create_component_recurring_transaction_table.php deleted file mode 100644 index 6105817f64..0000000000 --- a/app/database/migrations/2014_08_06_044416_create_component_recurring_transaction_table.php +++ /dev/null @@ -1,52 +0,0 @@ -increments('id'); - $table->integer('component_id')->unsigned(); - $table->integer('recurring_transaction_id')->unsigned(); - $table->boolean('optional'); - - // link components with component_id - $table->foreign('component_id')->references('id')->on('components')->onDelete('cascade'); - - // link transaction journals with transaction_journal_id - $table->foreign('recurring_transaction_id')->references('id')->on('recurring_transactions')->onDelete('cascade'); - - // component and recurring transaction must be unique. - $table->unique(['component_id', 'recurring_transaction_id'], 'cid_rtid_unique'); - - } - ); - } - -} diff --git a/app/database/migrations/2014_08_12_173919_create_piggybank_repetitions_table.php b/app/database/migrations/2014_08_12_173919_create_piggybank_repetitions_table.php deleted file mode 100644 index 341d36a9d8..0000000000 --- a/app/database/migrations/2014_08_12_173919_create_piggybank_repetitions_table.php +++ /dev/null @@ -1,49 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->integer('piggybank_id')->unsigned(); - $table->date('startdate')->nullable(); - $table->date('targetdate')->nullable(); - $table->decimal('currentamount', 10, 2); - - $table->unique(['piggybank_id', 'startdate', 'targetdate']); - - // connect instance to piggybank. - $table->foreign('piggybank_id')->references('id')->on('piggybanks')->onDelete('cascade'); - } - ); - } - -} diff --git a/app/database/migrations/2014_08_18_100330_create_piggybank_events_table.php b/app/database/migrations/2014_08_18_100330_create_piggybank_events_table.php deleted file mode 100644 index 8eebf01388..0000000000 --- a/app/database/migrations/2014_08_18_100330_create_piggybank_events_table.php +++ /dev/null @@ -1,51 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->integer('piggybank_id')->unsigned(); - $table->integer('transaction_journal_id')->unsigned()->nullable(); - - $table->date('date'); - $table->decimal('amount', 10, 2); - - // connect instance to piggybank. - $table->foreign('piggybank_id')->references('id')->on('piggybanks')->onDelete('cascade'); - - // connect to journal: - $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('set null'); - } - ); - } - -} diff --git a/app/database/migrations/2014_08_23_113221_create_reminders_table.php b/app/database/migrations/2014_08_23_113221_create_reminders_table.php deleted file mode 100644 index 1aaa49fb0a..0000000000 --- a/app/database/migrations/2014_08_23_113221_create_reminders_table.php +++ /dev/null @@ -1,50 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->integer('user_id')->unsigned(); - $table->date('startdate'); - $table->date('enddate')->nullable(); - $table->boolean('active'); - $table->boolean('notnow')->default(0); - $table->integer('remindersable_id')->unsigned()->nullable(); - $table->string('remindersable_type')->nullable(); - - // connect reminders to users - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - } - ); - } - -} diff --git a/app/database/migrations/2014_11_10_172053_create_account_meta_table.php b/app/database/migrations/2014_11_10_172053_create_account_meta_table.php deleted file mode 100644 index 1febb05a1b..0000000000 --- a/app/database/migrations/2014_11_10_172053_create_account_meta_table.php +++ /dev/null @@ -1,49 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->integer('account_id')->unsigned(); - $table->string('name'); - $table->text('data'); - - $table->unique(['account_id', 'name']); - - - } - ); - } - -} diff --git a/app/database/migrations/2014_11_29_135749_create_transaction_groups_table.php b/app/database/migrations/2014_11_29_135749_create_transaction_groups_table.php deleted file mode 100644 index c3d2e3af49..0000000000 --- a/app/database/migrations/2014_11_29_135749_create_transaction_groups_table.php +++ /dev/null @@ -1,48 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->integer('user_id')->unsigned(); - $table->enum('relation', ['balance']); - - // connect reminders to users - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - } - ); - - - } - -} diff --git a/app/database/migrations/2014_11_29_140217_create_transaction_group_transaction_journal_table.php b/app/database/migrations/2014_11_29_140217_create_transaction_group_transaction_journal_table.php deleted file mode 100644 index 7a275b68d6..0000000000 --- a/app/database/migrations/2014_11_29_140217_create_transaction_group_transaction_journal_table.php +++ /dev/null @@ -1,49 +0,0 @@ -increments('id'); - $table->integer('transaction_group_id')->unsigned(); - $table->integer('transaction_journal_id')->unsigned(); - - // link to foreign tables. - $table->foreign('transaction_group_id', 'tr_grp_id')->references('id')->on('transaction_groups')->onDelete('cascade'); - $table->foreign('transaction_journal_id', 'tr_trj_id')->references('id')->on('transaction_journals')->onDelete('cascade'); - - // add unique. - $table->unique(['transaction_group_id', 'transaction_journal_id'], 'tt_joined'); - } - ); - } - -} diff --git a/app/database/migrations/2014_12_13_190730_changes_for_v321.php b/app/database/migrations/2014_12_13_190730_changes_for_v321.php deleted file mode 100644 index 9d5242189d..0000000000 --- a/app/database/migrations/2014_12_13_190730_changes_for_v321.php +++ /dev/null @@ -1,497 +0,0 @@ -moveBudgetsBack(); // 1. - $this->moveCategoriesBack(); // 2. - $this->createComponentId(); // 3. - $this->updateComponentInBudgetLimits(); // 4. - $this->createComponentIdForeignKey(); // 5. - $this->dropBudgetIdColumnInBudgetLimits(); // 6. - $createComponents = new CreateComponentTransactionJournalTable; // 7. - $createComponents->up(); - $this->moveBackEntriesForBudgetsInJoinedTable(); // 8. - $this->moveBackEntriesForCategoriesInJoinedTable(); // 9. - $this->dropBudgetJournalTable(); // 10. - $this->dropCategoryJournalTable(); // 11. - $this->dropBudgetTable(); // 12. - $this->dropCategoryTable(); // 13. - $this->renameBudgetLimits(); // 14. - $this->renamePiggyBankEvents(); // 15. - $this->renameBudgetLimitToBudgetInRepetitions(); // 16. - // 17, 18, 19 - $this->dropFieldsFromCurrencyTable(); // 20. - - - } - - public function moveBudgetsBack() - { - Budget::get()->each( - function (Budget $budget) { - Component::firstOrCreate( - [ - 'name' => $budget->name, - 'user_id' => $budget->user_id, - 'class' => 'Budget' - ] - ); - } - ); - } - - public function moveCategoriesBack() - { - Category::get()->each( - function (Category $category) { - Component::firstOrCreate( - [ - 'name' => $category->name, - 'user_id' => $category->user_id, - 'class' => 'Category' - ] - ); - } - ); - } - - public function createComponentId() - { - Schema::table( - 'budget_limits', function (Blueprint $table) { - $table->integer('component_id')->unsigned(); - } - ); - } - - public function updateComponentInBudgetLimits() - { - BudgetLimit::get()->each( - function (BudgetLimit $bl) { - $budgetId = $bl->budget_id; - $budget = Budget::find($budgetId); - if ($budget) { - $component = Component::where('class', 'Budget')->where('user_id', $budget->user_id)->where('name', $budget->name)->first(); - if ($component) { - $bl->component_id = $component->id; - $bl->save(); - } - } - } - ); - } - - public function createComponentIdForeignKey() - { - Schema::table( - 'budget_limits', function (Blueprint $table) { - $table->foreign('component_id', 'limits_component_id_foreign')->references('id')->on('components')->onDelete('cascade'); - } - ); - } - - public function dropBudgetIdColumnInBudgetLimits() - { - Schema::table( - 'budget_limits', function (Blueprint $table) { - $table->dropForeign('bid_foreign'); - $table->dropColumn('budget_id'); // also drop foreign key! - } - ); - } - - public function moveBackEntriesForBudgetsInJoinedTable() - { - $set = DB::table('budget_transaction_journal')->get(); - foreach ($set as $entry) { - $budget = Budget::find($entry->budget_id); - if ($budget) { - $component = Component::where('class', 'Budget')->where('name', $budget->name)->where('user_id', $budget->user_id)->first(); - if ($component) { - DB::table('component_transaction_journal')->insert( - [ - 'component_id' => $component->id, - 'transaction_journal_id' => $entry->transaction_journal_id - ] - ); - } - - } - } - - } - - public function moveBackEntriesForCategoriesInJoinedTable() - { - $set = DB::table('category_transaction_journal')->get(); - foreach ($set as $entry) { - $category = Category::find($entry->category_id); - if ($category) { - $component = Component::where('class', 'Category')->where('name', $category->name)->where('user_id', $category->user_id)->first(); - if ($component) { - DB::table('component_transaction_journal')->insert( - [ - 'component_id' => $component->id, - 'transaction_journal_id' => $entry->transaction_journal_id - ] - ); - } - - } - } - - } - - public function dropBudgetJournalTable() - { - Schema::dropIfExists('budget_transaction_journal'); - } - - public function dropCategoryJournalTable() - { - Schema::dropIfExists('category_transaction_journal'); - } - - public function dropBudgetTable() - { - Schema::dropIfExists('budgets'); - } - - public function dropCategoryTable() - { - Schema::dropIfExists('categories'); - } - - public function renameBudgetLimits() - { - Schema::rename('budget_limits', 'limits'); - } - - public function renamePiggyBankEvents() - { - Schema::rename('piggy_bank_events', 'piggybank_events'); - - } - - public function renameBudgetLimitToBudgetInRepetitions() - { - Schema::table( - 'limit_repetitions', function (Blueprint $table) { - $table->renameColumn('budget_limit_id', 'limit_id'); - } - ); - } - - public function dropFieldsFromCurrencyTable() - { - - Schema::table( - 'transaction_currencies', function (Blueprint $table) { - $table->dropColumn('symbol'); - $table->dropColumn('name'); - } - ); - } - - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - $this->createBudgetTable(); // 1. - $this->createCategoryTable(); // 2. - $this->createBudgetJournalTable(); // 3 - $this->createCategoryJournalTable(); // 4. - $this->moveBudgets(); // 5. - $this->moveCategories(); // 6. - $this->correctNameForBudgetLimits(); // 7. - $this->correctNameForPiggyBankEvents(); // 8. - $this->renameBudgetToBudgetLimitInRepetitions(); // 9. - $this->addBudgetIdFieldToBudgetLimits(); // 10. - $this->moveComponentIdToBudgetId(); // 11. - $this->dropComponentJournalTable(); // 12. - $this->dropComponentRecurringTransactionTable(); // 13. - $this->dropComponentTransactionTable(); // 14. - $this->dropPiggyBankIdFromTransactions(); // 15. - $this->dropComponentIdFromBudgetLimits(); // 16. - $this->expandCurrencyTable(); // 17. - - } - - public function createBudgetTable() - { - Schema::create( - 'budgets', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->string('name', 50); - $table->integer('user_id')->unsigned(); - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - $table->unique(['user_id', 'name']); - } - ); - - - } - - public function createCategoryTable() - { - Schema::create( - 'categories', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->softDeletes(); - $table->string('name', 50); - $table->integer('user_id')->unsigned(); - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - $table->unique(['user_id', 'name']); - } - ); - } - - public function createBudgetJournalTable() - { - Schema::create( - 'budget_transaction_journal', function (Blueprint $table) { - $table->increments('id'); - $table->integer('budget_id')->unsigned(); - $table->integer('transaction_journal_id')->unsigned(); - $table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade'); - $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade'); - $table->unique(['budget_id', 'transaction_journal_id'], 'budid_tjid_unique'); - } - ); - } - - public function createCategoryJournalTable() - { - Schema::create( - 'category_transaction_journal', function (Blueprint $table) { - $table->increments('id'); - $table->integer('category_id')->unsigned(); - $table->integer('transaction_journal_id')->unsigned(); - $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade'); - $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade'); - $table->unique(['category_id', 'transaction_journal_id'], 'catid_tjid_unique'); - } - ); - } - - public function moveBudgets() - { - Component::where('class', 'Budget')->get()->each( - function (Component $c) { - $entry = [ - 'user_id' => $c->user_id, - 'name' => $c->name - - ]; - $budget = Budget::firstOrCreate($entry); - Log::debug('Migrated budget #' . $budget->id . ': ' . $budget->name); - // create entry in budget_transaction_journal - $connections = DB::table('component_transaction_journal')->where('component_id', $c->id)->get(); - foreach ($connections as $connection) { - DB::table('budget_transaction_journal')->insert( - [ - 'budget_id' => $budget->id, - 'transaction_journal_id' => $connection->transaction_journal_id - ] - ); - } - } - ); - } - - public function moveCategories() - { - Component::where('class', 'Category')->get()->each( - function (Component $c) { - $entry = [ - 'user_id' => $c->user_id, - 'name' => $c->name - - ]; - $category = Category::firstOrCreate($entry); - Log::debug('Migrated category #' . $category->id . ': ' . $category->name); - // create entry in category_transaction_journal - $connections = DB::table('component_transaction_journal')->where('component_id', $c->id)->get(); - foreach ($connections as $connection) { - DB::table('category_transaction_journal')->insert( - [ - 'category_id' => $category->id, - 'transaction_journal_id' => $connection->transaction_journal_id - ] - ); - } - } - ); - } - - public function correctNameForBudgetLimits() - { - Schema::rename('limits', 'budget_limits'); - } - - public function correctNameForPiggyBankEvents() - { - Schema::rename('piggybank_events', 'piggy_bank_events'); - - } - - public function renameBudgetToBudgetLimitInRepetitions() - { - Schema::table( - 'limit_repetitions', function (Blueprint $table) { - $table->renameColumn('limit_id', 'budget_limit_id'); - } - ); - } - - public function addBudgetIdFieldToBudgetLimits() - { - Schema::table( - 'budget_limits', function (Blueprint $table) { - $table->integer('budget_id', false, true)->nullable()->after('updated_at'); - $table->foreign('budget_id', 'bid_foreign')->references('id')->on('budgets')->onDelete('cascade'); - } - ); - } - - public function moveComponentIdToBudgetId() - { - \Log::debug('Now in moveComponentIdToBudgetId()'); - BudgetLimit::get()->each( - function (BudgetLimit $bl) { - \Log::debug('Now at budgetLimit #' . $bl->id . ' with component_id: ' . $bl->component_id); - $component = Component::find($bl->component_id); - if ($component) { - \Log::debug('Found component with id #' . $component->id . ' and name ' . $component->name); - $budget = Budget::whereName($component->name)->whereUserId($component->user_id)->first(); - if ($budget) { - \Log::debug('Found a budget with ID #' . $budget->id . ' and name ' . $budget->name); - $bl->budget_id = $budget->id; - $bl->save(); - \Log::debug('Connected budgetLimit #' . $bl->id . ' to budget_id' . $budget->id); - } else { - \Log::debug('Could not find a matching budget with name ' . $component->name); - } - } else { - \Log::debug('Could not find a component with id ' . $bl->component_id); - } - } - ); - \Log::debug('Done with moveComponentIdToBudgetId()'); - - } - - public function dropComponentJournalTable() - { - Schema::dropIfExists('component_transaction_journal'); - } - - public function dropComponentRecurringTransactionTable() - { - Schema::dropIfExists('component_recurring_transaction'); - } - - public function dropComponentTransactionTable() - { - Schema::dropIfExists('component_transaction'); - } - - public function dropPiggyBankIdFromTransactions() - { - - Schema::table( - 'transactions', function (Blueprint $table) { - if (Schema::hasColumn('transactions', 'piggybank_id')) { - $table->dropForeign('transactions_piggybank_id_foreign'); - $table->dropColumn('piggybank_id'); - } - } - ); - } - - public function dropComponentIdFromBudgetLimits() - { - Schema::table( - 'budget_limits', function (Blueprint $table) { - $table->dropForeign('limits_component_id_foreign'); - $table->dropColumn('component_id'); - } - ); - } - - public function expandCurrencyTable() - { - Schema::table( - 'transaction_currencies', function (Blueprint $table) { - $table->string('name', 48)->nullable(); - $table->string('symbol', 8)->nullable(); - } - ); - \DB::update('UPDATE `transaction_currencies` SET `symbol` = "€", `name` = "Euro" WHERE `code` = "EUR";'); - } - - -} diff --git a/app/database/migrations/2014_12_24_191544_changes_for_v322.php b/app/database/migrations/2014_12_24_191544_changes_for_v322.php deleted file mode 100644 index 5b5e7abff2..0000000000 --- a/app/database/migrations/2014_12_24_191544_changes_for_v322.php +++ /dev/null @@ -1,172 +0,0 @@ -renameColumn('piggy_bank_id', 'piggybank_id'); - } - ); - - Schema::table( - 'piggybank_repetitions', function (Blueprint $table) { - $table->renameColumn('piggy_bank_id', 'piggybank_id'); - } - ); - - // remove soft delete to piggy banks - Schema::table( - 'piggybanks', function (Blueprint $table) { - $table->dropSoftDeletes(); - } - ); - - // drop keys from bills (foreign bills_uid_for and unique uid_name_unique) - Schema::table( - 'bills', function (Blueprint $table) { - $table->dropForeign('bills_uid_for'); - $table->dropUnique('uid_name_unique'); - } - ); - // drop foreign key from transaction_journals (bill_id_foreign) - Schema::table( - 'transaction_journals', function (Blueprint $table) { - $table->dropForeign('bill_id_foreign'); - - } - ); - - // drop foreign key from budget_limits: - Schema::table( - 'budget_limits', function (Blueprint $table) { - $table->dropForeign('bid_foreign'); - $table->dropUnique('unique_bl_combi'); - } - ); - - // rename bills to recurring_transactions - Schema::rename('bills', 'recurring_transactions'); - // recreate foreign key recurring_transactions_user_id_foreign in recurring_transactions - // recreate unique recurring_transactions_user_id_name_unique in recurring_transactions - Schema::table( - 'recurring_transactions', function (Blueprint $table) { - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - $table->unique(['user_id', 'name']); - } - ); - - // rename bill_id to recurring_transaction_id - // recreate foreign transaction_journals_recurring_transaction_id_foreign in transaction_journals - Schema::table( - 'transaction_journals', function (Blueprint $table) { - $table->renameColumn('bill_id', 'recurring_transaction_id'); - $table->foreign('recurring_transaction_id')->references('id')->on('recurring_transactions')->onDelete('set null'); - } - ); - - - } - - - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - // rename tables: - Schema::rename('piggybank_repetitions', 'piggy_bank_repetitions'); - Schema::rename('piggybanks', 'piggy_banks'); - - // recreate it the correct way: - Schema::table( - 'budget_limits', function (Blueprint $table) { - $table->unique(['budget_id', 'startdate', 'repeat_freq'], 'unique_bl_combi'); - } - ); - - // rename fields - Schema::table( - 'piggy_bank_events', function (Blueprint $table) { - $table->renameColumn('piggybank_id', 'piggy_bank_id'); - } - ); - - Schema::table( - 'piggy_bank_repetitions', function (Blueprint $table) { - $table->renameColumn('piggybank_id', 'piggy_bank_id'); - } - ); - - // add soft delete to piggy banks - Schema::table( - 'piggy_banks', function (Blueprint $table) { - $table->softDeletes(); - } - ); - - // rename everything related to recurring transactions, aka bills: - Schema::table( - 'transaction_journals', function (Blueprint $table) { - - - // drop relation - $table->dropForeign('transaction_journals_recurring_transaction_id_foreign'); - // rename column - $table->renameColumn('recurring_transaction_id', 'bill_id'); - - } - ); - - Schema::table( - 'recurring_transactions', function (Blueprint $table) { - $table->dropForeign('recurring_transactions_user_id_foreign'); - $table->dropUnique('recurring_transactions_user_id_name_unique'); - } - ); - // rename table: - Schema::rename('recurring_transactions', 'bills'); - - // recreate foreign relation: - Schema::table( - 'transaction_journals', function (Blueprint $table) { - $table->foreign('bill_id', 'bill_id_foreign')->references('id')->on('bills')->onDelete('set null'); - } - ); - - // recreate more foreign relations. - Schema::table( - 'bills', function (Blueprint $table) { - // connect user id to users - $table->foreign('user_id', 'bills_uid_for')->references('id')->on('users')->onDelete('cascade'); - - // for a user, the name must be unique - $table->unique(['user_id', 'name'], 'uid_name_unique'); - } - ); - - - } - -} diff --git a/app/database/migrations/2015_01_18_082406_changes_for_v325.php b/app/database/migrations/2015_01_18_082406_changes_for_v325.php deleted file mode 100644 index 32a4d2e769..0000000000 --- a/app/database/migrations/2015_01_18_082406_changes_for_v325.php +++ /dev/null @@ -1,62 +0,0 @@ -dropUnique('unique_ci_combi'); - - } - ); - } catch (PDOException $e) { - // don't care. - } - - // allow journal descriptions to be encrypted. - Schema::table( - 'transaction_journals', function (Blueprint $table) { - $table->boolean('encrypted')->default(0); - - } - ); - try { - DB::update('ALTER TABLE `transaction_journals` MODIFY `description` VARCHAR(1024)'); - } catch (PDOException $e) { - // don't care. - } - - } - -} diff --git a/app/database/seeds/.gitkeep b/app/database/seeds/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/app/database/seeds/AccountTypeSeeder.php b/app/database/seeds/AccountTypeSeeder.php deleted file mode 100644 index 93523755ac..0000000000 --- a/app/database/seeds/AccountTypeSeeder.php +++ /dev/null @@ -1,24 +0,0 @@ -delete(); - - AccountType::create(['type' => 'Default account', 'editable' => true]); - AccountType::create(['type' => 'Cash account', 'editable' => false]); - AccountType::create(['type' => 'Asset account', 'editable' => true]); - AccountType::create(['type' => 'Expense account', 'editable' => true]); - AccountType::create(['type' => 'Revenue account', 'editable' => true]); - AccountType::create(['type' => 'Initial balance account', 'editable' => false]); - AccountType::create(['type' => 'Beneficiary account', 'editable' => true]); - AccountType::create(['type' => 'Import account', 'editable' => false]); - } - - -} diff --git a/app/database/seeds/DatabaseSeeder.php b/app/database/seeds/DatabaseSeeder.php deleted file mode 100644 index 9912f3c281..0000000000 --- a/app/database/seeds/DatabaseSeeder.php +++ /dev/null @@ -1,27 +0,0 @@ -call('AccountTypeSeeder'); - $this->call('TransactionCurrencySeeder'); - $this->call('TransactionTypeSeeder'); - - if (App::environment() == 'testing' || App::environment() == 'homestead') { - $this->call('TestDataSeeder'); - } - } - -} diff --git a/app/database/seeds/TestDataSeeder.php b/app/database/seeds/TestDataSeeder.php deleted file mode 100644 index 0c3de6f0af..0000000000 --- a/app/database/seeds/TestDataSeeder.php +++ /dev/null @@ -1,609 +0,0 @@ -_startOfMonth = Carbon::now()->startOfMonth(); - $this->som = $this->_startOfMonth->format('Y-m-d'); - $this->_endOfMonth = Carbon::now()->endOfMonth(); - $this->eom = $this->_endOfMonth->format('Y-m-d'); - $this->_nextStartOfMonth = Carbon::now()->addMonth()->startOfMonth(); - $this->nsom = $this->_nextStartOfMonth->format('Y-m-d'); - $this->_nextEndOfMonth = Carbon::now()->addMonth()->endOfMonth(); - $this->neom = $this->_nextEndOfMonth->format('Y-m-d'); - $this->_yearAgoStartOfMonth = Carbon::now()->subYear()->startOfMonth(); - $this->yasom = $this->_yearAgoStartOfMonth->format('Y-m-d'); - $this->_yearAgoEndOfMonth = Carbon::now()->subYear()->startOfMonth(); - $this->yaeom = $this->_yearAgoEndOfMonth->format('Y-m-d'); - $this->_today = Carbon::now(); - $this->today = $this->_today->format('Y-m-d'); - } - - /** - * Dates are always this month, the start of this month or earlier. - */ - public function run() - { - $this->createUsers(); - $this->createAssetAccounts(); - $this->createBudgets(); - $this->createCategories(); - $this->createPiggyBanks(); - $this->createReminders(); - $this->createRecurringTransactions(); - $this->createBills(); - $this->createExpenseAccounts(); - $this->createRevenueAccounts(); - - $current = clone $this->_yearAgoStartOfMonth; - while ($current <= $this->_startOfMonth) { - - // create expenses for rent, utilities, TV, phone on the 1st of the month. - $this->createMonthlyExpenses(clone $current); - $this->createGroceries(clone $current); - $this->createBigExpense(clone $current); - - echo 'Created test-content for ' . $current->format('F Y') . "\n"; - $current->addMonth(); - } - $this->createPiggyBankEvent(); - - - } - - /** - * - */ - public function createUsers() - { - User::create(['email' => 'reset@example.com', 'password' => 'functional', 'reset' => 'okokokokokokokokokokokokokokokok', 'remember_token' => null]); - User::create(['email' => 'functional@example.com', 'password' => 'functional', 'reset' => null, 'remember_token' => null]); - User::create(['email' => 'thegrumpydictator@gmail.com', 'password' => 'james', 'reset' => null, 'remember_token' => null]); - } - - /** - * - */ - public function createAssetAccounts() - { - $user = User::whereEmail('thegrumpydictator@gmail.com')->first(); - $assetType = AccountType::whereType('Asset account')->first(); - $ibType = AccountType::whereType('Initial balance account')->first(); - $obType = TransactionType::whereType('Opening balance')->first(); - $euro = TransactionCurrency::whereCode('EUR')->first(); - - - $acc_a = Account::create(['user_id' => $user->id, 'account_type_id' => $assetType->id, 'name' => 'Checking account', 'active' => 1]); - $acc_b = Account::create(['user_id' => $user->id, 'account_type_id' => $assetType->id, 'name' => 'Savings account', 'active' => 1]); - $acc_c = Account::create(['user_id' => $user->id, 'account_type_id' => $assetType->id, 'name' => 'Delete me', 'active' => 1]); - - $acc_d = Account::create(['user_id' => $user->id, 'account_type_id' => $ibType->id, 'name' => 'Checking account initial balance', 'active' => 0]); - $acc_e = Account::create(['user_id' => $user->id, 'account_type_id' => $ibType->id, 'name' => 'Savings account initial balance', 'active' => 0]); - $acc_f = Account::create(['user_id' => $user->id, 'account_type_id' => $ibType->id, 'name' => 'Delete me initial balance', 'active' => 0]); - - $this->createJournal( - ['from' => $acc_d, 'to' => $acc_a, 'amount' => 4000, 'transactionType' => $obType, 'description' => 'Initial Balance for Checking account', - 'date' => $this->yasom, 'transactionCurrency' => $euro] - ); - $this->createJournal( - ['from' => $acc_e, 'to' => $acc_b, 'amount' => 10000, 'transactionType' => $obType, 'description' => 'Initial Balance for Savings account', - 'date' => $this->yasom, 'transactionCurrency' => $euro] - ); - $this->createJournal( - ['from' => $acc_f, 'to' => $acc_c, 'amount' => 100, 'transactionType' => $obType, 'description' => 'Initial Balance for Delete me', - 'date' => $this->yasom, 'transactionCurrency' => $euro] - ); - - - } - - /** - * @param array $data - * - * @return TransactionJournal - */ - public function createJournal(array $data) - { - $user = User::whereEmail('thegrumpydictator@gmail.com')->first(); - $billID = isset($data['bill']) ? $data['bill']->id : null; - - /** @var TransactionJournal $journal */ - $journal = TransactionJournal::create( - [ - 'user_id' => $user->id, - 'transaction_type_id' => $data['transactionType']->id, - 'transaction_currency_id' => $data['transactionCurrency']->id, - 'bill_id' => $billID, - 'description' => $data['description'], - 'completed' => 1, - 'date' => $data['date'] - ] - ); - - Transaction::create(['account_id' => $data['from']->id, 'transaction_journal_id' => $journal->id, 'amount' => $data['amount'] * -1]); - Transaction::create(['account_id' => $data['to']->id, 'transaction_journal_id' => $journal->id, 'amount' => $data['amount']]); - - if (isset($data['budget'])) { - $journal->budgets()->save($data['budget']); - } - if (isset($data['category'])) { - $journal->categories()->save($data['category']); - } - - return $journal; - } - - /** - * - */ - public function createBudgets() - { - $user = User::whereEmail('thegrumpydictator@gmail.com')->first(); - - $groceries = Budget::create(['user_id' => $user->id, 'name' => 'Groceries']); - $bills = Budget::create(['user_id' => $user->id, 'name' => 'Bills']); - $deleteMe = Budget::create(['user_id' => $user->id, 'name' => 'Delete me']); - Budget::create(['user_id' => $user->id, 'name' => 'Budget without repetition']); - $groceriesLimit = BudgetLimit::create( - ['startdate' => $this->som, 'amount' => 201, 'repeats' => 0, 'repeat_freq' => 'monthly', 'budget_id' => $groceries->id] - ); - $billsLimit = BudgetLimit::create( - ['startdate' => $this->som, 'amount' => 202, 'repeats' => 0, 'repeat_freq' => 'monthly', 'budget_id' => $bills->id] - ); - $deleteMeLimit = BudgetLimit::create( - ['startdate' => $this->som, 'amount' => 203, 'repeats' => 0, 'repeat_freq' => 'monthly', 'budget_id' => $deleteMe->id] - ); - - // and because we have no filters, some repetitions: - LimitRepetition::create(['budget_limit_id' => $groceriesLimit->id, 'startdate' => $this->som, 'enddate' => $this->eom, 'amount' => 201]); - LimitRepetition::create(['budget_limit_id' => $billsLimit->id, 'startdate' => $this->som, 'enddate' => $this->eom, 'amount' => 202]); - LimitRepetition::create(['budget_limit_id' => $deleteMeLimit->id, 'startdate' => $this->som, 'enddate' => $this->eom, 'amount' => 203]); - } - - /** - * - */ - public function createCategories() - { - $user = User::whereEmail('thegrumpydictator@gmail.com')->first(); - Category::create(['user_id' => $user->id, 'name' => 'DailyGroceries']); - Category::create(['user_id' => $user->id, 'name' => 'Lunch']); - Category::create(['user_id' => $user->id, 'name' => 'House']); - Category::create(['user_id' => $user->id, 'name' => 'Delete me']); - - } - - /** - * - */ - public function createPiggyBanks() - { - // account - $savings = Account::whereName('Savings account')->orderBy('id', 'DESC')->first(); - - // some dates - $endDate = clone $this->_startOfMonth; - $nextYear = clone $this->_startOfMonth; - - $endDate->addMonths(4); - $nextYear->addYear()->subDay(); - - $next = $nextYear->format('Y-m-d'); - $end = $endDate->format('Y-m-d'); - - // piggy bank - $newCamera = PiggyBank::create( - [ - 'account_id' => $savings->id, - 'name' => 'New camera', - 'targetamount' => 2000, - 'startdate' => $this->som, - 'targetdate' => null, - 'repeats' => 0, - 'rep_length' => null, - 'rep_every' => 0, - 'rep_times' => null, - 'reminder' => null, - 'reminder_skip' => 0, - 'remind_me' => 0, - 'order' => 0, - ] - ); - // and some events! - PiggyBankEvent::create(['piggy_bank_id' => $newCamera->id, 'date' => $this->som, 'amount' => 100]); - PiggyBankRepetition::create(['piggy_bank_id' => $newCamera->id, 'startdate' => $this->som, 'targetdate' => null, 'currentamount' => 100]); - - - $newClothes = PiggyBank::create( - [ - 'account_id' => $savings->id, - 'name' => 'New clothes', - 'targetamount' => 2000, - 'startdate' => $this->som, - 'targetdate' => $end, - 'repeats' => 0, - 'rep_length' => null, - 'rep_every' => 0, - 'rep_times' => null, - 'reminder' => null, - 'reminder_skip' => 0, - 'remind_me' => 0, - 'order' => 0, - ] - ); - - PiggyBankEvent::create(['piggy_bank_id' => $newClothes->id, 'date' => $this->som, 'amount' => 100]); - PiggyBankRepetition::create(['piggy_bank_id' => $newClothes->id, 'startdate' => $this->som, 'targetdate' => $end, 'currentamount' => 100]); - - // weekly reminder piggy bank - $weekly = PiggyBank::create( - [ - 'account_id' => $savings->id, - 'name' => 'Weekly reminder for clothes', - 'targetamount' => 2000, - 'startdate' => $this->som, - 'targetdate' => $next, - 'repeats' => 0, - 'rep_length' => null, - 'rep_every' => 0, - 'rep_times' => null, - 'reminder' => 'week', - 'reminder_skip' => 0, - 'remind_me' => 1, - 'order' => 0, - ] - ); - PiggyBankRepetition::create(['piggy_bank_id' => $weekly->id, 'startdate' => $this->som, 'targetdate' => $next, 'currentamount' => 0]); - } - - /** - * - */ - public function createReminders() - { - $user = User::whereEmail('thegrumpydictator@gmail.com')->first(); - // for weekly piggy bank (clothes) - $nextWeek = clone $this->_startOfMonth; - $piggyBank = PiggyBank::whereName('New clothes')->orderBy('id', 'DESC')->first(); - $nextWeek->addWeek(); - $week = $nextWeek->format('Y-m-d'); - - Reminder::create( - ['user_id' => $user->id, 'startdate' => $this->som, 'enddate' => $week, 'active' => 1, 'notnow' => 0, - 'remindersable_id' => $piggyBank->id, 'remindersable_type' => 'PiggyBank'] - ); - - // a fake reminder:: - Reminder::create( - ['user_id' => $user->id, 'startdate' => $this->som, 'enddate' => $week, 'active' => 0, 'notnow' => 0, 'remindersable_id' => 40, - 'remindersable_type' => 'Transaction'] - ); - } - - /** - * - */ - public function createRecurringTransactions() - { - // account - $savings = Account::whereName('Savings account')->orderBy('id', 'DESC')->first(); - $user = User::whereEmail('thegrumpydictator@gmail.com')->first(); - - $recurring = PiggyBank::create( - [ - 'account_id' => $savings->id, - 'name' => 'Nieuwe spullen', - 'targetamount' => 1000, - 'startdate' => $this->som, - 'targetdate' => $this->eom, - 'repeats' => 1, - 'rep_length' => 'month', - 'rep_every' => 0, - 'rep_times' => 0, - 'reminder' => 'month', - 'reminder_skip' => 0, - 'remind_me' => 1, - 'order' => 0, - ] - ); - PiggyBankRepetition::create(['piggy_bank_id' => $recurring->id, 'startdate' => $this->som, 'targetdate' => $this->eom, 'currentamount' => 0]); - PiggyBankRepetition::create( - ['piggy_bank_id' => $recurring->id, 'startdate' => $this->nsom, 'targetdate' => $this->neom, 'currentamount' => 0] - ); - Reminder::create( - ['user_id' => $user->id, 'startdate' => $this->som, 'enddate' => $this->neom, 'active' => 1, 'notnow' => 0, - 'remindersable_id' => $recurring->id, 'remindersable_type' => 'PiggyBank'] - ); - } - - /** - * - */ - public function createBills() - { - $user = User::whereEmail('thegrumpydictator@gmail.com')->first(); - // bill - Bill::create( - ['user_id' => $user->id, 'name' => 'Rent', 'match' => 'rent,landlord', 'amount_min' => 700, 'amount_max' => 900, 'date' => $this->som, - 'active' => 1, 'automatch' => 1, 'repeat_freq' => 'monthly', 'skip' => 0,] - ); - - // bill - Bill::create( - [ - 'user_id' => $user->id, - 'name' => 'Gas licht', - 'match' => 'no,match', - 'amount_min' => 500, 'amount_max' => 700, - 'date' => $this->som, - 'active' => 1, 'automatch' => 1, - 'repeat_freq' => 'monthly', 'skip' => 0, - ] - ); - - // bill - Bill::create( - [ - 'user_id' => $user->id, - 'name' => 'Something something', - 'match' => 'mumble,mumble', - 'amount_min' => 500, - 'amount_max' => 700, - 'date' => $this->som, - 'active' => 0, - 'automatch' => 1, - 'repeat_freq' => 'monthly', - 'skip' => 0, - ] - ); - - } - - /** - * - */ - public function createExpenseAccounts() - { - //// create expenses for rent, utilities, water, TV, phone on the 1st of the month. - $user = User::whereEmail('thegrumpydictator@gmail.com')->first(); - $expenseType = AccountType::whereType('Expense account')->first(); - - Account::create(['user_id' => $user->id, 'account_type_id' => $expenseType->id, 'name' => 'Land lord', 'active' => 1]); - Account::create(['user_id' => $user->id, 'account_type_id' => $expenseType->id, 'name' => 'Utilities company', 'active' => 1]); - Account::create(['user_id' => $user->id, 'account_type_id' => $expenseType->id, 'name' => 'Water company', 'active' => 1]); - Account::create(['user_id' => $user->id, 'account_type_id' => $expenseType->id, 'name' => 'TV company', 'active' => 1]); - Account::create(['user_id' => $user->id, 'account_type_id' => $expenseType->id, 'name' => 'Phone agency', 'active' => 1]); - Account::create(['user_id' => $user->id, 'account_type_id' => $expenseType->id, 'name' => 'Super savers', 'active' => 1]); - Account::create(['user_id' => $user->id, 'account_type_id' => $expenseType->id, 'name' => 'Groceries House', 'active' => 1]); - Account::create(['user_id' => $user->id, 'account_type_id' => $expenseType->id, 'name' => 'Lunch House', 'active' => 1]); - - - Account::create(['user_id' => $user->id, 'account_type_id' => $expenseType->id, 'name' => 'Buy More', 'active' => 1]); - - } - - /** - * - */ - public function createRevenueAccounts() - { - $user = User::whereEmail('thegrumpydictator@gmail.com')->first(); - $revenueType = AccountType::whereType('Revenue account')->first(); - - Account::create(['user_id' => $user->id, 'account_type_id' => $revenueType->id, 'name' => 'Employer', 'active' => 1]); - Account::create(['user_id' => $user->id, 'account_type_id' => $revenueType->id, 'name' => 'IRS', 'active' => 1]); - Account::create(['user_id' => $user->id, 'account_type_id' => $revenueType->id, 'name' => 'Second job employer', 'active' => 1]); - - } - - /** - * @param Carbon $date - */ - public function createMonthlyExpenses(Carbon $date) - { - // get some objects from the database: - $checking = Account::whereName('Checking account')->orderBy('id', 'DESC')->first(); - $savings = Account::whereName('Savings account')->orderBy('id', 'DESC')->first(); - $landLord = Account::whereName('Land lord')->orderBy('id', 'DESC')->first(); - $utilities = Account::whereName('Utilities company')->orderBy('id', 'DESC')->first(); - $television = Account::whereName('TV company')->orderBy('id', 'DESC')->first(); - $phone = Account::whereName('Phone agency')->orderBy('id', 'DESC')->first(); - $employer = Account::whereName('Employer')->orderBy('id', 'DESC')->first(); - $bills = Budget::whereName('Bills')->orderBy('id', 'DESC')->first(); - $house = Category::whereName('House')->orderBy('id', 'DESC')->first(); - $withdrawal = TransactionType::whereType('Withdrawal')->first(); - $deposit = TransactionType::whereType('Deposit')->first(); - $transfer = TransactionType::whereType('Transfer')->first(); - $euro = TransactionCurrency::whereCode('EUR')->first(); - $rentBill = Bill::where('name', 'Rent')->first(); - $cur = $date->format('Y-m-d'); - $formatted = $date->format('F Y'); - - $this->createJournal( - ['from' => $checking, 'to' => $landLord, 'amount' => 800, 'transactionType' => $withdrawal, 'description' => 'Rent for ' . $formatted, - 'date' => $cur, 'transactionCurrency' => $euro, 'budget' => $bills, 'category' => $house, 'bill' => $rentBill] - ); - $this->createJournal( - ['from' => $checking, 'to' => $utilities, 'amount' => 150, 'transactionType' => $withdrawal, 'description' => 'Utilities for ' . $formatted, - 'date' => $cur, 'transactionCurrency' => $euro, 'budget' => $bills, 'category' => $house,] - ); - $this->createJournal( - ['from' => $checking, 'to' => $television, 'amount' => 50, 'transactionType' => $withdrawal, 'description' => 'TV for ' . $formatted, - 'date' => $cur, 'transactionCurrency' => $euro, 'budget' => $bills, 'category' => $house,] - ); - $this->createJournal( - ['from' => $checking, 'to' => $phone, 'amount' => 50, 'transactionType' => $withdrawal, 'description' => 'Phone bill for ' . $formatted, - 'date' => $cur, 'transactionCurrency' => $euro, 'budget' => $bills, 'category' => $house,] - ); - - // two transactions. One without a budget, one without a category. - $this->createJournal( - ['from' => $checking, 'to' => $phone, 'amount' => 10, 'transactionType' => $withdrawal, - 'description' => 'Extra charges on phone bill for ' . $formatted, 'date' => $cur, 'transactionCurrency' => $euro, 'category' => $house] - ); - $this->createJournal( - ['from' => $checking, 'to' => $television, 'amount' => 5, 'transactionType' => $withdrawal, - 'description' => 'Extra charges on TV bill for ' . $formatted, 'date' => $cur, 'transactionCurrency' => $euro, 'budget' => $bills] - ); - - // income from job: - $this->createJournal( - ['from' => $employer, 'to' => $checking, 'amount' => rand(3500, 4000), 'transactionType' => $deposit, 'description' => 'Salary for ' . $formatted, - 'date' => $cur, 'transactionCurrency' => $euro] - ); - $this->createJournal( - ['from' => $checking, 'to' => $savings, 'amount' => 2000, 'transactionType' => $transfer, - 'description' => 'Salary to savings account in ' . $formatted, 'date' => $cur, 'transactionCurrency' => $euro] - ); - - } - - /** - * @param Carbon $date - */ - public function createGroceries(Carbon $date) - { - // variables we need: - $checking = Account::whereName('Checking account')->orderBy('id', 'DESC')->first(); - $shopOne = Account::whereName('Groceries House')->orderBy('id', 'DESC')->first(); - $shopTwo = Account::whereName('Super savers')->orderBy('id', 'DESC')->first(); - $lunchHouse = Account::whereName('Lunch House')->orderBy('id', 'DESC')->first(); - $lunch = Category::whereName('Lunch')->orderBy('id', 'DESC')->first(); - $daily = Category::whereName('DailyGroceries')->orderBy('id', 'DESC')->first(); - $euro = TransactionCurrency::whereCode('EUR')->first(); - $withdrawal = TransactionType::whereType('Withdrawal')->first(); - $groceries = Budget::whereName('Groceries')->orderBy('id', 'DESC')->first(); - - - $shops = [$shopOne, $shopTwo]; - - // create groceries and lunch (daily, between 5 and 10 euro). - $mStart = clone $date; - $mEnd = clone $date; - $mEnd->endOfMonth(); - while ($mStart <= $mEnd) { - $mFormat = $mStart->format('Y-m-d'); - $shop = $shops[rand(0, 1)]; - - $this->createJournal( - ['from' => $checking, 'to' => $shop, 'amount' => (rand(500, 1000) / 100), 'transactionType' => $withdrawal, 'description' => 'Groceries', - 'date' => $mFormat, 'transactionCurrency' => $euro, 'category' => $daily, 'budget' => $groceries] - ); - $this->createJournal( - ['from' => $checking, 'to' => $lunchHouse, 'amount' => (rand(200, 600) / 100), 'transactionType' => $withdrawal, 'description' => 'Lunch', - 'date' => $mFormat, 'transactionCurrency' => $euro, 'category' => $lunch, 'budget' => $groceries] - ); - - $mStart->addDay(); - } - } - - /** - * @param $date - */ - public function createBigExpense($date) - { - $date->addDays(12); - $dollar = TransactionCurrency::whereCode('USD')->first(); - $checking = Account::whereName('Checking account')->orderBy('id', 'DESC')->first(); - $savings = Account::whereName('Savings account')->orderBy('id', 'DESC')->first(); - $buyMore = Account::whereName('Buy More')->orderBy('id', 'DESC')->first(); - $withdrawal = TransactionType::whereType('Withdrawal')->first(); - $user = User::whereEmail('thegrumpydictator@gmail.com')->first(); - - - // create some big expenses, move some money around. - $amount = rand(500, 2000); - - $one = $this->createJournal( - ['from' => $savings, 'to' => $checking, 'amount' => $amount, 'transactionType' => $withdrawal, - 'description' => 'Money for big expense in ' . $date->format('F Y'), 'date' => $date->format('Y-m-d'), 'transactionCurrency' => $dollar] - ); - $two = $this->createJournal( - ['from' => $checking, 'to' => $buyMore, 'amount' => $amount, 'transactionType' => $withdrawal, - 'description' => 'Big expense in ' . $date->format('F Y'), 'date' => $date->format('Y-m-d'), 'transactionCurrency' => $dollar] - ); - $group = TransactionGroup::create( - [ - 'user_id' => $user->id, - 'relation' => 'balance' - ] - ); - $group->transactionjournals()->save($one); - $group->transactionjournals()->save($two); - $group->save(); - } - - /** - * - */ - protected function createPiggyBankEvent() - { - // piggy bank event - // add money to this piggy bank - // create a piggy bank event to match: - $checking = Account::whereName('Checking account')->orderBy('id', 'DESC')->first(); - $savings = Account::whereName('Savings account')->orderBy('id', 'DESC')->first(); - $transfer = TransactionType::whereType('Transfer')->first(); - $euro = TransactionCurrency::whereCode('EUR')->first(); - $groceries = Budget::whereName('Groceries')->orderBy('id', 'DESC')->first(); - $house = Category::whereName('House')->orderBy('id', 'DESC')->first(); - $piggyBank = PiggyBank::whereName('New camera')->orderBy('id', 'DESC')->first(); - $intoPiggy = $this->createJournal( - ['from' => $checking, 'to' => $savings, 'amount' => 100, 'transactionType' => $transfer, 'description' => 'Money for piggy', - 'date' => $this->yaeom, 'transactionCurrency' => $euro, 'category' => $house, 'budget' => $groceries] - ); - PiggyBankEvent::create( - [ - 'piggy_bank_id' => $piggyBank->id, - 'transaction_journal_id' => $intoPiggy->id, - 'date' => $this->yaeom, - 'amount' => 100 - ] - ); - } - - -} \ No newline at end of file diff --git a/app/database/seeds/TransactionCurrencySeeder.php b/app/database/seeds/TransactionCurrencySeeder.php deleted file mode 100644 index 6bf2eb7010..0000000000 --- a/app/database/seeds/TransactionCurrencySeeder.php +++ /dev/null @@ -1,18 +0,0 @@ -delete(); - - TransactionCurrency::create(['code' => 'EUR','name' => 'Euro','symbol' => '€']); - TransactionCurrency::create(['code' => 'USD','name' => 'US Dollar','symbol' => '$']); - TransactionCurrency::create(['code' => 'HUF','name' => 'Hungarian forint','symbol' => 'Ft']); - } - -} diff --git a/app/database/seeds/TransactionTypeSeeder.php b/app/database/seeds/TransactionTypeSeeder.php deleted file mode 100644 index cf0e6a5e12..0000000000 --- a/app/database/seeds/TransactionTypeSeeder.php +++ /dev/null @@ -1,20 +0,0 @@ -delete(); - - TransactionType::create(['type' => 'Withdrawal']); - TransactionType::create(['type' => 'Deposit']); - TransactionType::create(['type' => 'Transfer']); - TransactionType::create(['type' => 'Opening balance']); - } - -} diff --git a/app/filters.php b/app/filters.php deleted file mode 100644 index 27e9264440..0000000000 --- a/app/filters.php +++ /dev/null @@ -1,104 +0,0 @@ -with('message', 'Not possible'); - } -} -); diff --git a/app/lang/en/pagination.php b/app/lang/en/pagination.php deleted file mode 100644 index 88e22db661..0000000000 --- a/app/lang/en/pagination.php +++ /dev/null @@ -1,20 +0,0 @@ - '« Previous', - - 'next' => 'Next »', - -]; diff --git a/app/lang/en/reminders.php b/app/lang/en/reminders.php deleted file mode 100644 index a416c65cb5..0000000000 --- a/app/lang/en/reminders.php +++ /dev/null @@ -1,24 +0,0 @@ - "Passwords must be at least six characters and match the confirmation.", - - "user" => "We can't find a user with that e-mail address.", - - "token" => "This password reset token is invalid.", - - "sent" => "Password reminder sent!", - -]; diff --git a/app/lang/en/validation.php b/app/lang/en/validation.php deleted file mode 100644 index e6ee8b9253..0000000000 --- a/app/lang/en/validation.php +++ /dev/null @@ -1,105 +0,0 @@ - "The :attribute must be accepted.", - "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.", - "before" => "The :attribute must be a date before :date.", - "between" => [ - "numeric" => "The :attribute must be between :min and :max.", - "file" => "The :attribute must be between :min and :max kilobytes.", - "string" => "The :attribute must be between :min and :max characters.", - "array" => "The :attribute must have between :min and :max items.", - ], - "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.", - "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.", - "max" => [ - "numeric" => "The :attribute may not be greater than :max.", - "file" => "The :attribute may not be greater than :max kilobytes.", - "string" => "The :attribute may not be greater than :max characters.", - "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.", - "file" => "The :attribute must be at least :min kilobytes.", - "string" => "The :attribute must be at least :min characters.", - "array" => "The :attribute must have at least :min items.", - ], - "not_in" => "The selected :attribute is invalid.", - "numeric" => "The :attribute must be a number.", - "regex" => "The :attribute format is invalid.", - "required" => "The :attribute field is required.", - "required_if" => "The :attribute field is required when :other is :value.", - "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.", - "file" => "The :attribute must be :size kilobytes.", - "string" => "The :attribute must be :size characters.", - "array" => "The :attribute must contain :size items.", - ], - "unique" => "The :attribute has already been taken.", - "url" => "The :attribute format is invalid.", - - /* - |-------------------------------------------------------------------------- - | Custom Validation Language Lines - |-------------------------------------------------------------------------- - | - | Here you may specify custom validation messages for attributes using the - | convention "attribute.rule" to name the lines. This makes it quick to - | specify a specific custom language line for a given attribute rule. - | - */ - - 'custom' => [ - 'attribute-name' => [ - 'rule-name' => 'custom-message', - ], - ], - 'alphabasic' => 'The :attribute field must consist of basic alphanumeric characters.', - - /* - |-------------------------------------------------------------------------- - | Custom Validation Attributes - |-------------------------------------------------------------------------- - | - | The following language lines are used to swap attribute place-holders - | with something more reader friendly such as E-Mail Address instead - | of "email". This simply helps us make messages a little cleaner. - | - */ - - 'attributes' => [], - -]; diff --git a/app/lib/FireflyIII/Chart/Chart.php b/app/lib/FireflyIII/Chart/Chart.php deleted file mode 100644 index 6d01ddaecd..0000000000 --- a/app/lib/FireflyIII/Chart/Chart.php +++ /dev/null @@ -1,76 +0,0 @@ -on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('amount', '>', 0); - } - ) - ->leftJoin( - 'category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id' - ) - ->leftJoin('categories', 'categories.id', '=', 'category_transaction_journal.category_id') - ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') - ->before($end) - ->after($start) - ->where('transaction_types.type', 'Withdrawal') - ->groupBy('categories.id') - ->orderBy('sum', 'DESC') - ->get(['categories.id', 'categories.name', \DB::Raw('SUM(`transactions`.`amount`) AS `sum`')]); - } - - /** - * @param Carbon $start - * @param Carbon $end - * - * @return Collection - */ - public function getBillsSummary(Carbon $start, Carbon $end) - { - return \Bill:: - leftJoin( - 'transaction_journals', function (JoinClause $join) use ($start, $end) { - $join->on('bills.id', '=', 'transaction_journals.bill_id') - ->where('transaction_journals.date', '>=', $start->format('Y-m-d')) - ->where('transaction_journals.date', '<=', $end->format('Y-m-d')); - } - ) - ->leftJoin( - 'transactions', function (JoinClause $join) { - $join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '>', 0); - } - ) - ->where('active', 1) - ->groupBy('bills.id') - ->get( - ['bills.id', 'bills.name', 'transaction_journals.description', - 'transaction_journals.encrypted', - 'transaction_journals.id as journalId', - \DB::Raw('SUM(`bills`.`amount_min` + `bills`.`amount_max`) / 2 as `averageAmount`'), - 'transactions.amount AS actualAmount'] - ); - } -} diff --git a/app/lib/FireflyIII/Chart/ChartInterface.php b/app/lib/FireflyIII/Chart/ChartInterface.php deleted file mode 100644 index 62a2efa868..0000000000 --- a/app/lib/FireflyIII/Chart/ChartInterface.php +++ /dev/null @@ -1,31 +0,0 @@ -reminder)) { - $this->reminder = $this->repetition->piggyBank->reminders()->where('startdate', $this->getStartdate()->format('Y-m-d'))->where( - 'enddate', $this->getTargetdate()->format('Y-m-d') - )->first(); - } - - return $this->reminder; - } - - /** - * @param \Reminder $reminder - */ - public function setReminder($reminder) - { - $this->reminder = $reminder; - } - - /** - * @return Carbon - */ - public function getStartdate() - { - return $this->startdate; - } - - /** - * @param Carbon $startdate - */ - public function setStartdate($startdate) - { - $this->startdate = $startdate; - } - - /** - * @return Carbon - */ - public function getTargetdate() - { - return $this->targetdate; - } - - /** - * @param Carbon $targetdate - */ - public function setTargetdate($targetdate) - { - $this->targetdate = $targetdate; - } - - /** - * @return \PiggyBankRepetition - */ - public function getRepetition() - { - return $this->repetition; - } - - /** - * @param \PiggyBankRepetition $repetition - */ - public function setRepetition($repetition) - { - $this->repetition = $repetition; - } - - /** - * @return bool - */ - public function hasReminder() - { - return !is_null($this->reminder); - } - - /** - * @return float|int - */ - public function percentage() - { - if ($this->getCurrentamount() < $this->getCumulativeAmount()) { - $pct = 0; - // calculate halfway point? - if ($this->getCumulativeAmount() - $this->getCurrentamount() < $this->getAmountPerBar()) { - $left = $this->getCurrentamount() % $this->getAmountPerBar(); - $pct = round($left / $this->getAmountPerBar() * 100); - } - - return $pct; - } else { - return 100; - } - } - - /** - * @return float - */ - public function getCurrentamount() - { - return $this->currentamount; - } - - /** - * @param float $currentamount - */ - public function setCurrentamount($currentamount) - { - $this->currentamount = $currentamount; - } - - /** - * @return float - */ - public function getCumulativeAmount() - { - return $this->cumulativeAmount; - } - - /** - * @param float $cumulativeAmount - */ - public function setCumulativeAmount($cumulativeAmount) - { - $this->cumulativeAmount = $cumulativeAmount; - } - - /** - * @return float - */ - public function getAmountPerBar() - { - return $this->amountPerBar; - } - - /** - * @param float $amountPerBar - */ - public function setAmountPerBar($amountPerBar) - { - $this->amountPerBar = $amountPerBar; - } - - -} diff --git a/app/lib/FireflyIII/Database/Account/Account.php b/app/lib/FireflyIII/Database/Account/Account.php deleted file mode 100644 index 816274cc49..0000000000 --- a/app/lib/FireflyIII/Database/Account/Account.php +++ /dev/null @@ -1,534 +0,0 @@ -setUser(\Auth::user()); - } - - /** - * @param array $types - * - * @return int - */ - public function countAccountsByType(array $types) - { - return $this->getUser()->accounts()->accountTypeIn($types)->count(); - } - - /** - * @param array $types - * - * @return Collection - */ - public function getAccountsByType(array $types) - { - /* - * Basic query: - */ - $query = $this->getUser()->accounts()->accountTypeIn($types)->withMeta()->orderBy('name', 'ASC');; - $set = $query->get(['accounts.*', 'account_meta.data as accountRole']); - - $set->each( - function (\Account $account) { - /* - * Get last activity date. - */ - $account->lastActivityDate = $this->getLastActivity($account); - $account->accountRole = \Config::get('firefly.accountRoles.' . json_decode($account->accountRole)); - } - ); - - return $set; - } - - /** - * @param \Account $account - * - * @return \TransactionJournal|null - */ - public function openingBalanceTransaction(\Account $account) - { - - $first = \TransactionJournal::withRelevantData()->accountIs($account) - ->orderBy('transaction_journals.date', 'ASC') - ->orderBy('created_at', 'ASC') - ->first(['transaction_journals.*']); - $initial = strpos(strtolower($first->description), 'initial'); - $opening = strpos(strtolower($first->description), 'opening'); - if ($initial === false && $opening === false) { - return null; - } - - return $first; - - } - - /** - * @param \Account $account - * @param array $data - * - * @return bool - */ - public function storeInitialBalance(\Account $account, array $data) - { - /** @var \FireflyIII\Database\TransactionType\TransactionType $typeRepository */ - $typeRepository = \App::make('FireflyIII\Database\TransactionType\TransactionType'); - - /** @var \FireflyIII\Database\TransactionJournal\TransactionJournal $journals */ - $journals = \App::make('FireflyIII\Database\TransactionJournal\TransactionJournal'); - - // some initial variables: - $balance = floatval($data['openingBalance']); - $date = new Carbon($data['openingBalanceDate']); - - // some dynamic variables: - if ($balance < 0) { - $opposingType = 'expense'; - $transactionType = $typeRepository->findByWhat('withdrawal'); - $toAccount = $this->store(['name' => $account->name . ' Initial Balance Account', 'active' => 1, 'what' => $opposingType]); - $fromAccount = $account; - } else { - $opposingType = 'revenue'; - $transactionType = $typeRepository->findByWhat('deposit'); - $fromAccount = $this->store(['name' => $account->name . ' Initial Balance Account', 'active' => 1, 'what' => $opposingType]); - $toAccount = $account; - } - - // data for transaction journal: - $balance = $balance < 0 ? $balance * -1 : $balance; - $currency = $journals->getJournalCurrencyById(intval($data['balance_currency_id'])); - $opening = [ - 'transaction_type_id' => $transactionType->id, - 'transaction_currency_id' => $currency->id, - 'amount' => $balance, - 'what' => 'opening', - 'from' => $fromAccount, - 'completed' => 0, - 'to' => $toAccount, - 'date' => $date, - 'description' => 'Opening balance for new account ' . $account->name - ]; - - $validation = $journals->validate($opening); - if ($validation['errors']->count() == 0) { - $journals->store($opening); - - return true; - } else { - \Log::error('Initial balance created is not valid (Database/Account)'); - \Log::error($validation['errors']->all()); - \App::abort(500); - } - - return false; - } - - /** - * @param \Account $account - * - * @return int - */ - public function getLastActivity(\Account $account) - { - $lastActivityKey = 'account.' . $account->id . '.lastActivityDate'; - if (\Cache::has($lastActivityKey)) { - return \Cache::get($lastActivityKey); - } - - $transaction = $account->transactions() - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->orderBy('transaction_journals.date', 'DESC')->first(); - if ($transaction) { - $date = $transaction->transactionJournal->date; - } else { - $date = 0; - } - \Cache::forever($lastActivityKey, $date); - - return $date; - } - - /** - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) // cannot make it shorter because of query. - * @param Eloquent $model - * - * @return bool - */ - public function destroy(Eloquent $model) - { - $journals = \TransactionJournal::whereIn( - 'id', function (QueryBuilder $query) use ($model) { - $query->select('transaction_journal_id') - ->from('transactions') - ->whereIn( - 'account_id', function (QueryBuilder $query) use ($model) { - $query - ->select('accounts.id') - ->from('accounts') - ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') - ->where( - function (QueryBuilder $q) use ($model) { - $q->where('accounts.id', $model->id); - $q->orWhere( - function (QueryBuilder $q) use ($model) { - $q->where('accounts.name', 'LIKE', '%' . $model->name . '%'); - $q->where('account_types.type', 'Initial balance account'); - $q->where('accounts.active', 0); - } - ); - } - )->where('accounts.user_id', $this->getUser()->id); - } - )->get(); - } - )->get(); - $transactions = []; - /** @var \TransactionJournal $journal */ - foreach ($journals as $journal) { - /** @var \Transaction $t */ - foreach ($journal->transactions as $t) { - $transactions[] = intval($t->id); - } - $journal->delete(); - } - if (count($transactions) > 0) { - \Transaction::whereIn('id', $transactions)->delete(); - } - \Event::fire('account.destroy', [$model]); - - // get account type: - /** @var \FireflyIII\Database\AccountType\AccountType $acctType */ - $acctType = \App::make('FireflyIII\Database\AccountType\AccountType'); - - $accountType = $acctType->findByWhat('initial'); - - //$q->where('account_types.type', ''); - - \Account::where( - function (EloquentBuilder $q) use ($model, $accountType) { - $q->where('id', $model->id); - $q->orWhere( - function (EloquentBuilder $q) use ($model, $accountType) { - $q->where('accounts.name', 'LIKE', '%' . $model->name . '%'); - $q->where('accounts.account_type_id', $accountType->id); - $q->where('accounts.active', 0); - } - ); - } - )->delete(); - - return true; - - } - - /** - * @param array $data - * - * @return \Eloquent - */ - public function store(array $data) - { - - /** @var \FireflyIII\Database\AccountType\AccountType $acctType */ - $acctType = \App::make('FireflyIII\Database\AccountType\AccountType'); - - $accountType = $acctType->findByWhat($data['what']); - - $data['user_id'] = $this->getUser()->id; - $data['account_type_id'] = $accountType->id; - $data['active'] = isset($data['active']) && intval($data['active']) === 1 ? 1 : 0; - - $data = array_except($data, ['_token', 'what']); - $account = new \Account($data); - if (!$account->isValid()) { - \Log::error('Account created is not valid (Database/Account)'); - \Log::error($account->getErrors()->all()); - \App::abort(500); - } - $account->save(); - if (isset($data['openingBalance']) && floatval($data['openingBalance']) != 0) { - $this->storeInitialBalance($account, $data); - } - - switch ($account->accountType->type) { - case 'Asset account': - case 'Default account': - $account->updateMeta('accountRole', $data['account_role']); - break; - } - - - /* Tell transaction journal to store a new one.*/ - \Event::fire('account.store', [$account]); - - - return $account; - - } - - /** - * @param Eloquent $model - * @param array $data - * - * @return bool - */ - public function update(Eloquent $model, array $data) - { - $model->name = $data['name']; - $model->active = isset($data['active']) ? intval($data['active']) : 0; - - switch ($model->accountType->type) { - case 'Asset account': - case 'Default account': - $model->updateMeta('accountRole', $data['account_role']); - break; - } - - $model->save(); - - if (isset($data['openingBalance']) && isset($data['openingBalanceDate']) && strlen($data['openingBalanceDate']) > 0) { - $this->updateInitialBalance($model, $data); - - } - \Event::fire('account.update', [$model]); - - return true; - } - - /** - * Validates a model. Returns an array containing MessageBags - * errors/warnings/successes. - * - * @param array $model - * - * @return array - */ - public function validate(array $model) - { - $model['active'] = !isset($model['active']) ? false : $model['active']; - $successes = new MessageBag; - $account = new \Account($model); - $account->isValid('form_input', false); - $errors = $account->getErrors(); - - if (isset($model['account_role']) && !in_array($model['account_role'], array_keys(\Config::get('firefly.accountRoles')))) { - $errors->add('account_role', 'Invalid account role'); - } - /* - * Opening balance and opening balance date. - */ - if (isset($model['what']) && $model['what'] == 'asset') { - if (isset($model['openingBalance']) && strlen($model['openingBalance']) > 0 && !is_numeric($model['openingBalance'])) { - $errors->add('openingBalance', 'This is not a number.'); - } - if (isset($model['openingBalanceDate']) && strlen($model['openingBalanceDate']) > 0) { - try { - new Carbon($model['openingBalanceDate']); - } catch (\Exception $e) { - $errors->add('openingBalanceDate', 'This date is invalid.'); - } - } - } - $fields = ['name', 'openingBalance', 'openingBalanceDate', 'active', 'account_role']; - foreach ($fields as $field) { - if (!$errors->has($field)) { - $successes->add($field, 'OK'); - } - } - - return ['errors' => $errors, 'successes' => $successes]; - } - - /** - * @param Eloquent $model - * @param array $data - */ - public function updateInitialBalance(Eloquent $model, array $data) - { - /** @noinspection PhpParamsInspection */ - $openingBalance = $this->openingBalanceTransaction($model); - if (is_null($openingBalance)) { - $this->storeInitialBalance($model, $data); - } else { - $openingBalance->date = new Carbon($data['openingBalanceDate']); - $openingBalance->save(); - $amount = floatval($data['openingBalance']); - /** @var \Transaction $transaction */ - foreach ($openingBalance->transactions as $transaction) { - if ($transaction->account_id == $model->id) { - $transaction->amount = $amount; - } else { - $transaction->amount = $amount * -1; - } - $transaction->save(); - } - } - } - - /** - * Returns an object with id $id. - * - * @param int $objectId - * - * @return \Eloquent - */ - public function find($objectId) - { - return $this->getUser()->accounts()->find($objectId); - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * @codeCoverageIgnore - * - * @param $what - * - * @throws NotImplementedException - * @return \AccountType|null - */ - public function findByWhat($what) - { - throw new NotImplementedException; - } - - /** - * Returns all objects. - * - * @return Collection - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function get() - { - throw new NotImplementedException; - } - - /** - * @param array $ids - * - * @return Collection - */ - public function getByIds(array $ids) - { - return $this->getUser()->accounts()->whereIn('id', $ids)->get(); - } - - /** - * @param $name - * - * @return static - * @throws \FireflyIII\Exception\FireflyException - */ - public function firstExpenseAccountOrCreate($name) - { - /** @var \FireflyIII\Database\AccountType\AccountType $typeRepository */ - $typeRepository = \App::make('FireflyIII\Database\AccountType\AccountType'); - - $accountType = $typeRepository->findByWhat('expense'); - - // if name is "", find cash account: - if (strlen($name) == 0) { - $cashAccountType = $typeRepository->findByWhat('cash'); - - // find or create cash account: - return \Account::firstOrCreate( - ['name' => 'Cash account', 'account_type_id' => $cashAccountType->id, 'active' => 0, 'user_id' => $this->getUser()->id,] - ); - } - - $data = ['user_id' => $this->getUser()->id, 'account_type_id' => $accountType->id, 'name' => $name, 'active' => 1]; - - return \Account::firstOrCreate($data); - - } - - /** - * @param $name - * - * @return static - * @throws \FireflyIII\Exception\FireflyException - */ - public function firstRevenueAccountOrCreate($name) - { - /** @var \FireflyIII\Database\AccountType\AccountType $typeRepository */ - $typeRepository = \App::make('FireflyIII\Database\AccountType\AccountType'); - - $accountType = $typeRepository->findByWhat('revenue'); - - // if name is "", find cash account: - if (strlen($name) == 0) { - $cashAccountType = $typeRepository->findByWhat('cash'); - - // find or create cash account: - return \Account::firstOrCreate( - ['name' => 'Cash account', 'account_type_id' => $cashAccountType->id, 'active' => 0, 'user_id' => $this->getUser()->id,] - ); - } - - $data = ['user_id' => $this->getUser()->id, 'account_type_id' => $accountType->id, 'name' => $name, 'active' => 1]; - - return \Account::firstOrCreate($data); - - } - - /** - * @param \Account $account - * @param int $limit - * @param string $range - * - * @return \Illuminate\Pagination\Paginator - */ - public function getTransactionJournals(\Account $account, $limit = 50, $range = 'session') - { - $offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0; - $items = []; - $query = $this->getUser() - ->transactionJournals() - ->withRelevantData() - ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->orderBy('date', 'DESC'); - - if ($range == 'session') { - $query->before(\Session::get('end', Carbon::now()->startOfMonth())); - $query->after(\Session::get('start', Carbon::now()->startOfMonth())); - } - $count = $query->count(); - $set = $query->take($limit)->offset($offset)->get(['transaction_journals.*']); - - foreach ($set as $entry) { - $items[] = $entry; - } - - return \Paginator::make($items, $count, $limit); - - - } - -} diff --git a/app/lib/FireflyIII/Database/Account/AccountInterface.php b/app/lib/FireflyIII/Database/Account/AccountInterface.php deleted file mode 100644 index c9d21ba229..0000000000 --- a/app/lib/FireflyIII/Database/Account/AccountInterface.php +++ /dev/null @@ -1,48 +0,0 @@ - 'Expense account', - 'asset' => 'Asset account', - 'revenue' => 'Revenue account', - 'cash' => 'Cash account', - 'initial' => 'Initial balance account', - ]; - if (isset($typeMap[$what])) { - return \AccountType::whereType($typeMap[$what])->first(); - } - throw new FireflyException('Cannot find account type described as "' . e($what) . '".'); - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * Returns all objects. - * - * @return Collection - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function get() - { - throw new NotImplementedException; - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * @param array $ids - * - * @return Collection - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function getByIds(array $ids) - { - throw new NotImplementedException; - } -} diff --git a/app/lib/FireflyIII/Database/Bill/Bill.php b/app/lib/FireflyIII/Database/Bill/Bill.php deleted file mode 100644 index 642f5163a4..0000000000 --- a/app/lib/FireflyIII/Database/Bill/Bill.php +++ /dev/null @@ -1,356 +0,0 @@ -setUser(\Auth::user()); - } - - /** - * @param Eloquent $model - * - * @return bool - */ - public function destroy(Eloquent $model) - { - $model->delete(); - - return true; - } - - /** - * @param array $data - * - * @return \Eloquent - */ - public function store(array $data) - { - $bill = new \Bill; - $bill->user()->associate($this->getUser()); - $bill->name = $data['name']; - $bill->match = $data['match']; - $bill->amount_max = floatval($data['amount_max']); - $bill->amount_min = floatval($data['amount_min']); - - $date = new Carbon($data['date']); - - - $bill->active = intval($data['active']); - $bill->automatch = intval($data['automatch']); - $bill->repeat_freq = $data['repeat_freq']; - - /* - * Jump to the start of the period. - */ - $date = \DateKit::startOfPeriod($date, $data['repeat_freq']); - $bill->date = $date; - $bill->skip = intval($data['skip']); - - $bill->save(); - - return $bill; - } - - /** - * @param Eloquent $model - * @param array $data - * - * @return bool - */ - public function update(Eloquent $model, array $data) - { - $model->name = $data['name']; - $model->match = $data['match']; - $model->amount_max = floatval($data['amount_max']); - $model->amount_min = floatval($data['amount_min']); - - $date = new Carbon($data['date']); - - $model->date = $date; - $model->active = intval($data['active']); - $model->automatch = intval($data['automatch']); - $model->repeat_freq = $data['repeat_freq']; - $model->skip = intval($data['skip']); - $model->save(); - - return true; - } - - /** - * Validates an array. Returns an array containing MessageBags - * errors/warnings/successes. - * - * ignored because this method will be gone soon. - * - * @param array $model - * - * @return array - */ - public function validate(array $model) - { - $warnings = new MessageBag; - $successes = new MessageBag; - $errors = new MessageBag; - if (floatval($model['amount_min']) > floatval($model['amount_max'])) { - $errors->add('amount_max', 'Maximum amount can not be less than minimum amount.'); - $errors->add('amount_min', 'Minimum amount can not be more than maximum amount.'); - } - $object = new \Bill($model); - $object->isValid(); - $errors->merge($object->getErrors()); - - $set = ['name', 'match', 'amount_min', 'amount_max', 'date', 'repeat_freq', 'skip', 'automatch', 'active']; - foreach ($set as $entry) { - if (!$errors->has($entry)) { - $successes->add($entry, 'OK'); - } - } - - return ['errors' => $errors, 'warnings' => $warnings, 'successes' => $successes]; - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * Returns an object with id $id. - * - * @param int $objectId - * - * @return \Eloquent - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function find($objectId) - { - throw new NotImplementedException; - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * Finds an account type using one of the "$what"'s: expense, asset, revenue, opening, etc. - * - * @param $what - * - * @return \AccountType|null - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function findByWhat($what) - { - throw new NotImplementedException; - } - - /** - * Returns all objects. - * - * @return Collection - */ - public function get() - { - return $this->getUser()->bills()->orderBy('name')->get(); - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * @param array $ids - * - * @return Collection - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function getByIds(array $ids) - { - throw new NotImplementedException; - } - - /** - * @param \Bill $bill - * - * @return Carbon|null - */ - public function lastFoundMatch(\Bill $bill) - { - $last = $bill->transactionjournals()->orderBy('date', 'DESC')->first(); - if ($last) { - return $last->date; - } - - return null; - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - * - * @param \Bill $bill - * - * @return Carbon|null - */ - public function nextExpectedMatch(\Bill $bill) - { - $finalDate = null; - if ($bill->active == 0) { - return $finalDate; - } - - /* - * $today is the start of the next period, to make sure FF3 won't miss anything - * when the current period has a transaction journal. - */ - $today = \DateKit::addPeriod(new Carbon, $bill->repeat_freq, 0); - - $skip = $bill->skip + 1; - $start = \DateKit::startOfPeriod(new Carbon, $bill->repeat_freq); - /* - * go back exactly one month/week/etc because FF3 does not care about 'next' - * bills if they're too far into the past. - */ - - $counter = 0; - while ($start <= $today) { - if (($counter % $skip) == 0) { - // do something. - $end = \DateKit::endOfPeriod(clone $start, $bill->repeat_freq); - $journalCount = $bill->transactionjournals()->before($end)->after($start)->count(); - if ($journalCount == 0) { - $finalDate = clone $start; - break; - } - } - - // add period for next round! - $start = \DateKit::addPeriod($start, $bill->repeat_freq, 0); - $counter++; - } - - return $finalDate; - } - - /** - * @param \Bill $bill - * @param \TransactionJournal $journal - * - * @return bool - */ - public function scan(\Bill $bill, \TransactionJournal $journal) - { - /* - * Match words. - */ - $wordMatch = false; - $matches = explode(',', $bill->match); - $description = strtolower($journal->description); - - /* - * Attach expense account to description for more narrow matching. - */ - if (count($journal->transactions) < 2) { - $transactions = $journal->transactions()->get(); - } else { - $transactions = $journal->transactions; - } - /** @var \Transaction $transaction */ - foreach ($transactions as $transaction) { - /** @var \Account $account */ - $account = $transaction->account()->first(); - /** @var \AccountType $type */ - $type = $account->accountType()->first(); - if ($type->type == 'Expense account' || $type->type == 'Beneficiary account') { - $description .= ' ' . strtolower($account->name); - } - } - \Log::debug('Final description: ' . $description); - \Log::debug('Matches searched: ' . join(':', $matches)); - - $count = 0; - foreach ($matches as $word) { - if (!(strpos($description, strtolower($word)) === false)) { - $count++; - } - } - if ($count >= count($matches)) { - $wordMatch = true; - \Log::debug('word match is true'); - } - - - /* - * Match amount. - */ - - $amountMatch = false; - if (count($transactions) > 1) { - - $amount = max(floatval($transactions[0]->amount), floatval($transactions[1]->amount)); - $min = floatval($bill->amount_min); - $max = floatval($bill->amount_max); - if ($amount >= $min && $amount <= $max) { - $amountMatch = true; - \Log::debug('Amount match is true!'); - } - } - - /* - * If both, update! - */ - if ($wordMatch && $amountMatch) { - $journal->bill()->associate($bill); - $journal->save(); - } - } - - /** - * @param \Bill $bill - * - * @return bool - */ - public function scanEverything(\Bill $bill) - { - // get all journals that (may) be relevant. - // this is usually almost all of them. - - /** @var \FireflyIII\Database\TransactionJournal\TransactionJournal $journalRepository */ - $journalRepository = \App::make('FireflyIII\Database\TransactionJournal\TransactionJournal'); - - $set = \DB::table('transactions')->where('amount', '>', 0)->where('amount', '>=', $bill->amount_min)->where('amount', '<=', $bill->amount_max) - ->get(['transaction_journal_id']); - $ids = []; - - /** @var \Transaction $entry */ - foreach ($set as $entry) { - $ids[] = intval($entry->transaction_journal_id); - } - if (count($ids) > 0) { - $journals = $journalRepository->getByIds($ids); - /** @var \TransactionJournal $journal */ - foreach ($journals as $journal) { - $this->scan($bill, $journal); - } - } - - return true; - } -} diff --git a/app/lib/FireflyIII/Database/Bill/BillInterface.php b/app/lib/FireflyIII/Database/Bill/BillInterface.php deleted file mode 100644 index ec75dd1167..0000000000 --- a/app/lib/FireflyIII/Database/Bill/BillInterface.php +++ /dev/null @@ -1,43 +0,0 @@ -setUser(\Auth::user()); - } - - /** - * @param Eloquent $model - * - * @return bool - */ - public function destroy(Eloquent $model) - { - $model->delete(); - - return true; - } - - /** - * @param array $data - * - * @return \Eloquent - * @throws FireflyException - */ - public function store(array $data) - { - $budget = new \Budget($data); - - if (!$budget->isValid()) { - \Log::error('Could not store budget: ' . $budget->getErrors()->toJson()); - throw new FireflyException($budget->getErrors()->first()); - } - $budget->save(); - - return $budget; - } - - /** - * @param Eloquent $model - * @param array $data - * - * @return bool - */ - public function update(Eloquent $model, array $data) - { - $model->name = $data['name']; - $model->save(); - - return true; - } - - /** - * Validates an array. Returns an array containing MessageBags - * errors/warnings/successes. - * - * @param array $model - * - * @return array - */ - public function validate(array $model) - { - $warnings = new MessageBag; - $successes = new MessageBag; - $budget = new \Budget($model); - $budget->isValid(); - $errors = $budget->getErrors(); - - if (!$errors->has('name')) { - $successes->add('name', 'OK'); - } - - return ['errors' => $errors, 'warnings' => $warnings, 'successes' => $successes]; - } - - /** - * @param Carbon $start - * @param Carbon $end - * - * @return Collection - */ - public function expenseNoBudget(Carbon $start, Carbon $end) - { - // Add expenses that have no budget: - return $this->getUser() - ->transactionjournals() - ->whereNotIn( - 'transaction_journals.id', function (QueryBuilder $query) use ($start, $end) { - $query - ->select('transaction_journals.id') - ->from('transaction_journals') - ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transaction_journals.date', '>=', $start->format('Y-m-d 00:00:00')) - ->where('transaction_journals.date', '<=', $end->format('Y-m-d 00:00:00')); - } - ) - ->before($end) - ->after($start) - ->lessThan(0) - ->transactionTypes(['Withdrawal']) - ->get(); - } - - /** - * @param Carbon $start - * @param Carbon $end - * - * @return Collection - */ - public function journalsNoBudget(Carbon $start, Carbon $end) - { - $set = $this->getUser() - ->transactionjournals() - ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') - ->whereNull('budget_transaction_journal.id') - ->before($end) - ->after($start) - ->orderBy('transaction_journals.date') - ->get(['transaction_journals.*']); - - return $set; - } - - /** - * This method includes the time because otherwise, SQLite does not understand it. - * - * @param \Budget $budget - * @param Carbon $date - * - * @return \LimitRepetition|null - */ - public function repetitionOnStartingOnDate(\Budget $budget, Carbon $date) - { - return \LimitRepetition:: - leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id') - ->where('limit_repetitions.startdate', $date->format('Y-m-d 00:00:00')) - ->where('budget_limits.budget_id', $budget->id) - ->first(['limit_repetitions.*']); - } - - /** - * Returns an object with id $id. - * - * @param int $objectId - * - * @return \Eloquent - */ - public function find($objectId) - { - return $this->getUser()->budgets()->find($objectId); - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * Finds an account type using one of the "$what"'s: expense, asset, revenue, opening, etc. - * - * @param $what - * - * @return \AccountType|null - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function findByWhat($what) - { - throw new NotImplementedException; - } - - /** - * Returns all objects. - * - * @return Collection - */ - public function get() - { - $budgets = $this->getUser()->budgets()->get(); - - return $budgets; - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * @param array $ids - * - * @return Collection - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function getByIds(array $ids) - { - throw new NotImplementedException; - } - - /** - * Returns all the transaction journals for a limit, possibly limited by a limit repetition. - * - * @param \Budget $budget - * @param \LimitRepetition $repetition - * @param int $take - * - * @return \Illuminate\Pagination\Paginator - */ - public function getJournals(\Budget $budget, \LimitRepetition $repetition = null, $take = 50) - { - $offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $take : 0; - - - $setQuery = $budget->transactionJournals()->withRelevantData()->take($take)->offset($offset)->orderBy('date', 'DESC'); - $countQuery = $budget->transactionJournals(); - - - if (!is_null($repetition)) { - $setQuery->after($repetition->startdate)->before($repetition->enddate); - $countQuery->after($repetition->startdate)->before($repetition->enddate); - } - - - $set = $setQuery->get(['transaction_journals.*']); - $count = $countQuery->count(); - $items = []; - foreach ($set as $entry) { - $items[] = $entry; - } - - return \Paginator::make($items, $count, $take); - } - - /** - * @param \Budget $budget - * @param Carbon $date - * - * @return \LimitRepetition - */ - public function getRepetitionByDate(\Budget $budget, Carbon $date) - { - return $budget->limitrepetitions()->where('limit_repetitions.startdate', $date)->first(['limit_repetitions.*']); - } - - /** - * @param \Budget $budget - * @param Carbon $date - * - * @return float - */ - public function spentInMonth(\Budget $budget, Carbon $date) - { - $end = clone $date; - $date->startOfMonth(); - $end->endOfMonth(); - $sum = floatval($budget->transactionjournals()->before($end)->after($date)->lessThan(0)->sum('amount')) * -1; - - return $sum; - } - - /** - * This method updates the amount (envelope) for the given date and budget. This results in a (new) limit (aka an envelope) - * for that budget. Returned to the user is the new limit repetition. - * - * @param \Budget $budget - * @param Carbon $date - * @param $amount - * - * @return \LimitRepetition - * @throws \Exception - */ - public function updateLimitAmount(\Budget $budget, Carbon $date, $amount) - { - /** @var \BudgetLimit $limit */ - $limit = $this->limitOnStartingOnDate($budget, $date); - if (!$limit) { - // create one! - $limit = new \BudgetLimit; - $limit->budget()->associate($budget); - $limit->startdate = $date; - $limit->amount = $amount; - $limit->repeat_freq = 'monthly'; - $limit->repeats = 0; - $limit->save(); - \Log::info('ID: ' . $limit->id); - /* - * A newly stored limit also created a limit repetition. - */ - \Event::fire('limits.store', [$limit]); - } else { - if ($amount > 0) { - $limit->amount = $amount; - $limit->save(); - /* - * An updated limit also updates the associated limit repetitions. - */ - \Event::fire('limits.update', [$limit]); - } else { - $limit->delete(); - } - } - - return $limit->limitrepetitions()->first(); - - - } - - /** - * @param \Budget $budget - * @param Carbon $date - * - * @return \BudgetLimit - */ - public function limitOnStartingOnDate(\Budget $budget, Carbon $date) - { - return $budget->budgetLimits()->where('startdate', $date->format('Y-m-d 00:00:00'))->first(); - - - } -} diff --git a/app/lib/FireflyIII/Database/Budget/BudgetInterface.php b/app/lib/FireflyIII/Database/Budget/BudgetInterface.php deleted file mode 100644 index b81b786c85..0000000000 --- a/app/lib/FireflyIII/Database/Budget/BudgetInterface.php +++ /dev/null @@ -1,40 +0,0 @@ -setUser(\Auth::user()); - } - - /** - * @param Eloquent $model - * - * @return bool - */ - public function destroy(Eloquent $model) - { - $model->delete(); - - return true; - } - - /** - * @param array $data - * - * @return \Eloquent - * @throws FireflyException - */ - public function store(array $data) - { - $category = new \Category; - $category->name = $data['name']; - $category->user()->associate($this->getUser()); - if (!$category->isValid()) { - \Log::error('Could not store category: ' . $category->getErrors()->toJson()); - throw new FireflyException($category->getErrors()->first()); - } - $category->save(); - - return $category; - } - - /** - * @param Eloquent $model - * @param array $data - * - * @return bool - * @throws FireflyException - */ - public function update(Eloquent $model, array $data) - { - $model->name = $data['name']; - $model->save(); - - return true; - } - - /** - * Validates an array. Returns an array containing MessageBags - * errors/warnings/successes. - * - * @param array $model - * - * @return array - */ - public function validate(array $model) - { - $warnings = new MessageBag; - $successes = new MessageBag; - $category = new \Category($model); - $category->isValid(); - $errors = $category->getErrors(); - - if (!$errors->has('name')) { - $successes->add('name', 'OK'); - } - - return ['errors' => $errors, 'warnings' => $warnings, 'successes' => $successes]; - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * Returns an object with id $id. - * - * @param int $objectId - * - * @return \Eloquent - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function find($objectId) - { - throw new NotImplementedException; - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * Finds an account type using one of the "$what"'s: expense, asset, revenue, opening, etc. - * - * @param $what - * - * @return \AccountType|null - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function findByWhat($what) - { - throw new NotImplementedException; - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * Returns all objects. - * - * @return Collection - */ - public function get() - { - return $this->getUser()->categories()->orderBy('name', 'ASC')->get(); - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * @param array $ids - * - * @return Collection - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function getByIds(array $ids) - { - throw new NotImplementedException; - } - - /** - * @param $name - * - * @return \Category - */ - public function firstOrCreate($name) - { - return \Category::firstOrCreate(['user_id' => $this->getUser()->id, 'name' => $name]); - } - - /** - * @param \Category $category - * @param int $limit - * - * @return \Illuminate\Pagination\Paginator - */ - public function getTransactionJournals(\Category $category, $limit = 50) - { - $offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0; - $set = $category->transactionJournals()->withRelevantData()->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(['transaction_journals.*']); - $count = $category->transactionJournals()->count(); - $items = []; - foreach ($set as $entry) { - $items[] = $entry; - } - - return \Paginator::make($items, $count, $limit); - - } - - /** - * @param Carbon $start - * @param Carbon $end - * - * @return Collection - */ - public function journalsNoCategory(Carbon $start, Carbon $end) - { - $set = $this->getUser() - ->transactionjournals() - ->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') - ->whereNull('category_transaction_journal.id') - ->before($end) - ->after($start) - ->orderBy('transaction_journals.date') - ->get(['transaction_journals.*']); - - return $set; - } - - /** - * @param \Category $category - * @param Carbon $date - * - * @return float - */ - public function spentInMonth(\Category $category, Carbon $date) - { - $end = clone $date; - $date->startOfMonth(); - $end->endOfMonth(); - $sum = floatval($category->transactionjournals()->before($end)->after($date)->lessThan(0)->sum('amount')) * -1; - - return $sum; - } -} diff --git a/app/lib/FireflyIII/Database/CommonDatabaseCallsInterface.php b/app/lib/FireflyIII/Database/CommonDatabaseCallsInterface.php deleted file mode 100644 index 6fbf57c68b..0000000000 --- a/app/lib/FireflyIII/Database/CommonDatabaseCallsInterface.php +++ /dev/null @@ -1,47 +0,0 @@ -piggyBankRepetitions()->get(); - if ($reps->count() == 1) { - return $reps->first(); - } - // should filter the one we need: - $repetitions = $reps->filter( - function (\PiggyBankRepetition $rep) use ($date) { - if ($date->between($rep->startdate, $rep->targetdate)) { - return $rep; - } - - return null; - } - ); - if ($repetitions->count() == 0) { - return null; - } - - return $repetitions->first(); - } - - /** - * Returns all objects. - * - * @return Collection - */ - public function get() - { - return $this->getUser()->piggyBanks()->where('repeats', 0)->orderBy('name')->get(); - } -} diff --git a/app/lib/FireflyIII/Database/PiggyBank/PiggyBankShared.php b/app/lib/FireflyIII/Database/PiggyBank/PiggyBankShared.php deleted file mode 100644 index be969c4259..0000000000 --- a/app/lib/FireflyIII/Database/PiggyBank/PiggyBankShared.php +++ /dev/null @@ -1,186 +0,0 @@ -setUser(\Auth::user()); - } - - /** - * @param Eloquent $model - * - * @return bool - */ - public function destroy(Eloquent $model) - { - $reminders = \Reminder::where('remindersable_id', $model->id)->get(); - /** @var \Reminder $reminder */ - foreach ($reminders as $reminder) { - $reminder->delete(); - } - $model->delete(); - - } - - /** - * Returns an object with id $id. - * - * @param int $objectId - * - * @return \Eloquent - */ - public function find($objectId) - { - return \PiggyBank:: - leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')->where('piggy_banks.id', '=', $objectId)->where( - 'accounts.user_id', $this->getUser()->id - ) - ->first(['piggy_banks.*']); - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * Finds an account type using one of the "$what"'s: expense, asset, revenue, opening, etc. - * - * @param $what - * - * @return \AccountType|null - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function findByWhat($what) - { - throw new NotImplementedException; - } - - /** - * @param array $ids - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * @return Collection - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function getByIds(array $ids) - { - throw new NotImplementedException; - } - - /** - * @param \Account $account - * - * @return float - */ - public function leftOnAccount(\Account $account) - { - \Log::debug('Now in leftOnAccount() for account #' . $account->id . ' (' . $account->name . ')'); - $balance = \Steam::balance($account); - \Log::debug('Steam says: ' . $balance); - /** @var \PiggyBank $p */ - foreach ($account->piggyBanks()->get() as $p) { - $balance -= $p->currentRelevantRep()->currentamount; - } - - return $balance; - - } - - /** - * @param array $data - * - * @return \Eloquent - */ - public function store(array $data) - { - if (!isset($data['remind_me']) || (isset($data['remind_me']) && $data['remind_me'] == 0)) { - $data['reminder'] = null; - } - $piggyBank = new \PiggyBank($data); - $piggyBank->save(); - - return $piggyBank; - } - - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - * - * @param Eloquent $model - * @param array $data - * - * @return bool - */ - public function update(Eloquent $model, array $data) - { - /** @var \PiggyBank $model */ - $model->name = $data['name']; - $model->account_id = intval($data['account_id']); - $model->targetamount = floatval($data['targetamount']); - $model->targetdate = isset($data['targetdate']) && $data['targetdate'] != '' ? $data['targetdate'] : null; - $model->rep_every = intval($data['rep_every']); - $model->reminder_skip = intval($data['reminder_skip']); - $model->order = intval($data['order']); - $model->remind_me = intval($data['remind_me']); - $model->reminder = isset($data['reminder']) ? $data['reminder'] : 'month'; - - if ($model->remind_me == 0) { - $model->reminder = null; - } - - $model->save(); - - return true; - } - - /** - * Validates an array. Returns an array containing MessageBags - * errors/warnings/successes. - * - * Ignore PHPMD rules because Laravel 5.0 will make this method superfluous anyway. - * - * @param array $model - * - * @return array - */ - public function validate(array $model) - { - $warnings = new MessageBag; - $successes = new MessageBag; - $model = new \PiggyBank($model); - $model->isValid(); - $errors = $model->getErrors(); - - // add ok messages. - $list = ['name', 'account_id', 'targetamount', 'targetdate', 'remind_me', 'reminder']; - foreach ($list as $entry) { - if (!$errors->has($entry) && !$warnings->has($entry)) { - $successes->add($entry, 'OK'); - } - } - - - return ['errors' => $errors, 'warnings' => $warnings, 'successes' => $successes]; - } - -} diff --git a/app/lib/FireflyIII/Database/PiggyBank/PiggybankInterface.php b/app/lib/FireflyIII/Database/PiggyBank/PiggybankInterface.php deleted file mode 100644 index 3c26f1c969..0000000000 --- a/app/lib/FireflyIII/Database/PiggyBank/PiggybankInterface.php +++ /dev/null @@ -1,19 +0,0 @@ -piggyBank()->first(); - $bars = new Collection; - $currentStart = clone $repetition->startdate; - - if (is_null($piggyBank->reminder)) { - $entry = ['repetition' => $repetition, 'amountPerBar' => floatval($piggyBank->targetamount), - 'currentAmount' => floatval($repetition->currentamount), 'cumulativeAmount' => floatval($piggyBank->targetamount), - 'startDate' => clone $repetition->startdate, 'targetDate' => clone $repetition->targetdate]; - $bars->push($this->createPiggyBankPart($entry)); - - return $bars; - } - - while ($currentStart < $repetition->targetdate) { - $currentTarget = \DateKit::endOfX($currentStart, $piggyBank->reminder, $repetition->targetdate); - $entry = ['repetition' => $repetition, 'amountPerBar' => null, 'currentAmount' => floatval($repetition->currentamount), - 'cumulativeAmount' => null, 'startDate' => $currentStart, 'targetDate' => $currentTarget]; - $bars->push($this->createPiggyBankPart($entry)); - $currentStart = clone $currentTarget; - $currentStart->addDay(); - - } - $amountPerBar = floatval($piggyBank->targetamount) / $bars->count(); - $cumulative = $amountPerBar; - /** @var PiggyBankPart $bar */ - foreach ($bars as $index => $bar) { - $bar->setAmountPerBar($amountPerBar); - $bar->setCumulativeAmount($cumulative); - if ($bars->count() - 1 == $index) { - $bar->setCumulativeAmount($piggyBank->targetamount); - } - $cumulative += $amountPerBar; - } - - return $bars; - } - - /** - * @param array $data - * - * @return PiggyBankPart - */ - public function createPiggyBankPart(array $data) - { - $part = new PiggyBankPart; - $part->setRepetition($data['repetition']); - $part->setAmountPerBar($data['amountPerBar']); - $part->setCurrentamount($data['currentAmount']); - $part->setCumulativeAmount($data['cumulativeAmount']); - $part->setStartdate($data['startDate']); - $part->setTargetdate($data['targetDate']); - - return $part; - } - - - /** - * @param array $data - * - * @return \Eloquent - */ - public function store(array $data) - { - - $data['rep_every'] = intval($data['rep_every']); - $data['reminder_skip'] = intval($data['reminder_skip']); - $data['order'] = intval($data['order']); - $data['remind_me'] = intval($data['remind_me']); - $data['account_id'] = intval($data['account_id']); - - - if ($data['remind_me'] == 0) { - $data['reminder'] = null; - } - - $repeated = new \PiggyBank($data); - $repeated->save(); - - return $repeated; - } - - /** - * Returns all objects. - * - * @return Collection - */ - public function get() - { - return $this->getUser()->piggyBanks()->where('repeats', 1)->get(); - } - -} diff --git a/app/lib/FireflyIII/Database/SwitchUser.php b/app/lib/FireflyIII/Database/SwitchUser.php deleted file mode 100644 index d8c0946274..0000000000 --- a/app/lib/FireflyIII/Database/SwitchUser.php +++ /dev/null @@ -1,27 +0,0 @@ -_user; - } - - /** - * @param $user - */ - public function setUser($user) - { - $this->_user = $user; - } -} diff --git a/app/lib/FireflyIII/Database/Transaction/Transaction.php b/app/lib/FireflyIII/Database/Transaction/Transaction.php deleted file mode 100644 index d8c2ea909d..0000000000 --- a/app/lib/FireflyIII/Database/Transaction/Transaction.php +++ /dev/null @@ -1,156 +0,0 @@ -account()->associate($data['account']); - $transaction->transactionJournal()->associate($data['transaction_journal']); - $transaction->amount = floatval($data['amount']); - if (isset($data['piggyBank'])) { - $transaction->piggyBank()->associate($data['piggyBank']); - } - if (isset($data['description'])) { - $transaction->description = $data['description']; - } - if ($transaction->isValid()) { - $transaction->save(); - } else { - throw new FireflyException($transaction->getErrors()->first()); - } - - return $transaction; - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * @param Eloquent $model - * @param array $data - * - * @return bool - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function update(Eloquent $model, array $data) - { - throw new NotImplementedException; - } - - /** - * Validates an array. Returns an array containing MessageBags - * errors/warnings/successes. - * - * @param array $model - * - * @return MessageBag - */ - public function validate(array $model) - { - $errors = new MessageBag; - if (is_null($model['account'])) { - $errors->add('account', 'No account present'); - } - if (is_null($model['transaction_journal'])) { - $errors->add('transaction_journal', 'No valid transaction journal present'); - } - - return $errors; - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * Returns an object with id $id. - * - * @param int $objectId - * - * @return \Eloquent - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function find($objectId) - { - throw new NotImplementedException; - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * Finds an account type using one of the "$what"'s: expense, asset, revenue, opening, etc. - * - * @param $what - * - * @return \AccountType|null - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function findByWhat($what) - { - throw new NotImplementedException; - } - - /** - * Returns all objects. - * - * @return Collection - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function get() - { - throw new NotImplementedException; - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * @param array $ids - * - * @return Collection - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function getByIds(array $ids) - { - throw new NotImplementedException; - } -} diff --git a/app/lib/FireflyIII/Database/TransactionCurrency/TransactionCurrency.php b/app/lib/FireflyIII/Database/TransactionCurrency/TransactionCurrency.php deleted file mode 100644 index 3eeb6eb5f9..0000000000 --- a/app/lib/FireflyIII/Database/TransactionCurrency/TransactionCurrency.php +++ /dev/null @@ -1,154 +0,0 @@ -delete(); - } - - /** - * @param array $data - * - * @return Eloquent - */ - public function store(array $data) - { - $currency = new \TransactionCurrency($data); - $currency->save(); - - return $currency; - } - - /** - * @param Eloquent $model - * @param array $data - * - * @return bool - */ - public function update(Eloquent $model, array $data) - { - $model->symbol = $data['symbol']; - $model->code = $data['code']; - $model->name = $data['name']; - $model->save(); - - return true; - } - - /** - * Validates an array. Returns an array containing MessageBags - * errors/warnings/successes. - * - * @param array $model - * - * @return array - */ - public function validate(array $model) - { - $warnings = new MessageBag; - $successes = new MessageBag; - \Log::debug('Now in TransactionCurrency::validate()'); - - $currency = new \TransactionCurrency($model); - $currency->isValid(); - $errors = $currency->getErrors(); - - \Log::debug('Data: ' . json_encode($model)); - \Log::debug('Error-content: ' . json_encode($errors->all())); - \Log::debug('Error count is: ' . $errors->count()); - - $fields = ['name', 'code', 'symbol']; - foreach ($fields as $field) { - if (!$errors->has($field)) { - $successes->add($field, 'OK'); - } - } - - return ['errors' => $errors, 'warnings' => $warnings, 'successes' => $successes]; - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * Returns an object with id $id. - * - * @param int $objectId - * - * @return \Eloquent - */ - public function find($objectId) - { - return \TransactionCurrency::find($objectId); - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * Finds an account type using one of the "$what"'s: expense, asset, revenue, opening, etc. - * - * @param $what - * @throws NotImplementedException - * @codeCoverageIgnore - * - * @return \AccountType|null - */ - public function findByWhat($what) - { - throw new NotImplementedException; - } - - /** - * Returns all objects. - * - * @return Collection - */ - public function get() - { - return \TransactionCurrency::orderBy('code', 'ASC')->get(); - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * @param array $objectIds - * @throws NotImplementedException - * @codeCoverageIgnore - * - * @return Collection - */ - public function getByIds(array $objectIds) - { - throw new NotImplementedException; - } - - /** - * @param string $code - * - * @return \TransactionCurrency|null - */ - public function findByCode($code) - { - return \TransactionCurrency::whereCode($code)->first(); - } -} diff --git a/app/lib/FireflyIII/Database/TransactionCurrency/TransactionCurrencyInterface.php b/app/lib/FireflyIII/Database/TransactionCurrency/TransactionCurrencyInterface.php deleted file mode 100644 index bd2c0a159d..0000000000 --- a/app/lib/FireflyIII/Database/TransactionCurrency/TransactionCurrencyInterface.php +++ /dev/null @@ -1,20 +0,0 @@ -setUser(\Auth::user()); - } - - /** - * @param Eloquent $model - * - * @return bool - */ - public function destroy(Eloquent $model) - { - /* - * Trigger deletion. - */ - \Event::fire('transactionJournal.destroy', [$model]); // new and used. - /* - * Since this event will also destroy both transactions, trigger on those as - * well because we might want to update some caches and what-not. - */ - /** @var Transaction $transaction */ - foreach ($model->transactions as $transaction) { - \Event::fire('transaction.destroy', [$transaction]); - } - - $model->delete(); - - return true; - } - - /** - * @param array $data - * - * @return \Eloquent - * @throws FireflyException - */ - public function store(array $data) - { - $journal = new \TransactionJournal( - [ - 'transaction_type_id' => $data['transaction_type_id'], - 'transaction_currency_id' => $data['transaction_currency_id'], - 'user_id' => $this->getUser()->id, - 'description' => $data['description'], - 'date' => $data['date'], 'completed' => 0] - ); - $journal->save(); - - list($fromAccount, $toAccount) = $this->storeAccounts($data); - - - $this->storeTransaction( - ['account_id' => $fromAccount->id, 'account' => $fromAccount, 'transaction_journal' => $journal, 'transaction_journal_id' => $journal->id, - 'amount' => floatval($data['amount'] * -1)] - ); - $this->storeTransaction( - ['account_id' => $toAccount->id, 'account' => $toAccount, 'transaction_journal' => $journal, 'transaction_journal_id' => $journal->id, - 'amount' => floatval($data['amount'])] - ); - $this->storeBudget($data, $journal); - $this->storeCategory($data, $journal); - - $journal->completed = 1; - $journal->save(); - - return $journal; - } - - /** - * @param Eloquent $model - * @param array $data - * - * @return bool - * @throws FireflyException - */ - public function update(Eloquent $model, array $data) - { - $journalType = $this->getJournalType($data['what']); - $currency = $this->getJournalCurrencyById($data['transaction_currency_id']); - $model->description = $data['description']; - $model->date = $data['date']; - - $model->transactionType()->associate($journalType); - $model->transactionCurrency()->associate($currency); - $model->user()->associate($this->getUser()); - $model->save(); - - list($fromAccount, $toAccount) = $this->storeAccounts($data); - - /** @noinspection PhpParamsInspection */ - $this->storeBudget($data, $model); - $this->storeCategory($data, $model); - - $amount = floatval($data['amount']); - /** @var \Transaction $transaction */ - foreach ($model->transactions()->get() as $transaction) { - if (floatval($transaction->amount) > 0) { - // the TO transaction. - $transaction->account()->associate($toAccount); - $transaction->amount = $amount; - } else { - $transaction->account()->associate($fromAccount); - $transaction->amount = $amount * -1; - } - if (!$transaction->isValid()) { - throw new FireflyException('Could not validate transaction while saving.'); - } - $transaction->save(); - } - - return true; - } - - /** - * Validates an array. Returns an array containing MessageBags - * errors/warnings/successes. - * - * ignored because this method will be gone soon. - * - * @param array $model - * - * @return array - * @throws FireflyException - */ - public function validate(array $model) - { - - $warnings = new MessageBag; - $successes = new MessageBag; - - $journal = new \TransactionJournal($model); - $journal->isValid(); - $errors = $journal->getErrors(); - - if (!isset($model['what']) && !isset($model['transaction_type_id'])) { - $errors->add('description', 'Internal error: need to know type of transaction!'); - } - if (strlen($model['description']) == 0) { - $errors->add('description', 'The description field is required.'); - } - $errors = $errors->merge($this->_validateAmount($model)); - $errors = $errors->merge($this->_validateBudget($model)); - $errors = $errors->merge($this->_validateAccount($model)); - - $list = ['date', 'description', 'amount', 'budget_id', 'from', 'to', 'account_from_id', 'account_to_id', 'category', 'account_id', 'expense_account', - 'revenue_account']; - foreach ($list as $entry) { - if (!$errors->has($entry)) { - $successes->add($entry, 'OK'); - } - } - - return ['errors' => $errors, 'warnings' => $warnings, 'successes' => $successes]; - - - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - * - * @param array $data - * - * @return array - * @throws FireflyException - */ - public function storeAccounts(array $data) - { - /** @var \FireflyIII\Database\Account\Account $accountRepository */ - $accountRepository = \App::make('FireflyIII\Database\Account\Account'); - $fromAccount = null; - $toAccount = null; - - switch ($data['what']) { - case 'withdrawal': - $fromAccount = $accountRepository->find($data['account_id']); - $toAccount = $accountRepository->firstExpenseAccountOrCreate($data['expense_account']); - break; - case 'opening': - $fromAccount = $data['from']; - $toAccount = $data['to']; - break; - case 'deposit': - $fromAccount = $accountRepository->firstRevenueAccountOrCreate($data['revenue_account']); - $toAccount = $accountRepository->find($data['account_id']); - break; - case 'transfer': - $fromAccount = $accountRepository->find($data['account_from_id']); - $toAccount = $accountRepository->find($data['account_to_id']); - break; - - default: - throw new FireflyException('Cannot save transaction journal with accounts based on $what "' . $data['what'] . '".'); - break; - } - - return [$fromAccount, $toAccount]; - } - - /** - * @param array $data - * - * @return \Eloquent - * @throws FireflyException - */ - public function storeTransaction($data) - { - - /** @var \FireflyIII\Database\Transaction\Transaction $repository */ - $repository = \App::make('FireflyIII\Database\Transaction\Transaction'); - - $errors = $repository->validate($data); - if ($errors->count() > 0) { - \Log::error('Could not store transaction: ' . $errors->toJson()); - throw new FireflyException('store() transaction failed, but it should not!'); - } - - return $repository->store($data); - } - - /** - * @param array $data - * @param \TransactionJournal|\Eloquent $journal - */ - public function storeBudget($data, \TransactionJournal $journal) - { - if (isset($data['budget_id']) && intval($data['budget_id']) > 0) { - /** @var \FireflyIII\Database\Budget\Budget $budgetRepository */ - $budgetRepository = \App::make('FireflyIII\Database\Budget\Budget'); - $budget = $budgetRepository->find(intval($data['budget_id'])); - if ($budget) { - $journal->budgets()->sync([$budget->id]); - } - } - } - - /** - * @param array $data - * @param \TransactionJournal|\Eloquent $journal - */ - public function storeCategory(array $data, \TransactionJournal $journal) - { - if (isset($data['category']) && strlen($data['category']) > 0) { - /** @var \FireflyIII\Database\Category\Category $categoryRepository */ - $categoryRepository = \App::make('FireflyIII\Database\Category\Category'); - $category = $categoryRepository->firstOrCreate($data['category']); - if ($category) { - $journal->categories()->sync([$category->id]); - } - - return; - } - $journal->categories()->sync([]); - - return; - } - - /** - * @param $type - * - * @return \TransactionType|null - * @throws FireflyException - */ - public function getJournalType($type) - { - /** @var \FireflyIII\Database\TransactionType\TransactionType $typeRepository */ - $typeRepository = \App::make('FireflyIII\Database\TransactionType\TransactionType'); - - return $typeRepository->findByWhat($type); - } - - /** - * @param int $currencyId - * - * @return null|\TransactionCurrency - */ - public function getJournalCurrencyById($currencyId) - { - /** @var \FireflyIII\Database\TransactionCurrency\TransactionCurrency $currencyRepository */ - $currencyRepository = \App::make('FireflyIII\Database\TransactionCurrency\TransactionCurrency'); - - return $currencyRepository->find($currencyId); - } - - /** - * @SuppressWarnings("CamelCase") // I'm fine with this. - * - * @param array $model - * - * @return MessageBag - */ - protected function _validateAmount(array $model) - { - $errors = new MessageBag; - if (isset($model['amount']) && floatval($model['amount']) < 0.01) { - $errors->add('amount', 'Amount must be > 0.01'); - } else { - if (!isset($model['amount'])) { - $errors->add('amount', 'Amount must be set!'); - } - } - - return $errors; - } - - /** - * @SuppressWarnings("CamelCase") // I'm fine with this. - * - * @param array $model - * - * @return MessageBag - */ - protected function _validateBudget(array $model) - { - /* - * Budget (is not in rules) - */ - $errors = new MessageBag; - if (isset($model['budget_id']) && !ctype_digit($model['budget_id'])) { - $errors->add('budget_id', 'Invalid budget'); - } - - return $errors; - } - - /** - * @SuppressWarnings("CamelCase") // I'm fine with this. - * - * @param array $model - * - * @return MessageBag - * @throws FireflyException - */ - protected function _validateAccount(array $model) - { - $errors = new MessageBag; - switch (true) { - // this combination is often seen in withdrawals. - case (isset($model['account_id']) && isset($model['expense_account'])): - if (intval($model['account_id']) < 1) { - $errors->add('account_id', 'Invalid account.'); - } - break; - // often seen in deposits - case (isset($model['account_id']) && isset($model['revenue_account'])): - if (intval($model['account_id']) < 1) { - $errors->add('account_id', 'Invalid account.'); - } - break; - // often seen in transfers - case (isset($model['account_from_id']) && isset($model['account_to_id'])): - if (intval($model['account_from_id']) < 1 || intval($model['account_from_id']) < 1) { - $errors->add('account_from_id', 'Invalid account selected.'); - $errors->add('account_to_id', 'Invalid account selected.'); - - } else { - if (intval($model['account_from_id']) == intval($model['account_to_id'])) { - $errors->add('account_to_id', 'Cannot be the same as "from" account.'); - $errors->add('account_from_id', 'Cannot be the same as "to" account.'); - } - } - break; - case (isset($model['from']) && isset($model['to'])): - break; - default: - throw new FireflyException('Cannot validate accounts for transaction journal.'); - break; - } - - return $errors; - } - - /** - * Returns an object with id $id. - * - * @param int $objectId - * - * @codeCoverageIgnore - * @throws NotImplementedException - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * @return \Eloquent - */ - public function find($objectId) - { - throw new NotImplementedException; - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * Finds an account type using one of the "$what"'s: expense, asset, revenue, opening, etc. - * - * @param $what - * - * @return \AccountType|null - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function findByWhat($what) - { - throw new NotImplementedException; - } - - /** - * Returns all objects. - * - * @return Collection - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function get() - { - throw new NotImplementedException; - } - - /** - * @param array $ids - * - * @return Collection - */ - public function getByIds(array $ids) - { - return $this->getUser()->transactionjournals()->with('transactions')->whereIn('id', $ids)->orderBy('date', 'ASC')->get(); - } - - /** - * @return Carbon - */ - public function firstDate() - { - $journal = $this->first(); - if ($journal) { - return $journal->date; - } - - return Carbon::now(); - } - - /** - * @return TransactionJournal - */ - public function first() - { - return $this->getUser()->transactionjournals()->orderBy('date', 'ASC')->first(); - } - - /** - * @param Carbon $date - * - * @return float - */ - public function getSumOfExpensesByMonth(Carbon $date) - { - /** @var \FireflyIII\Report\ReportInterface $reportRepository */ - $reportRepository = \App::make('FireflyIII\Report\ReportInterface'); - - $set = $reportRepository->getExpenseGroupedForMonth($date, 200); - $sum = 0; - foreach ($set as $entry) { - $sum += $entry['amount']; - } - - - return $sum; - } - - /** - * @param Carbon $date - * - * @return float - */ - public function getSumOfIncomesByMonth(Carbon $date) - { - /** @var \FireflyIII\Report\ReportInterface $reportRepository */ - $reportRepository = \App::make('FireflyIII\Report\ReportInterface'); - - $incomes = $reportRepository->getIncomeForMonth($date); - $totalIn = 0; - /** @var \TransactionJournal $entry */ - foreach ($incomes as $entry) { - $totalIn += $entry->getAmount(); - } - - return $totalIn; - } - - /** - * @param int $limit - * - * @return \Illuminate\Pagination\Paginator - */ - public function getDepositsPaginated($limit = 50) - { - $offset = intval(\Input::get('page')) > 0 ? (intval(\Input::get('page')) - 1) * $limit : 0; - - $set = $this->getUser()->transactionJournals()->transactionTypes(['Deposit'])->withRelevantData()->take($limit)->offset($offset)->orderBy( - 'date', 'DESC' - )->get(['transaction_journals.*']); - $count = $this->getUser()->transactionJournals()->transactionTypes(['Deposit'])->count(); - $items = []; - foreach ($set as $entry) { - $items[] = $entry; - } - - return \Paginator::make($items, $count, $limit); - } - - /** - * @param \Account $account - * @param Carbon $start - * @param Carbon $end - * @param int $count - * - * @return Collection - */ - public function getInDateRangeAccount(\Account $account, Carbon $start, Carbon $end, $count = 20) - { - - $accountID = $account->id; - $query = $this->_user->transactionjournals()->with(['transactions', 'transactioncurrency', 'transactiontype'])->leftJoin( - 'transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id' - )->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')->where('accounts.id', $accountID)->where( - 'date', '>=', $start->format('Y-m-d') - )->where('date', '<=', $end->format('Y-m-d'))->orderBy('transaction_journals.date', 'DESC')->orderBy('transaction_journals.id', 'DESC')->take( - $count - )->get(['transaction_journals.*']); - - return $query; - } - - /** - * @param $currency - * - * @return null|\TransactionCurrency - */ - public function getJournalCurrency($currency) - { - /** @var \FireflyIII\Database\TransactionCurrency\TransactionCurrency $currencyRepository */ - $currencyRepository = \App::make('FireflyIII\Database\TransactionCurrency\TransactionCurrency'); - - return $currencyRepository->findByCode($currency); - } - - /** - * @param int $limit - * - * @return \Illuminate\Pagination\Paginator - */ - public function getTransfersPaginated($limit = 50) - { - $offset = intval(\Input::get('page')) > 0 ? (intval(\Input::get('page')) - 1) * $limit : 0; - - $set = $this->getUser()->transactionJournals()->transactionTypes(['Transfer'])->withRelevantData()->take($limit)->offset($offset)->orderBy( - 'date', 'DESC' - )->get(['transaction_journals.*']); - $count = $this->getUser()->transactionJournals()->transactionTypes(['Transfer'])->count(); - $items = []; - foreach ($set as $entry) { - $items[] = $entry; - } - - return \Paginator::make($items, $count, $limit); - } - - /** - * @param int $limit - * - * @return \Illuminate\Pagination\Paginator - */ - public function getWithdrawalsPaginated($limit = 50) - { - $offset = intval(\Input::get('page')) > 0 ? (intval(\Input::get('page')) - 1) * $limit : 0; - - $set = $this->getUser()->transactionJournals()->transactionTypes(['Withdrawal'])->withRelevantData()->take($limit)->offset($offset)->orderBy( - 'date', 'DESC' - )->get(['transaction_journals.*']); - $count = $this->getUser()->transactionJournals()->transactionTypes(['Withdrawal'])->count(); - $items = []; - foreach ($set as $entry) { - $items[] = $entry; - } - - return \Paginator::make($items, $count, $limit); - } -} diff --git a/app/lib/FireflyIII/Database/TransactionJournal/TransactionJournalInterface.php b/app/lib/FireflyIII/Database/TransactionJournal/TransactionJournalInterface.php deleted file mode 100644 index 264aeb5200..0000000000 --- a/app/lib/FireflyIII/Database/TransactionJournal/TransactionJournalInterface.php +++ /dev/null @@ -1,36 +0,0 @@ - 'Opening balance', - 'transfer' => 'Transfer', - 'withdrawal' => 'Withdrawal', - 'deposit' => 'Deposit', - ]; - if (!isset($translation[$what])) { - throw new FireflyException('Cannot find transaction type described as "' . e($what) . '".'); - } - - return \TransactionType::whereType($translation[$what])->first(); - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * Returns all objects. - * - * @return Collection - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function get() - { - throw new NotImplementedException; - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * @param array $ids - * - * @return Collection - * @throws NotImplementedException - * @codeCoverageIgnore - */ - public function getByIds(array $ids) - { - throw new NotImplementedException; - } -} diff --git a/app/lib/FireflyIII/Database/User/User.php b/app/lib/FireflyIII/Database/User/User.php deleted file mode 100644 index f60bfc3037..0000000000 --- a/app/lib/FireflyIII/Database/User/User.php +++ /dev/null @@ -1,73 +0,0 @@ -first(); - } - - /** - * @param $reset - * - * @return null|User - */ - public function findByReset($reset) - { - return \User::where('reset', $reset)->first(); - } - - /** - * @param array $data - * - * @return bool|\User - */ - public function register(array $data) - { - $user = new \User; - $user->email = isset($data['email']) ? $data['email'] : null; - $user->reset = \Str::random(32); - $user->password = \Hash::make(\Str::random(12)); - - // validate user: - if (!$user->isValid()) { - \Log::error('Invalid user with data: ' . isset($data['email']) ? $data['email'] : '(no email!)'); - \Session::flash('error', 'Input invalid, please try again: ' . $user->getErrors()->first()); - - return false; - } - $user->save(); - - return $user; - - } - - /** - * @param \User $user - * @param $password - * - * @return bool - */ - public function updatePassword(\User $user, $password) - { - $user->password = $password; - $user->forceSave(); - - return true; - } - -} diff --git a/app/lib/FireflyIII/Event/Account.php b/app/lib/FireflyIII/Event/Account.php deleted file mode 100644 index 6890d5b1e1..0000000000 --- a/app/lib/FireflyIII/Event/Account.php +++ /dev/null @@ -1,53 +0,0 @@ -id . '.latestBalance'); - \Cache::forget('account.' . $account->id . '.lastActivityDate'); - } - - /** - * @param \Account $account - */ - public function store(\Account $account) - { - - \Cache::forget('account.' . $account->id . '.latestBalance'); - \Cache::forget('account.' . $account->id . '.lastActivityDate'); - } - - /** - * @param Dispatcher $events - */ - public function subscribe(Dispatcher $events) - { - // triggers when others are updated. - $events->listen('account.store', 'FireflyIII\Event\Account@store'); - $events->listen('account.update', 'FireflyIII\Event\Account@update'); - $events->listen('account.destroy', 'FireflyIII\Event\Account@destroy'); - } - - /** - * @param \Account $account - */ - public function update(\Account $account) - { - \Cache::forget('account.' . $account->id . '.latestBalance'); - \Cache::forget('account.' . $account->id . '.lastActivityDate'); - } -} diff --git a/app/lib/FireflyIII/Event/Budget.php b/app/lib/FireflyIII/Event/Budget.php deleted file mode 100644 index 940f87d887..0000000000 --- a/app/lib/FireflyIII/Event/Budget.php +++ /dev/null @@ -1,67 +0,0 @@ -startdate, $budgetLimit->repeat_freq, 0); - $end->subDay(); - - $set = $budgetLimit->limitrepetitions()->where('startdate', $budgetLimit->startdate->format('Y-m-d'))->where('enddate', $end->format('Y-m-d'))->get(); - /* - * Create new LimitRepetition: - */ - if ($set->count() == 0) { - - $repetition = new \LimitRepetition(); - $repetition->startdate = $budgetLimit->startdate; - $repetition->enddate = $end; - $repetition->amount = $budgetLimit->amount; - $repetition->budgetLimit()->associate($budgetLimit); - - try { - $repetition->save(); - } catch (QueryException $e) { - \Log::error('Trying to save new LimitRepetition failed!'); - \Log::error($e->getMessage()); - } - } else { - if ($set->count() == 1) { - /* - * Update existing one. - */ - $repetition = $set->first(); - $repetition->amount = $budgetLimit->amount; - $repetition->save(); - - } - } - - } - - /** - * @param Dispatcher $events - */ - public function subscribe(Dispatcher $events) - { - $events->listen('limits.store', 'FireflyIII\Event\Budget@storeOrUpdateLimit'); - $events->listen('limits.update', 'FireflyIII\Event\Budget@storeOrUpdateLimit'); - - } -} diff --git a/app/lib/FireflyIII/Event/Event.php b/app/lib/FireflyIII/Event/Event.php deleted file mode 100644 index 34980e5a8d..0000000000 --- a/app/lib/FireflyIII/Event/Event.php +++ /dev/null @@ -1,45 +0,0 @@ -piggyBanks()->get(); - - // get reminders for each - /** @var \PiggyBank $piggyBank */ - foreach ($piggies as $piggyBank) { - $reminders = $piggyBank->reminders()->get(); - /** @var \Reminder $reminder */ - foreach ($reminders as $reminder) { - $reminder->delete(); - } - } - } - - - /** - * @param Dispatcher $events - */ - public function subscribe(Dispatcher $events) - { - // triggers when others are updated. - $events->listen('account.destroy', 'FireflyIII\Event\Event@deleteAccount'); - } -} diff --git a/app/lib/FireflyIII/Event/Piggybank.php b/app/lib/FireflyIII/Event/Piggybank.php deleted file mode 100644 index 9273f5c600..0000000000 --- a/app/lib/FireflyIII/Event/Piggybank.php +++ /dev/null @@ -1,293 +0,0 @@ - 0) { - $event = new \PiggyBankEvent; - $event->piggyBank()->associate($piggyBank); - $event->amount = floatval($amount); - $event->date = new Carbon; - if (!$event->isValid()) { - \Log::error($event->getErrors()); - \App::abort(500); - } - $event->save(); - } - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - * - * @param \TransactionJournal $journal - * - * @throws \FireflyIII\Exception\FireflyException - * @throws \FireflyIII\Exception\NotImplementedException - */ - public function destroyTransfer(\TransactionJournal $journal) - { - if ($journal->piggyBankEvents()->count() > 0) { - - /** @var \FireflyIII\Database\PiggyBank\PiggyBank $repository */ - $repository = \App::make('FireflyIII\Database\PiggyBank\PiggyBank'); - - /** @var \PiggyBank $piggyBank */ - $piggyBank = $journal->piggyBankEvents()->first()->piggyBank()->first(); - - /** @var \PiggyBankRepetition $repetition */ - $repetition = $repository->findRepetitionByDate($piggyBank, $journal->date); - - $relevantTransaction = null; - /** @var \Transaction $transaction */ - foreach ($journal->transactions as $transaction) { - if ($transaction->account_id == $piggyBank->account_id) { - $relevantTransaction = $transaction; - } - } - if (is_null($relevantTransaction)) { - return; - } - - $repetition->currentamount += floatval($relevantTransaction->amount * -1); - $repetition->save(); - - - $event = new \PiggyBankEvent; - $event->piggyBank()->associate($piggyBank); - $event->amount = floatval($relevantTransaction->amount * -1); - $event->date = new Carbon; - $event->save(); - } - } - - /** - * @param \PiggyBank $piggyBank - * @param float $amount - */ - public function removeMoney(\PiggyBank $piggyBank, $amount = 0.0) - { - $amount = $amount * -1; - if ($amount < 0) { - $event = new \PiggyBankEvent; - $event->piggyBank()->associate($piggyBank); - $event->amount = floatval($amount); - $event->date = new Carbon; - $event->save(); - } - } - - /** - * @param \PiggyBank $piggyBank - */ - public function storePiggyBank(\PiggyBank $piggyBank) - { - $repetition = new \PiggyBankRepetition; - $repetition->piggyBank()->associate($piggyBank); - $repetition->startdate = $piggyBank->startdate; - $repetition->targetdate = $piggyBank->targetdate; - $repetition->currentamount = 0; - $repetition->save(); - } - - /* - * - */ - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - * - * @param \TransactionJournal $journal - * @param int $piggyBankId - */ - public function storeTransfer(\TransactionJournal $journal, $piggyBankId = 0) - { - if (intval($piggyBankId) == 0) { - return; - } - /** @var \FireflyIII\Database\PiggyBank\PiggyBank $repository */ - $repository = \App::make('FireflyIII\Database\PiggyBank\PiggyBank'); - - /** @var \PiggyBank $piggyBank */ - $piggyBank = $repository->find($piggyBankId); - - if ($journal->transactions()->where('account_id', $piggyBank->account_id)->count() == 0) { - return; - } - /** @var \PiggyBankRepetition $repetition */ - $repetition = $repository->findRepetitionByDate($piggyBank, $journal->date); - $amount = floatval($piggyBank->targetamount); - $leftToSave = $amount - floatval($repetition->currentamount); - $transaction = $journal->transactions()->where('account_id', $piggyBank->account_id)->first(); - // must be in range of journal. Continue determines if we can move it. - if (floatval($transaction->amount < 0)) { - // amount removed from account, so removed from piggy bank. - $continue = ($transaction->amount * -1 <= floatval($repetition->currentamount)); - } else { - // amount added - $continue = $transaction->amount <= $leftToSave; - } - if ($continue) { - \Log::debug('Update repetition.'); - $repetition->currentamount += floatval($transaction->amount); - $repetition->save(); - $event = new \PiggyBankEvent; - $event->piggyBank()->associate($piggyBank); - $event->transactionjournal()->associate($journal); - $event->amount = floatval($transaction->amount); - $event->date = new Carbon; - $event->save(); - } - } - - /** - * @param Dispatcher $events - */ - public function subscribe(Dispatcher $events) - { - // triggers on piggy bank events: - $events->listen('piggy_bank.addMoney', 'FireflyIII\Event\PiggyBank@addMoney'); - $events->listen('piggy_bank.removeMoney', 'FireflyIII\Event\PiggyBank@removeMoney'); - $events->listen('piggy_bank.store', 'FireflyIII\Event\PiggyBank@storePiggyBank'); - $events->listen('piggy_bank.update', 'FireflyIII\Event\PiggyBank@updatePiggyBank'); - - \App::before( - function () { - $this->validateRepeatedExpenses(); - } - ); - - // triggers when others are updated. - $events->listen('transactionJournal.store', 'FireflyIII\Event\PiggyBank@storeTransfer'); - $events->listen('transactionJournal.update', 'FireflyIII\Event\PiggyBank@updateTransfer'); - $events->listen('transactionJournal.destroy', 'FireflyIII\Event\PiggyBank@destroyTransfer'); - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's 6. More than 5 but alright. - * - * Validates the presence of repetitions for all repeated expenses! - */ - public function validateRepeatedExpenses() - { - if (!\Auth::check()) { - return; - } - /** @var \FireflyIII\Database\PiggyBank\RepeatedExpense $repository */ - $repository = \App::make('FireflyIII\Database\PiggyBank\RepeatedExpense'); - $list = $repository->get(); - $today = Carbon::now(); - /** @var \PiggyBank $entry */ - foreach ($list as $entry) { - $count = $entry->piggyBankrepetitions()->starts($entry->startdate)->targets($entry->targetdate)->count(); - if ($count == 0) { - $repetition = new \PiggyBankRepetition; - $repetition->piggyBank()->associate($entry); - $repetition->startdate = $entry->startdate; - $repetition->targetdate = $entry->targetdate; - $repetition->currentamount = 0; - $repetition->save(); - } - $currentTarget = clone $entry->startdate; - $currentStart = null; - while ($currentTarget < $today) { - $currentStart = \DateKit::subtractPeriod($currentTarget, $entry->rep_length, 0); - $currentTarget = \DateKit::addPeriod($currentTarget, $entry->rep_length, 0); - $count = $entry->piggyBankRepetitions()->starts($currentStart)->targets($currentTarget)->count(); - if ($count == 0) { - $repetition = new \PiggyBankRepetition; - $repetition->piggyBank()->associate($entry); - $repetition->startdate = $currentStart; - $repetition->targetdate = $currentTarget; - $repetition->currentamount = 0; - $repetition->save(); - } - - } - } - } - - /** - * @param \PiggyBank $piggyBank - */ - public function updatePiggyBank(\PiggyBank $piggyBank) - { - // get the repetition: - $repetition = $piggyBank->currentRelevantRep(); - $repetition->startdate = $piggyBank->startdate; - $repetition->targetdate = $piggyBank->targetdate; - $repetition->save(); - } - - /** - * @param \TransactionJournal $journal - * - * @throws \FireflyIII\Exception\FireflyException - * @throws \FireflyIII\Exception\NotImplementedException - */ - public function updateTransfer(\TransactionJournal $journal) - { - - if ($journal->piggyBankEvents()->count() > 0) { - - $event = $journal->piggyBankEvents()->orderBy('date', 'DESC')->orderBy('id', 'DESC')->first(); - $eventSum = floatval($journal->piggyBankEvents()->orderBy('date', 'DESC')->orderBy('id', 'DESC')->sum('amount')); - - /** @var \FireflyIII\Database\PiggyBank\PiggyBank $repository */ - $repository = \App::make('FireflyIII\Database\PiggyBank\PiggyBank'); - - /** @var \PiggyBank $piggyBank */ - $piggyBank = $journal->piggyBankEvents()->first()->piggyBank()->first(); - - /** @var \PiggyBankRepetition $repetition */ - $repetition = $repository->findRepetitionByDate($piggyBank, $journal->date); - - $relevantTransaction = null; - /** @var \Transaction $transaction */ - foreach ($journal->transactions as $transaction) { - if ($transaction->account_id == $piggyBank->account_id) { - $relevantTransaction = $transaction; - } - } - if (is_null($relevantTransaction)) { - return; - } - - $diff = floatval($relevantTransaction->amount) - floatval($eventSum); - /* - * Create an event to remove /add the difference from the piggy - */ - $repetition->currentamount += $diff; - $repetition->save(); - - - $event = new \PiggyBankEvent; - $event->piggyBank()->associate($piggyBank); - $event->transactionJournal()->associate($journal); - $event->amount = $diff; - $event->date = new Carbon; - if (!$event->isValid()) { - \Log::error($event->getErrors()); - \App::abort(500); - } - $event->save(); - } - - } -} diff --git a/app/lib/FireflyIII/Event/Transaction.php b/app/lib/FireflyIII/Event/Transaction.php deleted file mode 100644 index 9c96070cd0..0000000000 --- a/app/lib/FireflyIII/Event/Transaction.php +++ /dev/null @@ -1,55 +0,0 @@ -account_id . '.latestBalance'); - \Cache::forget('account.' . $transaction->account_id . '.lastActivityDate'); - - // delete transaction: - $transaction->delete(); - } - - /** - * @param \Transaction $transaction - */ - public function store(\Transaction $transaction) - { - \Cache::forget('account.' . $transaction->account_id . '.latestBalance'); - \Cache::forget('account.' . $transaction->account_id . '.lastActivityDate'); - } - - /** - * @param Dispatcher $events - */ - public function subscribe(Dispatcher $events) - { - // triggers when others are updated. - $events->listen('transaction.store', 'FireflyIII\Event\Transaction@store'); - $events->listen('transaction.update', 'FireflyIII\Event\Transaction@update'); - $events->listen('transaction.destroy', 'FireflyIII\Event\Transaction@destroy'); - } - - /** - * @param \Transaction $transaction - */ - public function update(\Transaction $transaction) - { - \Cache::forget('account.' . $transaction->account_id . '.latestBalance'); - \Cache::forget('account.' . $transaction->account_id . '.lastActivityDate'); - } -} diff --git a/app/lib/FireflyIII/Event/TransactionJournal.php b/app/lib/FireflyIII/Event/TransactionJournal.php deleted file mode 100644 index c7cabb911c..0000000000 --- a/app/lib/FireflyIII/Event/TransactionJournal.php +++ /dev/null @@ -1,57 +0,0 @@ -get(); - - - /** @var \Bill $entry */ - foreach ($set as $entry) { - $repository->scan($entry, $journal); - } - } - - /** - * @param Dispatcher $events - */ - public function subscribe(Dispatcher $events) - { - // triggers when others are updated. - $events->listen('transactionJournal.store', 'FireflyIII\Event\TransactionJournal@store'); - $events->listen('transactionJournal.update', 'FireflyIII\Event\TransactionJournal@update'); - } - - /** - * @param \TransactionJournal $journal - */ - public function update(\TransactionJournal $journal) - { - /** @var \FireflyIII\Database\Bill\Bill $repository */ - $repository = \App::make('FireflyIII\Database\Bill\Bill'); - $set = $repository->get(); - $journal->bill_id = null; - $journal->save(); - - /** @var \Bill $entry */ - foreach ($set as $entry) { - $repository->scan($entry, $journal); - } - } -} diff --git a/app/lib/FireflyIII/Exception/FireflyException.php b/app/lib/FireflyIII/Exception/FireflyException.php deleted file mode 100644 index a2d36d3b59..0000000000 --- a/app/lib/FireflyIII/Exception/FireflyException.php +++ /dev/null @@ -1,14 +0,0 @@ -app->validator->resolver( - function ($translator, $data, $rules, $messages) { - return new FireflyValidator($translator, $data, $rules, $messages); - } - ); - } - - /** - * Return the services bla bla. - * - * @codeCoverageIgnore - * @return array - */ - public function provides() - { - // @codeCoverageIgnoreStart - return ['reminders', 'filters', 'datekit', 'navigation']; - // @codeCoverageIgnoreEnd - } - - /** - * Triggered automatically by Laravel - */ - public function register() - { - $this->registerFacades(); - $this->registerInterfaces(); - $this->registerAliases(); - - - } - - public function registerFacades() - { - $this->app->bind( - 'reminders', function () { - return new Reminders; - } - ); - $this->app->bind( - 'filter', function () { - return new Filter; - } - ); - $this->app->bind( - 'datekit', function () { - return new Date; - } - ); - $this->app->bind( - 'navigation', function () { - return new Navigation; - } - ); - $this->app->bind( - 'ffform', function () { - return new Form; - } - ); - $this->app->bind( - 'steam', function () { - return new Steam; - } - ); - $this->app->bind( - 'amount', function () { - return new Amount; - } - ); - } - - public function registerInterfaces() - { - // preferences - $this->app->bind('FireflyIII\Shared\Preferences\PreferencesInterface', 'FireflyIII\Shared\Preferences\Preferences'); - - // registration and user mail - $this->app->bind('FireflyIII\Shared\Mail\RegistrationInterface', 'FireflyIII\Shared\Mail\Registration'); - - // reports - $this->app->bind('FireflyIII\Report\ReportInterface', 'FireflyIII\Report\Report'); - $this->app->bind('FireflyIII\Report\ReportQueryInterface', 'FireflyIII\Report\ReportQuery'); - $this->app->bind('FireflyIII\Report\ReportHelperInterface', 'FireflyIII\Report\ReportHelper'); - - $this->app->bind('FireflyIII\Helper\Related\RelatedInterface', 'FireflyIII\Helper\Related\Related'); - - $this->app->bind('FireflyIII\Helper\TransactionJournal\HelperInterface', 'FireflyIII\Helper\TransactionJournal\Helper'); - - // chart - $this->app->bind('FireflyIII\Chart\ChartInterface', 'FireflyIII\Chart\Chart'); - } - - public function registerAliases() - { - // Shortcut so developers don't need to add an Alias in app/config/app.php - $this->app->booting( - function () { - $loader = AliasLoader::getInstance(); - $loader->alias('Reminders', 'FireflyIII\Shared\Facade\Reminders'); - $loader->alias('Filter', 'FireflyIII\Shared\Facade\Filter'); - $loader->alias('DateKit', 'FireflyIII\Shared\Facade\DateKit'); - $loader->alias('Navigation', 'FireflyIII\Shared\Facade\Navigation'); - $loader->alias('FFForm', 'FireflyIII\Shared\Facade\FFForm'); - $loader->alias('Steam', 'FireflyIII\Shared\Facade\Steam'); - $loader->alias('Amount', 'FireflyIII\Shared\Facade\Amount'); - } - ); - } - -} diff --git a/app/lib/FireflyIII/Form/Form.php b/app/lib/FireflyIII/Form/Form.php deleted file mode 100644 index 0396a0a33d..0000000000 --- a/app/lib/FireflyIII/Form/Form.php +++ /dev/null @@ -1,290 +0,0 @@ -get(); - $html = \View::make('form.amount', compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render(); - - return $html; - - } - - /** - * @param $name - * @param $options - * - * @return string - */ - public static function label($name, $options) - { - if (isset($options['label'])) { - return $options['label']; - } - $labels = ['amount_min' => 'Amount (min)', 'amount_max' => 'Amount (max)', 'match' => 'Matches on', 'repeat_freq' => 'Repetition', - 'account_from_id' => 'Account from', 'account_to_id' => 'Account to', 'account_id' => 'Asset account', 'budget_id' => 'Budget' - , 'piggy_bank_id' => 'Piggy bank']; - - - return isset($labels[$name]) ? $labels[$name] : str_replace('_', ' ', ucfirst($name)); - - } - - /** - * @param $name - * @param $label - * @param array $options - * - * @return array - */ - public static function expandOptionArray($name, $label, array $options) - { - $options['class'] = 'form-control'; - $options['id'] = 'ffInput_' . $name; - $options['autocomplete'] = 'off'; - $options['placeholder'] = ucfirst($label); - - return $options; - } - - /** - * @param $name - * - * @return string - */ - public static function getHolderClasses($name) - { - /* - * Get errors, warnings and successes from session: - */ - /** @var MessageBag $errors */ - $errors = \Session::get('errors'); - - /** @var MessageBag $successes */ - $successes = \Session::get('successes'); - - switch (true) { - case (!is_null($errors) && $errors->has($name)): - $classes = 'form-group has-error has-feedback'; - break; - case (!is_null($successes) && $successes->has($name)): - $classes = 'form-group has-success has-feedback'; - break; - default: - $classes = 'form-group'; - break; - } - - return $classes; - } - - /** - * @param $name - * @param $value - * - * @return mixed - */ - public static function fillFieldValue($name, $value) - { - if (\Session::has('preFilled')) { - $preFilled = \Session::get('preFilled'); - $value = isset($preFilled[$name]) && is_null($value) ? $preFilled[$name] : $value; - } - if (!is_null(\Input::old($name))) { - $value = \Input::old($name); - } - - return $value; - } - - /** - * @param $name - * @param null $value - * @param array $options - * - * @return string - * @throws FireflyException - */ - public static function ffBalance($name, $value = null, array $options = []) - { - $label = self::label($name, $options); - $options = self::expandOptionArray($name, $label, $options); - $classes = self::getHolderClasses($name); - $value = self::fillFieldValue($name, $value); - $options['step'] = 'any'; - $defaultCurrency = isset($options['currency']) ? $options['currency'] : \Amount::getDefaultCurrency(); - $currencies = \TransactionCurrency::orderBy('code', 'ASC')->get(); - $html = \View::make('form.balance', compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render(); - - return $html; - } - - /** - * @param $name - * @param int $value - * @param null $checked - * @param array $options - * - * @return string - * @throws FireflyException - */ - public static function ffCheckbox($name, $value = 1, $checked = null, $options = []) - { - $options['checked'] = $checked === true ? true : null; - $label = self::label($name, $options); - $options = self::expandOptionArray($name, $label, $options); - $classes = self::getHolderClasses($name); - $value = self::fillFieldValue($name, $value); - - unset($options['placeholder'], $options['autocomplete'], $options['class']); - - $html = \View::make('form.checkbox', compact('classes', 'name', 'label', 'value', 'options'))->render(); - - return $html; - } - - /** - * @param $name - * @param null $value - * @param array $options - * - * @return string - * @throws FireflyException - */ - public static function ffDate($name, $value = null, array $options = []) - { - $label = self::label($name, $options); - $options = self::expandOptionArray($name, $label, $options); - $classes = self::getHolderClasses($name); - $value = self::fillFieldValue($name, $value); - $html = \View::make('form.date', compact('classes', 'name', 'label', 'value', 'options'))->render(); - - return $html; - } - - /** - * @param $name - * @param null $value - * @param array $options - * - * @return string - * @throws FireflyException - */ - public static function ffInteger($name, $value = null, array $options = []) - { - $label = self::label($name, $options); - $options = self::expandOptionArray($name, $label, $options); - $classes = self::getHolderClasses($name); - $value = self::fillFieldValue($name, $value); - $options['step'] = '1'; - $html = \View::make('form.integer', compact('classes', 'name', 'label', 'value', 'options'))->render(); - - return $html; - - } - - /** - * Return buttons for update/validate/return. - * - * @param $type - * @param $name - * - * @return string - * @throws FireflyException - */ - public static function ffOptionsList($type, $name) - { - $previousValue = \Input::old('post_submit_action'); - $previousValue = is_null($previousValue) ? 'store' : $previousValue; - $html = \View::make('form.options', compact('type', 'name', 'previousValue'))->render(); - - return $html; - } - - /** - * @param $name - * @param array $list - * @param null $selected - * @param array $options - * - * @return string - */ - public static function ffSelect($name, array $list = [], $selected = null, array $options = []) - { - $label = self::label($name, $options); - $options = self::expandOptionArray($name, $label, $options); - $classes = self::getHolderClasses($name); - $selected = self::fillFieldValue($name, $selected); - $html = \View::make('form.select', compact('classes', 'name', 'label', 'selected', 'options', 'list'))->render(); - - return $html; - } - - /** - * @param $name - * @param null $value - * @param array $options - * - * @return string - * @throws FireflyException - */ - public static function ffTags($name, $value = null, array $options = []) - { - $label = self::label($name, $options); - $options = self::expandOptionArray($name, $label, $options); - $classes = self::getHolderClasses($name); - $value = self::fillFieldValue($name, $value); - $options['data-role'] = 'tagsinput'; - $html = \View::make('form.tags', compact('classes', 'name', 'label', 'value', 'options'))->render(); - - return $html; - } - - /** - * @param $name - * @param null $value - * @param array $options - * - * @return string - * @throws FireflyException - */ - public static function ffText($name, $value = null, array $options = []) - { - $label = self::label($name, $options); - $options = self::expandOptionArray($name, $label, $options); - $classes = self::getHolderClasses($name); - $value = self::fillFieldValue($name, $value); - $html = \View::make('form.text', compact('classes', 'name', 'label', 'value', 'options'))->render(); - - return $html; - - } -} diff --git a/app/lib/FireflyIII/Helper/Related/Related.php b/app/lib/FireflyIII/Helper/Related/Related.php deleted file mode 100644 index 06e1047858..0000000000 --- a/app/lib/FireflyIII/Helper/Related/Related.php +++ /dev/null @@ -1,88 +0,0 @@ -setUser(\Auth::user()); - } - - /** - * @param array $objectIds - * - * @return Collection - */ - public function getJournalsByIds(array $objectIds) - { - /** @var \FireflyIII\Database\TransactionJournal\TransactionJournal $repository */ - $repository = \App::make('FireflyIII\Database\TransactionJournal\TransactionJournal'); - - return $repository->getByIds($objectIds); - } - - /** - * @param string $query - * @param \TransactionJournal $journal - * - * @return Collection - */ - public function search($query, \TransactionJournal $journal) - { - $start = clone $journal->date; - $end = clone $journal->date; - $start->startOfMonth(); - $end->endOfMonth(); - - // get already related transactions: - $exclude = [$journal->id]; - foreach ($journal->transactiongroups()->get() as $group) { - foreach ($group->transactionjournals()->get() as $current) { - $exclude[] = $current->id; - } - } - $exclude = array_unique($exclude); - - /** @var Collection $collection */ - $collection = $this->getUser()->transactionjournals() - ->withRelevantData() - ->before($end)->after($start)->where('encrypted', 0) - ->whereNotIn('id', $exclude) - ->where('description', 'LIKE', '%' . $query . '%') - ->get(); - - // manually search encrypted entries: - /** @var Collection $encryptedCollection */ - $encryptedCollection = $this->getUser()->transactionjournals() - ->withRelevantData() - ->before($end)->after($start) - ->where('encrypted', 1) - ->whereNotIn('id', $exclude) - ->get(); - $encrypted = $encryptedCollection->filter( - function (\TransactionJournal $journal) use ($query) { - $strPos = strpos(strtolower($journal->description), strtolower($query)); - if ($strPos !== false) { - return $journal; - } - - return null; - } - ); - - return $collection->merge($encrypted); - } -} diff --git a/app/lib/FireflyIII/Helper/Related/RelatedInterface.php b/app/lib/FireflyIII/Helper/Related/RelatedInterface.php deleted file mode 100644 index f2072cf823..0000000000 --- a/app/lib/FireflyIII/Helper/Related/RelatedInterface.php +++ /dev/null @@ -1,29 +0,0 @@ -account->id); - } - - // otherwise (its a deposit), it's been paid into account #0. - return intval($transactions[0]->account->id); - } - - /** - * @return Collection - */ - public function getAssetAccounts() - { - /** @var \FireflyIII\Database\Account\Account $accountRepository */ - $accountRepository = \App::make('FireflyIII\Database\Account\Account'); - - /** @var Collection $list */ - $list = $accountRepository->getAccountsByType(['Default account', 'Asset account']); - $filtered = $list->filter( - function (\Account $account) { - if (intval($account->active) === 1) { - return $account; - } - return null; - } - ); - - return $filtered; - } - - /** - * @return Collection - */ - public function getBudgets() - { - /** @var \FireflyIII\Database\Budget\Budget $budgetRepository */ - $budgetRepository = \App::make('FireflyIII\Database\Budget\Budget'); - - return $budgetRepository->get(); - - } - - /** - * @return Collection - */ - public function getPiggyBanks() - { - /** @var \FireflyIII\Database\PiggyBank\PiggyBank $piggyRepository */ - $piggyRepository = \App::make('FireflyIII\Database\PiggyBank\PiggyBank'); - - return $piggyRepository->get(); - - - } - - /** - * @return Collection - */ - public function getRepeatedExpenses() - { - /** @var \FireflyIII\Database\PiggyBank\RepeatedExpense $repRepository */ - $repRepository = \App::make('FireflyIII\Database\PiggyBank\RepeatedExpense'); - - return $repRepository->get(); - - - } - - -} diff --git a/app/lib/FireflyIII/Helper/TransactionJournal/HelperInterface.php b/app/lib/FireflyIII/Helper/TransactionJournal/HelperInterface.php deleted file mode 100644 index 06bcac0de7..0000000000 --- a/app/lib/FireflyIII/Helper/TransactionJournal/HelperInterface.php +++ /dev/null @@ -1,45 +0,0 @@ -_accounts = $accounts; - $this->_journals = $journals; - $this->_queries = \App::make('FireflyIII\Report\ReportQueryInterface'); - $this->_helper = \App::make('FireflyIII\Report\ReportHelperInterface'); - - - } - - /** - * This methods fails to take in account transfers FROM shared accounts. - * - * @param Carbon $start - * @param Carbon $end - * @param int $limit - * - * @return Collection - */ - public function expensesGroupedByAccount(Carbon $start, Carbon $end, $limit = 15) - { - $result = $this->_queries->journalsByExpenseAccount($start, $end); - $array = $this->_helper->makeArray($result); - $limited = $this->_helper->limitArray($array, $limit); - - return $limited; - - } - - /** - * Gets all the users shared and non-shared accounts combined with various meta-data - * to display the amount of money spent that month compared to what's been spend within - * budgets. - * - * @param Carbon $date - * - * @return Collection - */ - public function getAccountListBudgetOverview(Carbon $date) - { - $start = clone $date; - $start->startOfMonth(); - $end = clone $date; - $end->endOfMonth(); - $start->subDay(); - $accounts = $this->_queries->getAllAccounts($start, $end); - - $accounts->each( - function (\Account $account) use ($start, $end) { - $budgets = $this->_queries->getBudgetSummary($account, $start, $end); - $balancedAmount = $this->_queries->balancedTransactionsSum($account, $start, $end); - $array = []; - foreach ($budgets as $budget) { - $id = intval($budget->id); - $data = $budget->toArray(); - $array[$id] = $data; - } - $account->budgetInformation = $array; - $account->balancedAmount = $balancedAmount; - - } - ); - - return $accounts; - - } - - /** - * @param Carbon $date - * - * @return array - */ - public function getAccountsForMonth(Carbon $date) - { - $start = clone $date; - $start->startOfMonth()->subDay(); - $end = clone $date; - $end->endOfMonth(); - \Log::debug('Monthly report account dates: start:[' . $start->format('Y-m-d') . '] and end:[' . $end->format('Y-m-d') . ']'); - $list = $this->_queries->accountList(); - $accounts = []; - /** @var \Account $account */ - foreach ($list as $account) { - $id = intval($account->id); - /** @noinspection PhpParamsInspection */ - $accounts[$id] = [ - 'name' => $account->name, - 'startBalance' => \Steam::balance($account, $start), - 'endBalance' => \Steam::balance($account, $end) - ]; - - $accounts[$id]['difference'] = $accounts[$id]['endBalance'] - $accounts[$id]['startBalance']; - } - - return $accounts; - } - - /** - * @param Carbon $date - * - * @return Collection - */ - public function getBudgetsForMonth(Carbon $date) - { - $start = clone $date; - $start->startOfMonth(); - $end = clone $date; - $end->endOfMonth(); - // all budgets - $set = $this->_queries->getAllBudgets($date); - $budgets = $this->_helper->makeArray($set); - $amountSet = $this->_queries->journalsByBudget($start, $end); - $amounts = $this->_helper->makeArray($amountSet); - $combined = $this->_helper->mergeArrays($budgets, $amounts); - $combined[0]['spent'] = isset($combined[0]['spent']) ? $combined[0]['spent'] : 0.0; - $combined[0]['amount'] = isset($combined[0]['amount']) ? $combined[0]['amount'] : 0.0; - $combined[0]['name'] = 'No budget'; - - // find transactions to shared expense accounts, which are without a budget by default: - $transfers = $this->_queries->sharedExpenses($start, $end); - foreach ($transfers as $transfer) { - $combined[0]['spent'] += floatval($transfer->amount) * -1; - } - - return $combined; - } - - /** - * @param Carbon $date - * @param int $limit - * - * @return array - */ - public function getCategoriesForMonth(Carbon $date, $limit = 15) - { - $start = clone $date; - $start->startOfMonth(); - $end = clone $date; - $end->endOfMonth(); - // all categories. - $result = $this->_queries->journalsByCategory($start, $end); - $categories = $this->_helper->makeArray($result); - - // all transfers - $result = $this->_queries->sharedExpensesByCategory($start, $end); - $transfers = $this->_helper->makeArray($result); - $merged = $this->_helper->mergeArrays($categories, $transfers); - - // sort. - $sorted = $this->_helper->sortNegativeArray($merged); - - // limit to $limit: - $cut = $this->_helper->limitArray($sorted, $limit); - - return $cut; - } - - /** - * @param Carbon $date - * @param int $limit - * - * @return Collection - */ - public function getExpenseGroupedForMonth(Carbon $date, $limit = 15) - { - $start = clone $date; - $start->startOfMonth(); - $end = clone $date; - $end->endOfMonth(); - - $set = $this->_queries->journalsByExpenseAccount($start, $end); - $expenses = $this->_helper->makeArray($set); - -// $alt = $this->_queries->sharedExpenses($start, $end); -// $transfers = $this->_helper->makeArray($alt); -// -// $expenses[-1] = [ -// 'amount' => 0, -// 'name' => 'Transfers to shared', -// 'spent' => 0 -// ]; -// -// foreach ($transfers as $transfer) { -// $expenses[-1]['amount'] += $transfer['amount']; -// } - - $expenses = $this->_helper->sortArray($expenses); - $limited = $this->_helper->limitArray($expenses, $limit); - - return $limited; - - } - - /** - * This method gets all incomes (journals) in a list. - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * @param Carbon $date - * @param bool $shared - * - * @return Collection - */ - public function getIncomeForMonth(Carbon $date, $shared = false) - { - $start = clone $date; - $start->startOfMonth(); - $end = clone $date; - $end->endOfMonth(); - - return $this->_queries->incomeByPeriod($start, $end); - - - } - - /** - * @param Carbon $date - * - * @return Collection - */ - public function getPiggyBanksForMonth(Carbon $date) - { - $start = clone $date; - $start->startOfMonth(); - $end = clone $date; - $end->endOfMonth(); - - \PiggyBank:: - leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id') - ->where('accounts.user_id', \Auth::user()->id) - ->where('repeats', 0) - ->where( - function (Builder $query) use ($start, $end) { - $query->whereNull('piggy_banks.deleted_at'); - $query->orWhere( - function (Builder $query) use ($start, $end) { - $query->whereNotNull('piggy_banks.deleted_at'); - $query->where('piggy_banks.deleted_at', '>=', $start->format('Y-m-d 00:00:00')); - $query->where('piggy_banks.deleted_at', '<=', $end->format('Y-m-d 00:00:00')); - } - ); - } - ) - ->get(['piggy_banks.*']); - - - } - - /** - * @param Carbon $start - * - * @return array - */ - public function listOfMonths(Carbon $start) - { - $end = Carbon::now(); - $months = []; - while ($start <= $end) { - $months[] = [ - 'formatted' => $start->format('F Y'), - 'month' => intval($start->format('m')), - 'year' => intval($start->format('Y')), - ]; - $start->addMonth(); - } - - return $months; - } - - /** - * @param Carbon $start - * - * @return array - */ - public function listOfYears(Carbon $start) - { - $end = Carbon::now(); - $years = []; - while ($start <= $end) { - $years[] = $start->format('Y'); - $start->addYear(); - } - - return $years; - } - - /** - * - * @param Carbon $start - * @param Carbon $end - * - * @return Collection - */ - public function revenueGroupedByAccount(Carbon $start, Carbon $end) - { - return $this->_queries->journalsByRevenueAccount($start, $end); - - - } - - /** - * @param Carbon $date - * - * @return array - */ - public function yearBalanceReport(Carbon $date) - { - $start = clone $date; - $end = clone $date; - $sharedAccounts = []; - $sharedCollection = \Auth::user()->accounts() - ->leftJoin('account_meta', 'account_meta.account_id', '=', 'accounts.id') - ->where('account_meta.name', '=', 'accountRole') - ->where('account_meta.data', '=', json_encode('sharedExpense')) - ->get(['accounts.id']); - - foreach ($sharedCollection as $account) { - $sharedAccounts[] = $account->id; - } - - $accounts = $this->_accounts->getAccountsByType(['Default account', 'Asset account'])->filter( - function (\Account $account) use ($sharedAccounts) { - if (!in_array($account->id, $sharedAccounts)) { - return $account; - } - - return null; - } - ); - $report = []; - $start->startOfYear()->subDay(); - $end->endOfYear(); - - foreach ($accounts as $account) { - $report[] = [ - 'start' => \Steam::balance($account, $start), - 'end' => \Steam::balance($account, $end), - 'account' => $account, - 'shared' => $account->accountRole == 'sharedExpense' - ]; - } - - return $report; - } - -} diff --git a/app/lib/FireflyIII/Report/ReportHelper.php b/app/lib/FireflyIII/Report/ReportHelper.php deleted file mode 100644 index d2e79b6d8f..0000000000 --- a/app/lib/FireflyIII/Report/ReportHelper.php +++ /dev/null @@ -1,142 +0,0 @@ - 'Others', - 'amount' => 0 - ]; - $return = []; - $count = 0; - foreach ($array as $id => $entry) { - if ($count < ($limit - 1)) { - $return[$id] = $entry; - } else { - $others['amount'] += $entry['amount']; - } - - $count++; - } - $return[0] = $others; - - return $return; - - } - - /** - * Turns a collection into an array. Needs the field 'id' for the key, - * and saves only 'name' and 'amount' as a sub array. - * - * @param Collection $collection - * - * @return array - */ - public function makeArray(Collection $collection) - { - $array = []; - foreach ($collection as $entry) { - $entry->spent = isset($entry->spent) ? floatval($entry->spent) : 0.0; - $id = intval($entry->id); - if (isset($array[$id])) { - $array[$id]['amount'] += floatval($entry->amount); - $array[$id]['spent'] += floatval($entry->spent); - } else { - $array[$id] = [ - 'amount' => floatval($entry->amount), - 'spent' => floatval($entry->spent), - 'name' => $entry->name - ]; - } - } - - return $array; - } - - /** - * Merges two of the arrays as defined above. Can't handle more (yet) - * - * @param array $one - * @param array $two - * - * @return array - */ - public function mergeArrays(array $one, array $two) - { - foreach ($two as $id => $value) { - // $otherId also exists in $one: - if (isset($one[$id])) { - $one[$id]['amount'] += $value['amount']; - $one[$id]['spent'] += $value['spent']; - } else { - $one[$id] = $value; - } - } - - return $one; - } - - /** - * Sort an array where all 'amount' keys are positive floats. - * - * @param array $array - * - * @return array - */ - public function sortArray(array $array) - { - uasort( - $array, function ($left, $right) { - if ($left['amount'] == $right['amount']) { - return 0; - } - - return ($left['amount'] < $right['amount']) ? 1 : -1; - } - ); - - return $array; - - } - - /** - * Sort an array where all 'amount' keys are negative floats. - * - * @param array $array - * - * @return array - */ - public function sortNegativeArray(array $array) - { - uasort( - $array, function ($left, $right) { - if ($left['amount'] == $right['amount']) { - return 0; - } - - return ($left['amount'] < $right['amount']) ? -1 : 1; - } - ); - - return $array; - } -} diff --git a/app/lib/FireflyIII/Report/ReportHelperInterface.php b/app/lib/FireflyIII/Report/ReportHelperInterface.php deleted file mode 100644 index 828e322603..0000000000 --- a/app/lib/FireflyIII/Report/ReportHelperInterface.php +++ /dev/null @@ -1,64 +0,0 @@ -accounts() - ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') - ->leftJoin( - 'account_meta', function (JoinClause $join) { - $join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', "accountRole"); - } - ) - ->whereIn('account_types.type', ['Default account', 'Cash account', 'Asset account']) - ->where('active', 1) - ->where( - function (Builder $query) { - $query->where('account_meta.data', '!=', '"sharedExpense"'); - $query->orWhereNull('account_meta.data'); - } - ) - ->get(['accounts.*']); - } - - /** - * This method will get a list of all expenses in a certain time period that have no budget - * and are balanced by a transfer to make up for it. - * - * @param \Account $account - * @param Carbon $start - * @param Carbon $end - * - * @return Collection - */ - public function balancedTransactionsList(\Account $account, Carbon $start, Carbon $end) - { - - $set = \TransactionJournal:: - leftJoin('transaction_group_transaction_journal', 'transaction_group_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') - ->leftJoin( - 'transaction_group_transaction_journal as otherFromGroup', function (JoinClause $join) { - $join->on('otherFromGroup.transaction_group_id', '=', 'transaction_group_transaction_journal.transaction_group_id') - ->on('otherFromGroup.transaction_journal_id', '!=', 'transaction_journals.id'); - } - ) - ->leftJoin('transaction_journals as otherJournals', 'otherJournals.id', '=', 'otherFromGroup.transaction_journal_id') - ->leftJoin('transaction_types', 'transaction_types.id', '=', 'otherJournals.transaction_type_id') - ->leftJoin( - 'transactions', function (JoinClause $join) { - $join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('amount', '>', 0); - } - ) - ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'otherJournals.id') - ->before($end)->after($start) - ->where('transaction_types.type', 'Withdrawal') - ->where('transaction_journals.user_id', \Auth::user()->id) - ->whereNull('budget_transaction_journal.budget_id')->whereNull('transaction_journals.deleted_at') - ->whereNull('otherJournals.deleted_at') - ->where('transactions.account_id', $account->id) - ->whereNotNull('transaction_group_transaction_journal.transaction_group_id')->groupBy('transaction_journals.id') - ->get( - [ - 'transaction_journals.id as transferId', - 'transaction_journals.description as transferDescription', - 'transaction_group_transaction_journal.transaction_group_id as groupId', - 'otherFromGroup.transaction_journal_id as expenseId', - 'otherJournals.description as expenseDescription', - 'transactions.amount' - ] - ); - - return $set; - } - - /** - * This method will sum up all expenses in a certain time period that have no budget - * and are balanced by a transfer to make up for it. - * - * @param \Account $account - * @param Carbon $start - * @param Carbon $end - * - * @return float - */ - public function balancedTransactionsSum(\Account $account, Carbon $start, Carbon $end) - { - $list = $this->balancedTransactionsList($account, $start, $end); - $sum = 0; - foreach ($list as $entry) { - $sum += floatval($entry->amount); - } - - return $sum; - } - - /** - * Get a users accounts combined with various meta-data related to the start and end date. - * - * @param Carbon $start - * @param Carbon $end - * - * @return Collection - */ - public function getAllAccounts(Carbon $start, Carbon $end) - { - $set = \Auth::user()->accounts() - ->accountTypeIn(['Default account', 'Asset account', 'Cash account']) - ->leftJoin( - 'account_meta', function (JoinClause $join) { - $join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole'); - } - ) - ->where( - function (Builder $query) { - $query->where('account_meta.data', '!=', '"sharedExpense"'); - $query->orWhereNull('account_meta.data'); - } - ) - ->get(['accounts.*']); - $set->each( - function (\Account $account) use ($start, $end) { - /** @noinspection PhpParamsInspection */ - $account->startBalance = \Steam::balance($account, $start); - $account->endBalance = \Steam::balance($account, $end); - } - ); - - return $set; - } - - /** - * Gets a list of all budgets and if present, the amount of the current BudgetLimit - * as well - * - * @param Carbon $date - * - * @return Collection - */ - public function getAllBudgets(Carbon $date) - { - return \Auth::user()->budgets() - ->leftJoin( - 'budget_limits', function (JoinClause $join) use ($date) { - $join->on('budget_limits.budget_id', '=', 'budgets.id')->where('budget_limits.startdate', '=', $date->format('Y-m-d')); - } - ) - ->get(['budgets.*', 'budget_limits.amount as amount']); - } - - /** - * Grabs a summary of all expenses grouped by budget, related to the account. - * - * @param \Account $account - * @param Carbon $start - * @param Carbon $end - * - * @return mixed - */ - public function getBudgetSummary(\Account $account, Carbon $start, Carbon $end) - { - $set = \TransactionJournal:: - leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') - ->leftJoin('budgets', 'budgets.id', '=', 'budget_transaction_journal.budget_id') - ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') - ->leftJoin( - 'transactions', function (JoinClause $join) { - $join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.amount', '<', 0); - } - ) - ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') - ->before($end) - ->after($start) - ->where('accounts.id', $account->id) - ->where('transaction_journals.user_id', \Auth::user()->id) - ->where('transaction_types.type', 'Withdrawal') - ->groupBy('budgets.id') - ->orderBy('budgets.id') - ->get(['budgets.id', 'budgets.name', \DB::Raw('SUM(`transactions`.`amount`) as `amount`')]); - - return $set; - - - } - - /** - * This method returns all "income" journals in a certain period, which are both transfers from a shared account - * and "ordinary" deposits. The query used is almost equal to ReportQueryInterface::journalsByRevenueAccount but it does - * not group and returns different fields. - * - * @param Carbon $start - * @param Carbon $end - * - * @return Collection - */ - public function incomeByPeriod(Carbon $start, Carbon $end) - { - return \TransactionJournal:: - leftJoin( - 'transactions as t_from', function (JoinClause $join) { - $join->on('t_from.transaction_journal_id', '=', 'transaction_journals.id')->where('t_from.amount', '<', 0); - } - ) - ->leftJoin('accounts as ac_from', 't_from.account_id', '=', 'ac_from.id') - ->leftJoin( - 'account_meta as acm_from', function (JoinClause $join) { - $join->on('ac_from.id', '=', 'acm_from.account_id')->where('acm_from.name', '=', 'accountRole'); - } - ) - ->leftJoin( - 'transactions as t_to', function (JoinClause $join) { - $join->on('t_to.transaction_journal_id', '=', 'transaction_journals.id')->where('t_to.amount', '>', 0); - } - ) - ->leftJoin('accounts as ac_to', 't_to.account_id', '=', 'ac_to.id') - ->leftJoin( - 'account_meta as acm_to', function (JoinClause $join) { - $join->on('ac_to.id', '=', 'acm_to.account_id')->where('acm_to.name', '=', 'accountRole'); - } - ) - ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') - ->where( - function ($query) { - $query->where( - function ($q) { - $q->where('transaction_types.type', 'Deposit'); - $q->where('acm_to.data', '!=', '"sharedExpense"'); - } - ); - $query->orWhere( - function ($q) { - $q->where('transaction_types.type', 'Transfer'); - $q->where('acm_from.data', '=', '"sharedExpense"'); - } - ); - } - ) - ->before($end)->after($start) - ->where('transaction_journals.user_id', \Auth::user()->id) - ->groupBy('t_from.account_id')->orderBy('transaction_journals.date') - ->get( - ['transaction_journals.id', - 'transaction_journals.description', - 'transaction_types.type', - 't_to.amount', 'transaction_journals.date', 't_from.account_id as account_id', - 'ac_from.name as name'] - ); - } - - /** - * Gets a list of expenses grouped by the budget they were filed under. - * - * @param Carbon $start - * @param Carbon $end - * - * @return Collection - */ - public function journalsByBudget(Carbon $start, Carbon $end) - { - return \Auth::user()->transactionjournals() - ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') - ->leftJoin('budgets', 'budget_transaction_journal.budget_id', '=', 'budgets.id') - ->leftJoin( - 'transactions', function (JoinClause $join) { - $join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0); - } - ) - ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') - ->leftJoin( - 'account_meta', function (JoinClause $join) { - $join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole'); - } - ) - ->leftJoin('transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id') - ->where('transaction_journals.date', '>=', $start->format('Y-m-d')) - ->where('transaction_journals.date', '<=', $end->format('Y-m-d')) - ->where('account_meta.data', '!=', '"sharedExpense"') - ->where('transaction_types.type', 'Withdrawal') - ->groupBy('budgets.id') - ->orderBy('budgets.name', 'ASC') - ->get(['budgets.id', 'budgets.name', \DB::Raw('SUM(`transactions`.`amount`) AS `spent`')]); - } - - /** - * Gets a list of categories and the expenses therein, grouped by the relevant category. - * This result excludes transfers to shared accounts which are expenses, technically. - * - * @param Carbon $start - * @param Carbon $end - * - * @return Collection - */ - public function journalsByCategory(Carbon $start, Carbon $end) - { - return \Auth::user()->transactionjournals() - ->leftJoin( - 'category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id' - ) - ->leftJoin('categories', 'category_transaction_journal.category_id', '=', 'categories.id') - ->leftJoin( - 'transactions', function (JoinClause $join) { - $join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0); - } - ) - ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') - ->leftJoin( - 'account_meta', function (JoinClause $join) { - $join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole'); - } - ) - ->leftJoin('transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id') - ->where('transaction_journals.date', '>=', $start->format('Y-m-d')) - ->where('transaction_journals.date', '<=', $end->format('Y-m-d')) - ->where('account_meta.data', '!=', '"sharedExpense"') - ->where('transaction_types.type', 'Withdrawal') - ->groupBy('categories.id') - ->orderBy('amount') - ->get(['categories.id', 'categories.name', \DB::Raw('SUM(`transactions`.`amount`) AS `amount`')]); - - } - - /** - * Gets a list of expense accounts and the expenses therein, grouped by that expense account. - * This result excludes transfers to shared accounts which are expenses, technically. - * - * So now it will include them! - * - * @param Carbon $start - * @param Carbon $end - * - * @return Collection - */ - public function journalsByExpenseAccount(Carbon $start, Carbon $end) - { - return \TransactionJournal:: - leftJoin( - 'transactions as t_from', function (JoinClause $join) { - $join->on('t_from.transaction_journal_id', '=', 'transaction_journals.id')->where('t_from.amount', '<', 0); - } - ) - ->leftJoin('accounts as ac_from', 't_from.account_id', '=', 'ac_from.id') - ->leftJoin( - 'account_meta as acm_from', function (JoinClause $join) { - $join->on('ac_from.id', '=', 'acm_from.account_id')->where('acm_from.name', '=', 'accountRole'); - } - ) - ->leftJoin( - 'transactions as t_to', function (JoinClause $join) { - $join->on('t_to.transaction_journal_id', '=', 'transaction_journals.id')->where('t_to.amount', '>', 0); - } - ) - ->leftJoin('accounts as ac_to', 't_to.account_id', '=', 'ac_to.id') - ->leftJoin( - 'account_meta as acm_to', function (JoinClause $join) { - $join->on('ac_to.id', '=', 'acm_to.account_id')->where('acm_to.name', '=', 'accountRole'); - } - ) - ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') - - ->where( - function ($query) { - $query->where( - function ($q) { - $q->where('transaction_types.type', 'Withdrawal'); - $q->where('acm_from.data', '!=', '"sharedExpense"'); - } - ); - $query->orWhere( - function ($q) { - $q->where('transaction_types.type', 'Transfer'); - $q->where('acm_to.data', '=', '"sharedExpense"'); - } - ); - } - ) - - - ->before($end) - ->after($start) - ->where('transaction_journals.user_id', \Auth::user()->id) - ->groupBy('t_to.account_id') - ->orderBy('amount', 'DESC') - ->get(['t_to.account_id as id', 'ac_to.name as name', \DB::Raw('SUM(t_to.amount) as `amount`')]); - } - - /** - * This method returns all deposits into asset accounts, grouped by the revenue account, - * - * @param Carbon $start - * @param Carbon $end - * - * @return Collection - */ - public function journalsByRevenueAccount(Carbon $start, Carbon $end) - { - return \TransactionJournal:: - leftJoin( - 'transactions as t_from', function (JoinClause $join) { - $join->on('t_from.transaction_journal_id', '=', 'transaction_journals.id')->where('t_from.amount', '<', 0); - } - ) - ->leftJoin('accounts as ac_from', 't_from.account_id', '=', 'ac_from.id') - ->leftJoin( - 'account_meta as acm_from', function (JoinClause $join) { - $join->on('ac_from.id', '=', 'acm_from.account_id')->where('acm_from.name', '=', 'accountRole'); - } - ) - ->leftJoin( - 'transactions as t_to', function (JoinClause $join) { - $join->on('t_to.transaction_journal_id', '=', 'transaction_journals.id')->where('t_to.amount', '>', 0); - } - ) - ->leftJoin('accounts as ac_to', 't_to.account_id', '=', 'ac_to.id') - ->leftJoin( - 'account_meta as acm_to', function (JoinClause $join) { - $join->on('ac_to.id', '=', 'acm_to.account_id')->where('acm_to.name', '=', 'accountRole'); - } - ) - ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') - ->where( - function ($query) { - $query->where( - function ($q) { - $q->where('transaction_types.type', 'Deposit'); - $q->where('acm_to.data', '!=', '"sharedExpense"'); - } - ); - $query->orWhere( - function ($q) { - $q->where('transaction_types.type', 'Transfer'); - $q->where('acm_from.data', '=', '"sharedExpense"'); - } - ); - } - ) - ->before($end)->after($start) - ->where('transaction_journals.user_id', \Auth::user()->id) - ->groupBy('t_from.account_id')->orderBy('amount') - ->get(['t_from.account_id as account_id', 'ac_from.name as name', \DB::Raw('SUM(t_from.amount) as `amount`')]); - } - - /** - * With an equally misleading name, this query returns are transfers to shared accounts. These are considered - * expenses. - * - * @param Carbon $start - * @param Carbon $end - * - * @return Collection - */ - public function sharedExpenses(Carbon $start, Carbon $end) - { - return \TransactionJournal:: - leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') - ->leftJoin( - 'transactions', function (JoinClause $join) { - $join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where( - 'transactions.amount', '>', 0 - ); - } - ) - ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') - ->leftJoin( - 'account_meta', function (JoinClause $join) { - $join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole'); - } - ) - ->where('account_meta.data', '"sharedExpense"') - ->after($start) - ->before($end) - ->where('transaction_types.type', 'Transfer') - ->where('transaction_journals.user_id', \Auth::user()->id) - ->get( - ['transaction_journals.id', 'transaction_journals.description', 'transactions.account_id', 'accounts.name', - 'transactions.amount'] - ); - - } - - /** - * With a slightly misleading name, this query returns all transfers to shared accounts - * which are technically expenses, since it won't be just your money that gets spend. - * - * @param Carbon $start - * @param Carbon $end - * - * @return Collection - */ - public function sharedExpensesByCategory(Carbon $start, Carbon $end) - { - return \TransactionJournal:: - leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') - ->leftJoin( - 'transactions', function (JoinClause $join) { - $join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where( - 'transactions.amount', '>', 0 - ); - } - ) - ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') - ->leftJoin( - 'account_meta', function (JoinClause $join) { - $join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole'); - } - ) - ->leftJoin( - 'category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id' - ) - ->leftJoin('categories', 'category_transaction_journal.category_id', '=', 'categories.id') - ->where('account_meta.data', '"sharedExpense"') - ->after($start) - ->before($end) - ->where('transaction_types.type', 'Transfer') - ->where('transaction_journals.user_id', \Auth::user()->id) - ->groupBy('categories.name') - ->get( - [ - 'categories.id', - 'categories.name as name', - \DB::Raw('SUM(`transactions`.`amount`) * -1 AS `amount`') - ] - ); - } -} diff --git a/app/lib/FireflyIII/Report/ReportQueryInterface.php b/app/lib/FireflyIII/Report/ReportQueryInterface.php deleted file mode 100644 index 046835b843..0000000000 --- a/app/lib/FireflyIII/Report/ReportQueryInterface.php +++ /dev/null @@ -1,154 +0,0 @@ -accounts()->with('accounttype')->where( - function (EloquentBuilder $q) use ($words) { - foreach ($words as $word) { - $q->orWhere('name', 'LIKE', '%' . e($word) . '%'); - } - } - )->get(); - } - - /** - * @param array $words - * - * @return Collection - */ - public function searchBudgets(array $words) - { - /** @var Collection $set */ - $set = \Auth::user()->budgets()->get(); - $newSet = $set->filter( - function (\Budget $b) use ($words) { - $found = 0; - foreach ($words as $word) { - if (!(strpos(strtolower($b->name), strtolower($word)) === false)) { - $found++; - } - } - - return $found > 0; - } - ); - - return $newSet; - } - - /** - * @param array $words - * - * @return Collection - */ - public function searchCategories(array $words) - { - /** @var Collection $set */ - $set = \Auth::user()->categories()->get(); - $newSet = $set->filter( - function (\Category $c) use ($words) { - $found = 0; - foreach ($words as $word) { - if (!(strpos(strtolower($c->name), strtolower($word)) === false)) { - $found++; - } - } - - return $found > 0; - } - ); - - return $newSet; - } - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * @param array $words - * - * @return Collection - */ - public function searchTags(array $words) - { - return new Collection; - } - - /** - * @param array $words - * - * @return Collection - */ - public function searchTransactions(array $words) - { - return \Auth::user()->transactionjournals()->withRelevantData()->where( - function (EloquentBuilder $q) use ($words) { - foreach ($words as $word) { - $q->orWhere('description', 'LIKE', '%' . e($word) . '%'); - } - } - )->get(); - } -} diff --git a/app/lib/FireflyIII/Shared/Facade/Amount.php b/app/lib/FireflyIII/Shared/Facade/Amount.php deleted file mode 100644 index 4a3eb4dba4..0000000000 --- a/app/lib/FireflyIII/Shared/Facade/Amount.php +++ /dev/null @@ -1,24 +0,0 @@ -password = $password; - $user->reset = \Str::random(32); // new one. - $user->forceSave(); - $email = $user->email; - - - $data = ['password' => $password]; - try { - \Mail::send( - ['emails.user.register-html', 'emails.user.register-text'], $data, function (Message $message) use ($email) { - - $message->to($email, $email)->subject('Welcome to Firefly!'); - } - ); - } catch (Swift_RfcComplianceException $e) { - } - } - - /** - * @param \User $user - * - * @return mixed|void - */ - public function sendResetVerification(\User $user) - { - $reset = \Str::random(32); - $user->reset = $reset; - $user->forceSave(); - $email = $user->email; - - $data = ['reset' => $reset]; - try { - \Mail::send( - ['emails.user.remindMe-html', 'emails.user.remindMe-text'], $data, function (Message $message) use ($email) { - $message->to($email, $email)->subject('Forgot your password?'); - } - ); - } catch (Swift_RfcComplianceException $e) { - \Log::error($e->getMessage()); - return false; - } catch(Swift_TransportException $e) { - \Log::error($e->getMessage()); - return false; - } catch(\Exception $e) { - \Log::error($e->getMessage()); - return false; - } - return true; - - - } - - /** - * @param \User $user - * - * @return mixed|void - */ - public function sendVerificationMail(\User $user) - { - - $reset = \Str::random(32); - $user->reset = $reset; - $user->forceSave(); - $email = $user->email; - $data = ['reset' => $reset]; - - try { - \Mail::send( - ['emails.user.verify-html', 'emails.user.verify-text'], $data, function (Message $message) use ($email) { - - $message->to($email, $email)->subject('Verify your e-mail address.'); - } - ); - } catch (Swift_RfcComplianceException $e) { - \Log::error($e->getMessage()); - return false; - } catch(Swift_TransportException $e) { - \Log::error($e->getMessage()); - return false; - } catch(\Exception $e) { - \Log::error($e->getMessage()); - return false; - } - return true; - } - -} diff --git a/app/lib/FireflyIII/Shared/Mail/RegistrationInterface.php b/app/lib/FireflyIII/Shared/Mail/RegistrationInterface.php deleted file mode 100644 index df104cc50a..0000000000 --- a/app/lib/FireflyIII/Shared/Mail/RegistrationInterface.php +++ /dev/null @@ -1,34 +0,0 @@ -id)->where('name', $name)->first(); - if (is_null($pref) && is_null($default)) { - // return NULL - return null; - } - if (!is_null($pref)) { - return $pref; - } - - return $this->set($name, $default); - - } - - /** - * @param $name - * @param $value - * - * @return \Preference - */ - public function set($name, $value) - { - $pref = \Preference::where('user_id', \Auth::user()->id)->where('name', $name)->first(); - if (is_null($pref)) { - $pref = new \Preference; - $pref->name = $name; - $pref->user()->associate(\Auth::user()); - - } - $pref->data = $value; - $pref->save(); - - - return $pref; - - } -} diff --git a/app/lib/FireflyIII/Shared/Preferences/PreferencesInterface.php b/app/lib/FireflyIII/Shared/Preferences/PreferencesInterface.php deleted file mode 100644 index 3dd5606235..0000000000 --- a/app/lib/FireflyIII/Shared/Preferences/PreferencesInterface.php +++ /dev/null @@ -1,29 +0,0 @@ -getCurrencySymbol(); - - return $this->formatWithSymbol($currencySymbol, $amount, $coloured); - - - } - - /** - * @return string - */ - public function getCurrencySymbol() - { - if (defined('FFCURRENCYSYMBOL')) { - return FFCURRENCYSYMBOL; - } - if (\Cache::has('FFCURRENCYSYMBOL')) { - define('FFCURRENCYSYMBOL', \Cache::get('FFCURRENCYSYMBOL')); - - return FFCURRENCYSYMBOL; - } - - /** @var \FireflyIII\Database\TransactionCurrency\TransactionCurrency $currencies */ - $currencies = \App::make('FireflyIII\Database\TransactionCurrency\TransactionCurrency'); - - /** @var \FireflyIII\Shared\Preferences\Preferences $preferences */ - $preferences = \App::make('FireflyIII\Shared\Preferences\Preferences'); - - $currencyPreference = $preferences->get('currencyPreference', 'EUR'); - $currency = $currencies->findByCode($currencyPreference->data); - - \Cache::forever('FFCURRENCYSYMBOL', $currency->symbol); - - define('FFCURRENCYSYMBOL', $currency->symbol); - - return $currency->symbol; - } - - /** - * @param string $symbol - * @param float $amount - * @param bool $coloured - * - * @return string - */ - protected function formatWithSymbol($symbol, $amount, $coloured = true) - { - $amount = floatval($amount); - $amount = round($amount, 2); - $string = number_format($amount, 2, ',', '.'); - - if ($coloured === true) { - if ($amount === 0.0) { - return '' . $symbol . ' ' . $string . ''; - } - if ($amount > 0) { - return '' . $symbol . ' ' . $string . ''; - } - - return '' . $symbol . ' ' . $string . ''; - } - - // € - return $symbol . ' ' . $string; - } - - /** - * @param \TransactionJournal $journal - * @param float $amount - * @param bool $coloured - * - * @return string - */ - public function formatJournal(\TransactionJournal $journal, $amount, $coloured = true) - { - $symbol = $journal->transactionCurrency->symbol; - - return $this->formatWithSymbol($symbol, $amount, $coloured); - - - } - - /** - * @param \Transaction $transaction - * @param bool $coloured - * - * @return string - */ - public function formatTransaction(\Transaction $transaction, $coloured = true) - { - $symbol = $transaction->transactionJournal->transactionCurrency->symbol; - $amount = floatval($transaction->amount); - - return $this->formatWithSymbol($symbol, $amount, $coloured); - - - } - - /** - * @return string - */ - public function getCurrencyCode() - { - if (defined('FFCURRENCYCODE')) { - return FFCURRENCYCODE; - } - if (\Cache::has('FFCURRENCYCODE')) { - define('FFCURRENCYCODE', \Cache::get('FFCURRENCYCODE')); - - return FFCURRENCYCODE; - } - - /** @var \FireflyIII\Database\TransactionCurrency\TransactionCurrency $currencies */ - $currencies = \App::make('FireflyIII\Database\TransactionCurrency\TransactionCurrency'); - - /** @var \FireflyIII\Shared\Preferences\Preferences $preferences */ - $preferences = \App::make('FireflyIII\Shared\Preferences\Preferences'); - - $currencyPreference = $preferences->get('currencyPreference', 'EUR'); - $currency = $currencies->findByCode($currencyPreference->data); - - \Cache::forever('FFCURRENCYCODE', $currency->code); - - define('FFCURRENCYCODE', $currency->code); - - return $currency->code; - } - - /** - * @return string - */ - public function getDefaultCurrency() - { - /** @var \FireflyIII\Database\TransactionCurrency\TransactionCurrency $currencies */ - $currencies = \App::make('FireflyIII\Database\TransactionCurrency\TransactionCurrency'); - - /** @var \FireflyIII\Shared\Preferences\Preferences $preferences */ - $preferences = \App::make('FireflyIII\Shared\Preferences\Preferences'); - - $currencyPreference = $preferences->get('currencyPreference', 'EUR'); - $currency = $currencies->findByCode($currencyPreference->data); - - return $currency; - } - -} diff --git a/app/lib/FireflyIII/Shared/Toolkit/Date.php b/app/lib/FireflyIII/Shared/Toolkit/Date.php deleted file mode 100644 index 65d1d49ab9..0000000000 --- a/app/lib/FireflyIII/Shared/Toolkit/Date.php +++ /dev/null @@ -1,258 +0,0 @@ - 'addDays', - 'weekly' => 'addWeeks', - 'week' => 'addWeeks', - 'month' => 'addMonths', - 'monthly' => 'addMonths', - 'quarter' => 'addMonths', - 'quarterly' => 'addMonths', - 'half-year' => 'addMonths', - 'year' => 'addYears', - 'yearly' => 'addYears', - ]; - $modifierMap = [ - 'quarter' => 3, - 'quarterly' => 3, - 'half-year' => 6, - ]; - if (!isset($functionMap[$repeatFreq])) { - throw new FireflyException('Cannot do addPeriod for $repeat_freq "' . $repeatFreq . '"'); - } - if (isset($modifierMap[$repeatFreq])) { - $add = $add * $modifierMap[$repeatFreq]; - } - $function = $functionMap[$repeatFreq]; - $date->$function($add); - - return $date; - } - - /** - * @param Carbon $theCurrentEnd - * @param $repeatFreq - * - * @return Carbon - * @throws FireflyException - */ - public function endOfPeriod(Carbon $theCurrentEnd, $repeatFreq) - { - $currentEnd = clone $theCurrentEnd; - - $functionMap = [ - 'daily' => 'addDay', - 'week' => 'addWeek', - 'weekly' => 'addWeek', - 'month' => 'addMonth', - 'monthly' => 'addMonth', - 'quarter' => 'addMonths', - 'quarterly' => 'addMonths', - 'half-year' => 'addMonths', - 'year' => 'addYear', - 'yearly' => 'addYear', - ]; - $modifierMap = [ - 'quarter' => 3, - 'quarterly' => 3, - 'half-year' => 6, - ]; - - $subDay = ['week', 'weekly', 'month', 'monthly', 'quarter', 'quarterly', 'half-year', 'year', 'yearly']; - - if (!isset($functionMap[$repeatFreq])) { - throw new FireflyException('Cannot do endOfPeriod for $repeat_freq ' . $repeatFreq); - } - $function = $functionMap[$repeatFreq]; - if (isset($modifierMap[$repeatFreq])) { - $currentEnd->$function($modifierMap[$repeatFreq]); - } else { - $currentEnd->$function(); - } - if (in_array($repeatFreq, $subDay)) { - $currentEnd->subDay(); - } - - return $currentEnd; - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - * - * @param Carbon $theCurrentEnd - * @param $repeatFreq - * @param Carbon $maxDate - * - * @return Carbon - * @throws FireflyException - */ - public function endOfX(Carbon $theCurrentEnd, $repeatFreq, Carbon $maxDate) - { - $functionMap = [ - 'daily' => 'endOfDay', - 'week' => 'endOfWeek', - 'weekly' => 'endOfWeek', - 'month' => 'endOfMonth', - 'monthly' => 'endOfMonth', - 'quarter' => 'lastOfQuarter', - 'quarterly' => 'lastOfQuarter', - 'year' => 'endOfYear', - 'yearly' => 'endOfYear', - ]; - $specials = ['mont', 'monthly']; - - $currentEnd = clone $theCurrentEnd; - - if (isset($functionMap[$repeatFreq])) { - $function = $functionMap[$repeatFreq]; - $currentEnd->$function(); - - } - if (isset($specials[$repeatFreq])) { - $month = intval($theCurrentEnd->format('m')); - $currentEnd->endOfYear(); - if ($month <= 6) { - $currentEnd->subMonths(6); - } - } - if ($currentEnd > $maxDate) { - return clone $maxDate; - } - - return $currentEnd; - } - - /** - * @param Carbon $date - * @param $repeatFrequency - * - * @return string - * @throws FireflyException - */ - public function periodShow(Carbon $date, $repeatFrequency) - { - $formatMap = [ - 'daily' => 'j F Y', - 'week' => '\W\e\e\k W, Y', - 'weekly' => '\W\e\e\k W, Y', - 'quarter' => 'F Y', - 'month' => 'F Y', - 'monthly' => 'F Y', - 'year' => 'Y', - 'yearly' => 'Y', - - ]; - if (isset($formatMap[$repeatFrequency])) { - return $date->format($formatMap[$repeatFrequency]); - } - throw new FireflyException('No date formats for frequency "' . $repeatFrequency . '"!'); - } - - /** - * @param Carbon $theDate - * @param $repeatFreq - * - * @return Carbon - * @throws FireflyException - */ - public function startOfPeriod(Carbon $theDate, $repeatFreq) - { - $date = clone $theDate; - - $functionMap = [ - 'daily' => 'startOfDay', - 'week' => 'startOfWeek', - 'weekly' => 'startOfWeek', - 'month' => 'startOfMonth', - 'monthly' => 'startOfMonth', - 'quarter' => 'firstOfQuarter', - 'quartly' => 'firstOfQuarter', - 'year' => 'startOfYear', - 'yearly' => 'startOfYear', - ]; - if (isset($functionMap[$repeatFreq])) { - $function = $functionMap[$repeatFreq]; - $date->$function(); - - return $date; - } - if ($repeatFreq == 'half-year') { - $month = intval($date->format('m')); - $date->startOfYear(); - if ($month >= 7) { - $date->addMonths(6); - } - - return $date; - } - throw new FireflyException('Cannot do startOfPeriod for $repeat_freq ' . $repeatFreq); - } - - /** - * @param Carbon $theDate - * @param $repeatFreq - * @param int $subtract - * - * @return Carbon - * @throws FireflyException - */ - public function subtractPeriod(Carbon $theDate, $repeatFreq, $subtract = 1) - { - $date = clone $theDate; - - $functionMap = [ - 'daily' => 'subDays', - 'week' => 'subWeeks', - 'weekly' => 'subWeeks', - 'month' => 'subMonths', - 'monthly' => 'subMonths', - 'year' => 'subYears', - 'yearly' => 'subYears', - ]; - $modifierMap = [ - 'quarter' => 3, - 'quarterly' => 3, - 'half-year' => 6, - ]; - if (isset($functionMap[$repeatFreq])) { - $function = $functionMap[$repeatFreq]; - $date->$function($subtract); - - return $date; - } - if (isset($modifierMap[$repeatFreq])) { - $subtract = $subtract * $modifierMap[$repeatFreq]; - $date->subMonths($subtract); - - return $date; - } - - throw new FireflyException('Cannot do subtractPeriod for $repeat_freq ' . $repeatFreq); - } -} - diff --git a/app/lib/FireflyIII/Shared/Toolkit/Filter.php b/app/lib/FireflyIII/Shared/Toolkit/Filter.php deleted file mode 100644 index 0602b72624..0000000000 --- a/app/lib/FireflyIII/Shared/Toolkit/Filter.php +++ /dev/null @@ -1,253 +0,0 @@ -setSessionRangeValue(); - $start = \Session::has('start') ? \Session::get('start') : new Carbon; - $start = $this->updateStartDate($range, $start); - $end = $this->updateEndDate($range, $start); - $period = $this->periodName($range, $start); - $prev = $this->previous($range, clone $start); - $next = $this->next($range, clone $start); - - \Session::put('start', $start); - \Session::put('end', $end); - \Session::put('range', $range); - \Session::put('period', $period); - \Session::put('prev', $this->periodName($range, $prev)); - \Session::put('next', $this->periodName($range, $next)); - - return null; - - } - - /** - * Checks and sets the currently set 'range' or defaults to a session - * and if that fails, defaults to 1M. Always returns the final value. - * - * @return string - */ - public function setSessionRangeValue() - { - if (!is_null(\Session::get('range'))) { - // @codeCoverageIgnoreStart - $range = \Session::get('range'); - // @codeCoverageIgnoreEnd - } else { - /** @var \FireflyIII\Shared\Preferences\PreferencesInterface $preferences */ - $preferences = \App::make('FireflyIII\Shared\Preferences\PreferencesInterface'); - $viewRange = $preferences->get('viewRange', '1M'); - - // default range: - $range = $viewRange->data; - \Session::put('range', $range); - } - - return $range; - - } - - /** - * @param $range - * @param Carbon $start - * - * @return Carbon - * @throws FireflyException - * @codeCoverageIgnore - */ - protected function updateStartDate($range, Carbon $start) - { - $functionMap = [ - '1D' => 'startOfDay', - '1W' => 'startOfWeek', - '1M' => 'startOfMonth', - '3M' => 'firstOfQuarter', - '1Y' => 'startOfYear', - ]; - if (isset($functionMap[$range])) { - $function = $functionMap[$range]; - $start->$function(); - - return $start; - } - if ($range == '6M') { - if (intval($start->format('m')) >= 7) { - $start->startOfYear()->addMonths(6); - } else { - $start->startOfYear(); - } - - return $start; - } - throw new FireflyException('updateStartDate cannot handle $range ' . $range); - } - - /** - * @param $range - * @param Carbon $start - * - * @return Carbon - * @throws FireflyException - * @codeCoverageIgnore - */ - protected function updateEndDate($range, Carbon $start) - { - $functionMap = [ - '1D' => 'endOfDay', - '1W' => 'endOfWeek', - '1M' => 'endOfMonth', - '3M' => 'lastOfQuarter', - '1Y' => 'endOfYear', - ]; - $end = clone $start; - - if (isset($functionMap[$range])) { - $function = $functionMap[$range]; - $end->$function(); - - return $end; - } - if ($range == '6M') { - if (intval($start->format('m')) >= 7) { - $end->endOfYear(); - } else { - $end->startOfYear()->addMonths(6); - } - - return $end; - } - throw new FireflyException('updateEndDate cannot handle $range ' . $range); - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - * - * @param $range - * @param Carbon $date - * - * @return string - * @throws FireflyException - * @codeCoverageIgnore - */ - protected function periodName($range, Carbon $date) - { - $formatMap = [ - '1D' => 'jS F Y', - '1W' => '\w\e\ek W, Y', - '1M' => 'F Y', - '1Y' => 'Y', - ]; - if (isset($formatMap[$range])) { - return $date->format($formatMap[$range]); - } - if ($range == '3M') { - $month = intval($date->format('m')); - - return 'Q' . ceil(($month / 12) * 4) . ' ' . $date->format('Y'); - } - if ($range == '6M') { - $month = intval($date->format('m')); - $half = ceil(($month / 12) * 2); - $halfName = $half == 1 ? 'first' : 'second'; - - return $halfName . ' half of ' . $date->format('d-m-Y'); - } - throw new FireflyException('No _periodName() for range "' . $range . '"'); - } - - /** - * @param $range - * @param Carbon $date - * - * @return Carbon - * @throws FireflyException - */ - public function previous($range, Carbon $date) - { - $functionMap = [ - '1D' => 'Day', - '1W' => 'Week', - '1M' => 'Month', - '1Y' => 'Year' - ]; - - if (isset($functionMap[$range])) { - $startFunction = 'startOf' . $functionMap[$range]; - $subFunction = 'sub' . $functionMap[$range]; - $date->$startFunction()->$subFunction(); - - return $date; - } - if ($range == '3M') { - $date->firstOfQuarter()->subMonths(3)->firstOfQuarter(); - - return $date; - } - if ($range == '6M') { - $month = intval($date->format('m')); - $date->startOfYear(); - if ($month <= 6) { - $date->subMonths(6); - } - - return $date; - } - throw new FireflyException('Cannot do _previous() on ' . $range); - } - - /** - * @param $range - * @param Carbon $date - * - * @return Carbon - * @throws FireflyException - */ - public function next($range, Carbon $date) - { - switch ($range) { - case '1D': - $date->endOfDay()->addDay(); - break; - case '1W': - $date->endOfWeek()->addDay()->startOfWeek(); - break; - case '1M': - $date->endOfMonth()->addDay()->startOfMonth(); - break; - case '3M': - $date->lastOfQuarter()->addDay(); - break; - case '6M': - if (intval($date->format('m')) >= 7) { - $date->startOfYear()->addYear(); - } else { - $date->startOfYear()->addMonths(6); - } - break; - case '1Y': - $date->startOfYear()->addYear(); - break; - default: - throw new FireflyException('Cannot do _next() on ' . $range); - break; - } - - return $date; - } -} diff --git a/app/lib/FireflyIII/Shared/Toolkit/Form.php b/app/lib/FireflyIII/Shared/Toolkit/Form.php deleted file mode 100644 index 1f51fe357a..0000000000 --- a/app/lib/FireflyIII/Shared/Toolkit/Form.php +++ /dev/null @@ -1,47 +0,0 @@ -id); - $title = null; - - foreach ($fields as $field) { - if (isset($entry->$field)) { - $title = $entry->$field; - } - } - $selectList[$id] = $title; - } - - - return $selectList; - } -} diff --git a/app/lib/FireflyIII/Shared/Toolkit/Navigation.php b/app/lib/FireflyIII/Shared/Toolkit/Navigation.php deleted file mode 100644 index ce99351190..0000000000 --- a/app/lib/FireflyIII/Shared/Toolkit/Navigation.php +++ /dev/null @@ -1,69 +0,0 @@ -setSessionRangeValue(); - $start = \Session::get('start', Carbon::now()->startOfMonth()); - - /* - * Add some period to $start. - */ - $next = $filter->next($range, clone $start); - - /* - * Save in session: - */ - \Session::put('start', $next); - - return true; - } - - /** - * @return bool - * @throws FireflyException - */ - public function prev() - { - /* - * Get the start date and the range from the session - */ - $filter = new Filter; - - $range = $filter->setSessionRangeValue(); - $start = \Session::get('start', Carbon::now()->startOfMonth()); - - /* - * Subtract some period to $start. - */ - $prev = $filter->previous($range, clone $start); - - /* - * Save in session: - */ - \Session::put('start', $prev); - - return true; - } -} diff --git a/app/lib/FireflyIII/Shared/Toolkit/Reminders.php b/app/lib/FireflyIII/Shared/Toolkit/Reminders.php deleted file mode 100644 index 11b75259e1..0000000000 --- a/app/lib/FireflyIII/Shared/Toolkit/Reminders.php +++ /dev/null @@ -1,106 +0,0 @@ -remindersable)) { - - case 'PiggyBank': - $start = new Carbon; - $end = !is_null($reminder->remindersable->targetdate) ? clone $reminder->remindersable->targetdate : new Carbon; - $reminders = 0; - while ($start <= $end) { - $reminders++; - $start = \DateKit::addPeriod($start, $reminder->remindersable->reminder, $reminder->remindersable->reminder_skip); - } - /* - * Now find amount yet to save. - */ - $repetition = $reminder->remindersable->currentRelevantRep(); - $leftToSave = floatval($reminder->remindersable->targetamount) - floatval($repetition->currentamount); - $reminders = $reminders == 0 ? 1 : $reminders; - - return $leftToSave / $reminders; - break; - default: - throw new FireflyException('Cannot handle class ' . get_class($reminder->remindersable) . ' in amountForReminder.'); - break; - } - } - - /** - * - */ - public function getReminders() - { - $reminders = \Auth::user()->reminders() - ->where('active', 1) - ->where('startdate', '<=', Carbon::now()->format('Y-m-d')) - ->where('enddate', '>=', Carbon::now()->format('Y-m-d')) - ->get(); - - return $reminders; - } - - /** - * @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. - */ - public function updateReminders() - { - /** @var Collection $set */ - $set = \PiggyBank::leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id') - ->where('accounts.user_id', \Auth::user()->id) - ->whereNotNull('reminder')->get(['piggy_banks.*']); - - - $today = Carbon::now(); - - /** @var \PiggyBank $piggyBank */ - foreach ($set as $piggyBank) { - /** @var \PiggyBankRepetition $repetition */ - $repetition = $piggyBank->currentRelevantRep(); - $start = \DateKit::startOfPeriod($today, $piggyBank->reminder); - if ($repetition->targetdate && $repetition->targetdate <= $today) { - // break when no longer relevant: - continue; - } - $end = \DateKit::endOfPeriod(clone $start, $piggyBank->reminder); - // should have a reminder for this period: - /** @var Collection $reminders */ - $reminders = $piggyBank->reminders()->dateIs($start, $end)->get(); - if ($reminders->count() == 0) { - // create new! - $reminder = new \Reminder; - $reminder->startdate = $start; - $reminder->enddate = $end; - $reminder->active = 1; - $reminder->user()->associate(\Auth::getUser()); - $reminder->remindersable_id = $piggyBank->id; - $reminder->remindersable_type = 'PiggyBank'; - $reminder->save(); - } - } - } -} diff --git a/app/lib/FireflyIII/Shared/Toolkit/Steam.php b/app/lib/FireflyIII/Shared/Toolkit/Steam.php deleted file mode 100644 index 584fa13ee8..0000000000 --- a/app/lib/FireflyIII/Shared/Toolkit/Steam.php +++ /dev/null @@ -1,85 +0,0 @@ -transactions()->leftJoin( - 'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id' - )->where('transaction_journals.date', '<=', $date->format('Y-m-d'))->sum('transactions.amount') - ); - - return $balance; - } - - /** - * @codeCoverageIgnore - * @param $boolean - * - * @return string - */ - public function boolString($boolean) - { - if ($boolean === true) { - return 'BOOLEAN TRUE'; - } - if ($boolean === false) { - return 'BOOLEAN FALSE'; - } - - return 'NO BOOLEAN: ' . $boolean; - } - - /** - * @param \PiggyBank $piggyBank - * @param \PiggyBankRepetition $repetition - * - * @return int - */ - public function percentage(\PiggyBank $piggyBank, \PiggyBankRepetition $repetition) - { - $pct = $repetition->currentamount / $piggyBank->targetamount * 100; - if ($pct > 100) { - // @codeCoverageIgnoreStart - return 100; - // @codeCoverageIgnoreEnd - } else { - return floor($pct); - } - } - - /** - * @codeCoverageIgnore - * @throws \Exception - */ - public function removeEmptyBudgetLimits() - { - $user = \Auth::user(); - if ($user) { - \BudgetLimit::where('amount', 0)->delete(); - } - } - -} diff --git a/app/lib/FireflyIII/Shared/Validation/FireflyValidator.php b/app/lib/FireflyIII/Shared/Validation/FireflyValidator.php deleted file mode 100644 index 33795d563b..0000000000 --- a/app/lib/FireflyIII/Shared/Validation/FireflyValidator.php +++ /dev/null @@ -1,31 +0,0 @@ -app->validator->resolver( - function ($translator, $data, $rules, $messages) { - return new FireflyValidator($translator, $data, $rules, $messages); - } - ); - } - - public function register() - { - } -} diff --git a/app/models/Account.php b/app/models/Account.php deleted file mode 100644 index 9bf3bbe4a9..0000000000 --- a/app/models/Account.php +++ /dev/null @@ -1,156 +0,0 @@ - [ - 'name' => 'required|between:1,100', - 'user_id' => 'required|exists:users,id', - 'account_type_id' => 'required|exists:account_types,id', - 'active' => 'required|boolean' - ], - 'form_input' => [ - 'name' => 'required|between:1,100', - 'active' => 'required|boolean', - ] - ]; - - /** - * Account type. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function accountType() - { - return $this->belongsTo('AccountType'); - } - - /** - * - * @param $fieldName - * - * @return mixed - */ - public function getMeta($fieldName) - { - foreach ($this->accountMeta as $meta) { - if ($meta->name == $fieldName) { - return $meta->data; - } - } - - return null; - - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function piggyBanks() - { - return $this->hasMany('PiggyBank'); - } - - /** - * - * @param EloquentBuilder $query - * @param array $types - */ - public function scopeAccountTypeIn(EloquentBuilder $query, array $types) - { - if (is_null($this->joinedAccountTypes)) { - $query->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id'); - $this->joinedAccountTypes = true; - } - $query->whereIn('account_types.type', $types); - } - - /** - * - * @param EloquentBuilder $query - * @param string $field - */ - public function scopeWithMeta(EloquentBuilder $query, $field = 'accountRole') - { - $query->leftJoin( - 'account_meta', function (JoinClause $join) use ($field) { - $join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', $field); - } - ); - } - - /** - * Transactions. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function transactions() - { - return $this->hasMany('Transaction'); - } - - /** - * @param $fieldName - * @param $fieldValue - * - * @return AccountMeta - */ - public function updateMeta($fieldName, $fieldValue) - { - $meta = $this->accountMeta()->get(); - /** @var AccountMeta $entry */ - foreach ($meta as $entry) { - if ($entry->name == $fieldName) { - $entry->data = $fieldValue; - $entry->save(); - - return $entry; - } - } - $meta = new AccountMeta; - $meta->account()->associate($this); - $meta->name = $fieldName; - $meta->data = $fieldValue; - $meta->save(); - - return $meta; - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function accountMeta() - { - return $this->hasMany('AccountMeta'); - } - - /** - * User - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function user() - { - return $this->belongsTo('User'); - } - - -} diff --git a/app/models/AccountMeta.php b/app/models/AccountMeta.php deleted file mode 100644 index 5a481a2c90..0000000000 --- a/app/models/AccountMeta.php +++ /dev/null @@ -1,51 +0,0 @@ - 'numeric|required|exists:accounts,id', - 'name' => 'required|between:1,250', - 'data' => 'required' - ]; - /** - * @var array - */ - protected $fillable = ['account_id', 'name', 'date']; - protected $table = 'account_meta'; - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function account() - { - return $this->belongsTo('Account'); - } - - /** - * @param $value - * - * @return mixed - */ - public function getDataAttribute($value) - { - return json_decode($value); - } - - /** - * @param $value - */ - public function setDataAttribute($value) - { - $this->attributes['data'] = json_encode($value); - } - -} diff --git a/app/models/AccountType.php b/app/models/AccountType.php deleted file mode 100644 index eb3f495e87..0000000000 --- a/app/models/AccountType.php +++ /dev/null @@ -1,25 +0,0 @@ - ['required', 'between:1,50', 'alphabasic'], - 'editable' => 'required|boolean', - - ]; - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function accounts() - { - return $this->hasMany('Account'); - } -} diff --git a/app/models/Bill.php b/app/models/Bill.php deleted file mode 100644 index bc5500ebe2..0000000000 --- a/app/models/Bill.php +++ /dev/null @@ -1,49 +0,0 @@ - 'required|exists:users,id', - 'name' => 'required|between:1,255|min:1', - 'match' => 'required', - 'amount_max' => 'required|between:0,65536', - 'amount_min' => 'required|between:0,65536', - 'date' => 'required|date', - 'active' => 'between:0,1', - 'automatch' => 'between:0,1', - 'repeat_freq' => 'required|in:daily,weekly,monthly,quarterly,half-year,yearly', - 'skip' => 'required|between:0,31',]; - protected $fillable = ['user_id', 'name', 'match', 'amount_min', 'amount_max', 'date', 'repeat_freq', 'skip', 'active', 'automatch']; - /** - * @return array - */ - public function getDates() - { - return ['created_at', 'updated_at', 'date']; - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function transactionjournals() - { - return $this->hasMany('TransactionJournal'); - } - - - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function user() - { - return $this->belongsTo('User'); - } -} diff --git a/app/models/Budget.php b/app/models/Budget.php deleted file mode 100644 index 83368d9143..0000000000 --- a/app/models/Budget.php +++ /dev/null @@ -1,50 +0,0 @@ - 'exists:users,id|required', - 'name' => 'required|between:1,100|alphabasic', - ]; - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough - */ - public function limitrepetitions() - { - return $this->hasManyThrough('LimitRepetition', 'BudgetLimit', 'budget_id'); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function budgetlimits() - { - return $this->hasMany('BudgetLimit'); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany - */ - public function transactionjournals() - { - return $this->belongsToMany('TransactionJournal', 'budget_transaction_journal', 'budget_id'); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function user() - { - return $this->belongsTo('User'); - } - -} diff --git a/app/models/BudgetLimit.php b/app/models/BudgetLimit.php deleted file mode 100644 index 192639fda8..0000000000 --- a/app/models/BudgetLimit.php +++ /dev/null @@ -1,49 +0,0 @@ - 'required|exists:budgets,id', - 'startdate' => 'required|date', - 'amount' => 'numeric|required|min:0.01', - 'repeats' => 'required|boolean', - 'repeat_freq' => 'required|in:daily,weekly,monthly,quarterly,half-year,yearly' - - ]; - - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function budget() - { - return $this->belongsTo('Budget'); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function limitrepetitions() - { - return $this->hasMany('LimitRepetition'); - } - - - /** - * @return array - */ - public function getDates() - { - return ['created_at', 'updated_at', 'startdate', 'enddate']; - } - - -} diff --git a/app/models/Category.php b/app/models/Category.php deleted file mode 100644 index dab2639a0b..0000000000 --- a/app/models/Category.php +++ /dev/null @@ -1,49 +0,0 @@ - 'exists:users,id|required', - 'name' => 'required|between:1,100|alphabasic', - ]; - - /** - * remove this method in favour of something in the FireflyIII libraries. - * - * @return Carbon - */ - public function lastActionDate() - { - $transaction = $this->transactionjournals()->orderBy('updated_at', 'DESC')->first(); - if (is_null($transaction)) { - return null; - } - - return $transaction->date; - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany - */ - public function transactionjournals() - { - return $this->belongsToMany('TransactionJournal', 'category_transaction_journal', 'category_id'); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function user() - { - return $this->belongsTo('User'); - } -} diff --git a/app/models/Component.php b/app/models/Component.php deleted file mode 100644 index e09edbe19b..0000000000 --- a/app/models/Component.php +++ /dev/null @@ -1,20 +0,0 @@ - 'exists:users,id|required', - 'name' => 'required|between:1,100|alphabasic', - 'class' => 'required', - ]; - protected $dates = ['deleted_at', 'created_at', 'updated_at']; - protected $fillable = ['name', 'user_id','class']; - protected $table = 'components'; - use ValidatingTrait; -} diff --git a/app/models/LimitRepetition.php b/app/models/LimitRepetition.php deleted file mode 100644 index afb0b3c439..0000000000 --- a/app/models/LimitRepetition.php +++ /dev/null @@ -1,54 +0,0 @@ - 'required|exists:budgetlimits,id', - 'startdate' => 'required|date', - 'enddate' => 'required|date', - 'amount' => 'numeric|required|min:0.01', - ]; - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function budgetLimit() - { - return $this->belongsTo('BudgetLimit'); - } - - /** - * @return array - */ - public function getDates() - { - return ['created_at', 'updated_at', 'startdate', 'enddate']; - } - - /** - * - * @return float - */ - public function spentInRepetition() - { - $sum = \DB::table('transactions') - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') - ->leftJoin('budget_limits', 'budget_limits.budget_id', '=', 'budget_transaction_journal.budget_id') - ->leftJoin('limit_repetitions', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id') - ->where('transaction_journals.date', '>=', $this->startdate->format('Y-m-d')) - ->where('transaction_journals.date', '<=', $this->enddate->format('Y-m-d')) - ->where('transactions.amount', '>', 0) - ->where('limit_repetitions.id', '=', $this->id) - ->sum('transactions.amount'); - - return floatval($sum); - } -} diff --git a/app/models/Piggybank.php b/app/models/Piggybank.php deleted file mode 100644 index 49e7563445..0000000000 --- a/app/models/Piggybank.php +++ /dev/null @@ -1,127 +0,0 @@ - 'required|exists:accounts,id', // link to Account - 'name' => 'required|between:1,255', // name - 'targetamount' => 'required|min:0.01|numeric', // amount you want to save - 'startdate' => 'date', // when you started - 'targetdate' => 'date', // when its due - 'repeats' => 'required|boolean', // does it repeat? - 'rep_length' => 'in:day,week,month,quarter,year', // how long is the period? - 'rep_every' => 'required|min:1|max:100', // how often does it repeat? every 3 years. - 'rep_times' => 'min:1|max:100', // how many times do you want to save this amount? eg. 3 times - 'reminder' => 'in:day,week,quarter,month,year', // want a reminder to put money in this? - 'reminder_skip' => 'required|min:0|max:100', // every week? every 2 months? - 'remind_me' => 'required|boolean', 'order' => 'required:min:1', // not yet used. - ]; - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function account() - { - return $this->belongsTo('Account'); - } - - /** - * Grabs the PiggyBankRepetition that's currently relevant / active - * - * @returns \PiggyBankRepetition - */ - public function currentRelevantRep() - { - if ($this->currentRep) { - return $this->currentRep; - } - if ($this->repeats == 0) { - $rep = $this->piggyBankRepetitions()->first(['piggy_bank_repetitions.*']); - $this->currentRep = $rep; - - return $rep; - } else { - $query = $this->piggyBankRepetitions()->where( - function (EloquentBuilder $q) { - - $q->where( - function (EloquentBuilder $q) { - - $q->where( - function (EloquentBuilder $q) { - $today = new Carbon; - $q->whereNull('startdate'); - $q->orWhere('startdate', '<=', $today->format('Y-m-d 00:00:00')); - } - )->where( - function (EloquentBuilder $q) { - $today = new Carbon; - $q->whereNull('targetdate'); - $q->orWhere('targetdate', '>=', $today->format('Y-m-d 00:00:00')); - } - ); - } - )->orWhere( - function (EloquentBuilder $q) { - $today = new Carbon; - $q->where('startdate', '>=', $today->format('Y-m-d 00:00:00')); - $q->where('targetdate', '>=', $today->format('Y-m-d 00:00:00')); - } - ); - - } - )->orderBy('startdate', 'ASC'); - $result = $query->first(['piggy_bank_repetitions.*']); - $this->currentRep = $result; - \Log::debug('Found relevant rep in currentRelevantRep(): ' . $result->id); - - return $result; - } - - - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function piggyBankRepetitions() - { - return $this->hasMany('PiggyBankRepetition'); - } - - /** - * @return array - */ - public function getDates() - { - return ['created_at', 'updated_at', 'targetdate', 'startdate']; - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function piggyBankEvents() - { - return $this->hasMany('PiggyBankEvent'); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\MorphMany - */ - public function reminders() - { - return $this->morphMany('Reminder', 'remindersable'); - } -} diff --git a/app/models/PiggybankEvent.php b/app/models/PiggybankEvent.php deleted file mode 100644 index 1861c45319..0000000000 --- a/app/models/PiggybankEvent.php +++ /dev/null @@ -1,42 +0,0 @@ - 'required|exists:piggy_banks,id', - 'date' => 'required|date', - 'amount' => 'required|numeric' - ]; - use ValidatingTrait; - - /** - * @return array - */ - public function getDates() - { - return ['created_at', 'updated_at', 'date']; - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function piggyBank() - { - return $this->belongsTo('PiggyBank'); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function transactionJournal() - { - return $this->belongsTo('TransactionJournal'); - } - -} diff --git a/app/models/PiggybankRepetition.php b/app/models/PiggybankRepetition.php deleted file mode 100644 index e38eabd4b4..0000000000 --- a/app/models/PiggybankRepetition.php +++ /dev/null @@ -1,54 +0,0 @@ - 'required|exists:piggy_banks,id', - 'targetdate' => 'date', - 'startdate' => 'date', - 'currentamount' => 'required|numeric']; - - /** - * @return array - */ - public function getDates() - { - return ['created_at', 'updated_at', 'targetdate', 'startdate']; - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function piggyBank() - { - return $this->belongsTo('PiggyBank'); - } - - /** - * @param EloquentBuilder $query - * @param Carbon $date - */ - public function scopeStarts(EloquentBuilder $query, Carbon $date) - { - $query->where('startdate', $date->format('Y-m-d 00:00:00')); - } - - /** - * @param EloquentBuilder $query - * @param Carbon $date - */ - public function scopeTargets(EloquentBuilder $query, Carbon $date) - { - $query->where('targetdate', $date->format('Y-m-d 00:00:00')); - } - - -} diff --git a/app/models/Preference.php b/app/models/Preference.php deleted file mode 100644 index b3e12a7ec6..0000000000 --- a/app/models/Preference.php +++ /dev/null @@ -1,41 +0,0 @@ - 'required|exists:users,id', 'name' => 'required|between:1,255', 'data' => 'required']; - - /** - * @param $value - * - * @return mixed - */ - public function getDataAttribute($value) - { - return json_decode($value); - } - - /** - * @param $value - */ - public function setDataAttribute($value) - { - $this->attributes['data'] = json_encode($value); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function user() - { - return $this->belongsTo('User'); - } - -} diff --git a/app/models/Reminder.php b/app/models/Reminder.php deleted file mode 100644 index b9c7b326b8..0000000000 --- a/app/models/Reminder.php +++ /dev/null @@ -1,58 +0,0 @@ -morphTo(); - } - - /** - * @param EloquentBuilder $query - * @param Carbon $start - * @param Carbon $end - * - * @return mixed - */ - public function scopeDateIs(EloquentBuilder $query, Carbon $start, Carbon $end) - { - return $query->where('startdate', $start->format('Y-m-d 00:00:00'))->where('enddate', $end->format('Y-m-d 00:00:00')); - } - - /** - * User - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function user() - { - return $this->belongsTo('User'); - } - - -} diff --git a/app/models/Transaction.php b/app/models/Transaction.php deleted file mode 100644 index bb5c423bec..0000000000 --- a/app/models/Transaction.php +++ /dev/null @@ -1,114 +0,0 @@ - 'numeric|required|exists:accounts,id', - 'transaction_journal_id' => 'numeric|required|exists:transaction_journals,id', - 'description' => 'between:1,255', - 'amount' => 'required|between:-65536,65536|not_in:0,0.00',]; - - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function account() - { - return $this->belongsTo('Account'); - } - - /** - * @param EloquentBuilder $query - * @param Account $account - */ - public function scopeAccountIs(EloquentBuilder $query, Account $account) - { - $query->where('transactions.account_id', $account->id); - } - - /** - * @param EloquentBuilder $query - * @param Carbon $date - */ - public function scopeAfter(EloquentBuilder $query, Carbon $date) - { - if (is_null($this->joinedJournals)) { - $query->leftJoin( - 'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id' - ); - $this->joinedJournals = true; - } - $query->where('transaction_journals.date', '>=', $date->format('Y-m-d')); - } - - /** - * @param EloquentBuilder $query - * @param Carbon $date - */ - public function scopeBefore(EloquentBuilder $query, Carbon $date) - { - if (is_null($this->joinedJournals)) { - $query->leftJoin( - 'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id' - ); - $this->joinedJournals = true; - } - $query->where('transaction_journals.date', '<=', $date->format('Y-m-d')); - } - - /** - * @param EloquentBuilder $query - * @param $amount - */ - public function scopeLessThan(EloquentBuilder $query, $amount) - { - $query->where('amount', '<', $amount); - } - - /** - * @param EloquentBuilder $query - * @param $amount - */ - public function scopeMoreThan(EloquentBuilder $query, $amount) - { - $query->where('amount', '>', $amount); - } - - /** - * @param EloquentBuilder $query - * @param array $types - */ - public function scopeTransactionTypes(EloquentBuilder $query, array $types) - { - if (is_null($this->joinedJournals)) { - $query->leftJoin( - 'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id' - ); - $this->joinedJournals = true; - } - if (is_null($this->joinedTransactionTypes)) { - $query->leftJoin( - 'transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id' - ); - $this->joinedTransactionTypes = true; - } - $query->whereIn('transaction_types.type', $types); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function transactionJournal() - { - return $this->belongsTo('TransactionJournal'); - } -} diff --git a/app/models/TransactionCurrency.php b/app/models/TransactionCurrency.php deleted file mode 100644 index a72d8168df..0000000000 --- a/app/models/TransactionCurrency.php +++ /dev/null @@ -1,29 +0,0 @@ - 'required|alpha|between:3,3|min:3|max:3', - 'name' => 'required|between:3,48|min:3|max:48', - 'symbol' => 'required|between:1,8|min:1|max:8', - ]; - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function transactionJournals() - { - return $this->hasMany('TransactionJournal'); - } - -} diff --git a/app/models/TransactionGroup.php b/app/models/TransactionGroup.php deleted file mode 100644 index dea100af17..0000000000 --- a/app/models/TransactionGroup.php +++ /dev/null @@ -1,45 +0,0 @@ - 'required|in:balance' - ]; - - /** - * @return array - */ - public function getDates() - { - return ['created_at', 'updated_at']; - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function transactionjournals() - { - return $this->belongsToMany('TransactionJournal'); - } - - /** - * User - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function user() - { - return $this->belongsTo('User'); - } - - -} diff --git a/app/models/TransactionJournal.php b/app/models/TransactionJournal.php deleted file mode 100644 index da22e42fe9..0000000000 --- a/app/models/TransactionJournal.php +++ /dev/null @@ -1,267 +0,0 @@ - 'required|exists:transaction_types,id', - 'transaction_currency_id' => 'required|exists:transaction_currencies,id', - 'description' => 'required|between:1,1024', - 'date' => 'required|date', - 'completed' => 'required|between:0,1']; - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function bill() - { - return $this->belongsTo('Bill'); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany - */ - public function budgets() - { - return $this->belongsToMany( - 'Budget' - ); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany - */ - public function categories() - { - return $this->belongsToMany( - 'Category' - ); - } - - /** - * @param Account $account - * - * @return float - */ - public function getAmount(\Account $account = null) - { - $amount = 0; - foreach ($this->transactions as $t) { - if (!is_null($account) && $account->id == $t->account_id) { - $amount = floatval($t->amount); - break; - } - if (floatval($t->amount) > 0) { - $amount = floatval($t->amount); - break; - } - } - - return $amount; - } - - /** - * @return array - */ - public function getDates() - { - return ['created_at', 'updated_at', 'date']; - } - - /** - * @param $value - * - * @return string - */ - public function getDescriptionAttribute($value) - { - if ($this->encrypted) { - return Crypt::decrypt($value); - } - // @codeCoverageIgnoreStart - return $value; - // @codeCoverageIgnoreEnd - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function piggyBankEvents() - { - return $this->hasMany('PiggyBankEvent'); - } - - /** - * @param EloquentBuilder $query - * @param Account $account - */ - public function scopeAccountIs(EloquentBuilder $query, \Account $account) - { - if (!isset($this->joinedTransactions)) { - $query->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id'); - $this->joinedTransactions = true; - } - $query->where('transactions.account_id', $account->id); - } - - /** - * @param EloquentBuilder $query - * @param Carbon $date - * - * @return mixed - */ - public function scopeAfter(EloquentBuilder $query, Carbon $date) - { - return $query->where('transaction_journals.date', '>=', $date->format('Y-m-d 00:00:00')); - } - - /** - * @param EloquentBuilder $query - * @param Carbon $date - * - * @return mixed - */ - public function scopeBefore(EloquentBuilder $query, Carbon $date) - { - return $query->where('transaction_journals.date', '<=', $date->format('Y-m-d 00:00:00')); - } - - /** - * @param EloquentBuilder $query - * @param $amount - */ - public function scopeLessThan(EloquentBuilder $query, $amount) - { - if (is_null($this->joinedTransactions)) { - $query->leftJoin( - 'transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id' - ); - $this->joinedTransactions = true; - } - - $query->where('transactions.amount', '<=', $amount); - } - - /** - * @param EloquentBuilder $query - * @param $amount - */ - public function scopeMoreThan(EloquentBuilder $query, $amount) - { - if (is_null($this->joinedTransactions)) { - $query->leftJoin( - 'transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id' - ); - $this->joinedTransactions = true; - } - - $query->where('transactions.amount', '>=', $amount); - } - - /** - * @param EloquentBuilder $query - * @param Carbon $date - * - * @return mixed - */ - public function scopeOnDate(EloquentBuilder $query, Carbon $date) - { - return $query->where('date', '=', $date->format('Y-m-d')); - } - - /** - * @param EloquentBuilder $query - * @param array $types - */ - public function scopeTransactionTypes(EloquentBuilder $query, array $types) - { - if (is_null($this->joinedTransactionTypes)) { - $query->leftJoin( - 'transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id' - ); - $this->joinedTransactionTypes = true; - } - $query->whereIn('transaction_types.type', $types); - } - - /** - * Automatically includes the 'with' parameters to get relevant related - * objects. - * - * @param EloquentBuilder $query - */ - public function scopeWithRelevantData(EloquentBuilder $query) - { - $query->with( - ['transactions' => function (HasMany $q) { - $q->orderBy('amount', 'ASC'); - }, 'transactiontype', 'budgets', 'categories', 'transactions.account.accounttype', 'bill', 'budgets', 'categories'] - ); - } - - /** - * @param $value - */ - public function setDescriptionAttribute($value) - { - $this->attributes['description'] = Crypt::encrypt($value); - $this->attributes['encrypted'] = true; - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function transactionCurrency() - { - return $this->belongsTo('TransactionCurrency'); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function transactionType() - { - return $this->belongsTo('TransactionType'); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany - */ - public function transactiongroups() - { - return $this->belongsToMany('TransactionGroup'); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function transactions() - { - return $this->hasMany('Transaction'); - } - - /** - * User - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function user() - { - return $this->belongsTo('User'); - } - -} diff --git a/app/models/TransactionRelation.php b/app/models/TransactionRelation.php deleted file mode 100644 index cd34f354e9..0000000000 --- a/app/models/TransactionRelation.php +++ /dev/null @@ -1,10 +0,0 @@ -hasMany('TransactionJournal'); - } - -} diff --git a/app/models/User.php b/app/models/User.php deleted file mode 100644 index a3dc1a47ce..0000000000 --- a/app/models/User.php +++ /dev/null @@ -1,102 +0,0 @@ - 'required|email|unique:users,email', - 'password' => 'required|between:60,60', - 'reset' => 'between:32,32', - ]; - protected $table = 'users'; - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function accounts() - { - return $this->hasMany('Account'); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function bills() - { - return $this->hasMany('Bill'); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function budgets() - { - return $this->hasMany('Budget'); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function categories() - { - return $this->hasMany('Category'); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough - */ - public function piggyBanks() - { - return $this->hasManyThrough('PiggyBank', 'Account'); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function preferences() - { - return $this->hasMany('Preference'); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function reminders() - { - return $this->hasMany('Reminder'); - } - - /** - * @param $value - */ - public function setPasswordAttribute($value) - { - $this->attributes['password'] = Hash::make($value); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function transactionjournals() - { - return $this->hasMany('TransactionJournal'); - } - - -} diff --git a/app/routes.php b/app/routes.php deleted file mode 100644 index 1f534f5811..0000000000 --- a/app/routes.php +++ /dev/null @@ -1,408 +0,0 @@ -where('account_types.editable', 1) - ->where('accounts.id', $value) - ->where('user_id', Auth::user()->id) - ->first(['accounts.*']); - if ($account) { - return $account; - } - } - App::abort(404); - } -); - -Route::bind( - 'accountname', function ($value, $route) { - if (Auth::check()) { - return Account:: - leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')->where('account_types.editable', 1)->where('name', $value)->where( - 'user_id', Auth::user()->id - )->first(); - } - - return null; -} -); - - -Route::bind( - 'bill', function ($value, $route) { - if (Auth::check()) { - return Bill:: - where('id', $value)->where('user_id', Auth::user()->id)->first(); - } - - return null; -} -); -Route::bind( - 'budget', function ($value, $route) { - if (Auth::check()) { - return Budget:: - where('id', $value)->where('user_id', Auth::user()->id)->first(); - } - - return null; -} -); - -Route::bind( - 'component', function ($value, $route) { - if (Auth::check()) { - return Component:: - where('id', $value)->where('user_id', Auth::user()->id)->first(); - } - - return null; -} -); - -Route::bind( - 'reminder', function ($value, $route) { - if (Auth::check()) { - return Reminder:: - where('id', $value)->where('user_id', Auth::user()->id)->first(); - } - - return null; -} -); - -Route::bind( - 'category', function ($value, $route) { - if (Auth::check()) { - return Category:: - where('id', $value)->where('user_id', Auth::user()->id)->first(); - } - - return null; -} -); - -Route::bind( - 'tj', function ($value, $route) { - if (Auth::check()) { - return TransactionJournal:: - where('id', $value)->where('user_id', Auth::user()->id)->first(); - } - - return null; -} -); -Route::bind( - 'tjSecond', function ($value, $route) { - if (Auth::check()) { - return TransactionJournal:: - where('id', $value)->where('user_id', Auth::user()->id)->first(); - } - - return null; -} -); - -Route::bind( - 'currency', function ($value, $route) { - return TransactionCurrency::find($value); -} -); - -Route::bind( - 'limitrepetition', function ($value, $route) { - if (Auth::check()) { - return LimitRepetition::where('limit_repetitions.id', $value) - ->leftjoin('budget_limits', 'budget_limits.id', '=', 'limit_repetitions.budget_limit_id') - ->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id') - ->where('budgets.user_id', Auth::user()->id) - ->first(['limit_repetitions.*']); - } - - return null; -} -); - -Route::bind( - 'piggyBank', function ($value, $route) { - if (Auth::check()) { - return PiggyBank:: - where('piggy_banks.id', $value) - ->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id') - ->where('accounts.user_id', Auth::user()->id) - ->where('repeats', 0)->first(['piggy_banks.*']); - } - - return null; -} -); - -Route::bind( - 'repeatedExpense', function ($value, $route) { - if (Auth::check()) { - return PiggyBank:: - where('piggy_banks.id', $value) - ->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id') - ->where('accounts.user_id', Auth::user()->id) - ->where('repeats', 1)->first(['piggy_banks.*']); - } - - return null; -} -); - -Route::bind( - 'repeated', function ($value, $route) { - if (Auth::check()) { - return PiggyBank:: - where('piggy_banks.id', $value) - ->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id') - ->where('accounts.user_id', Auth::user()->id) - ->where('repeats', 1)->first(['piggy_banks.*']); - } - - return null; -} -); - -// protected routes: -Route::group( - ['before' => 'auth'], function () { - - - // some date routes used for (well duh) date-based navigation. - Route::get('/prev', ['uses' => 'HomeController@sessionPrev', 'as' => 'sessionPrev']); - Route::get('/next', ['uses' => 'HomeController@sessionNext', 'as' => 'sessionNext']); - Route::get('/jump/{range}', ['uses' => 'HomeController@rangeJump', 'as' => 'rangeJump']); - - - // account controller: - Route::get('/accounts/{what}', ['uses' => 'AccountController@index', 'as' => 'accounts.index'])->where('what', 'revenue|asset|expense'); - Route::get('/accounts/create/{what}', ['uses' => 'AccountController@create', 'as' => 'accounts.create'])->where('what', 'revenue|asset|expense'); - Route::get('/accounts/edit/{account}', ['uses' => 'AccountController@edit', 'as' => 'accounts.edit']); - Route::get('/accounts/delete/{account}', ['uses' => 'AccountController@delete', 'as' => 'accounts.delete']); - Route::get('/accounts/show/{account}/{view?}', ['uses' => 'AccountController@show', 'as' => 'accounts.show']); - - - // budget controller: - Route::get('/budgets', ['uses' => 'BudgetController@index', 'as' => 'budgets.index']); - Route::get('/budgets/income', ['uses' => 'BudgetController@updateIncome', 'as' => 'budgets.income']); # extra. - Route::get('/budgets/create', ['uses' => 'BudgetController@create', 'as' => 'budgets.create']); - Route::get('/budgets/edit/{budget}', ['uses' => 'BudgetController@edit', 'as' => 'budgets.edit']); - Route::get('/budgets/delete/{budget}', ['uses' => 'BudgetController@delete', 'as' => 'budgets.delete']); - Route::get('/budgets/show/{budget}/{limitrepetition?}', ['uses' => 'BudgetController@show', 'as' => 'budgets.show']); - Route::get('/budgets/list/noBudget', ['uses' => 'BudgetController@noBudget', 'as' => 'budgets.noBudget']); - - // category controller: - Route::get('/categories', ['uses' => 'CategoryController@index', 'as' => 'categories.index']); - Route::get('/categories/create', ['uses' => 'CategoryController@create', 'as' => 'categories.create']); - Route::get('/categories/edit/{category}', ['uses' => 'CategoryController@edit', 'as' => 'categories.edit']); - Route::get('/categories/delete/{category}', ['uses' => 'CategoryController@delete', 'as' => 'categories.delete']); - Route::get('/categories/show/{category}', ['uses' => 'CategoryController@show', 'as' => 'categories.show']); - Route::get('/categories/list/noCategory', ['uses' => 'CategoryController@noCategory', 'as' => 'categories.noCategory']); - - // currency controller - Route::get('/currency', ['uses' => 'CurrencyController@index', 'as' => 'currency.index']); - Route::get('/currency/create', ['uses' => 'CurrencyController@create', 'as' => 'currency.create']); - Route::get('/currency/edit/{currency}', ['uses' => 'CurrencyController@edit', 'as' => 'currency.edit']); - Route::get('/currency/delete/{currency}', ['uses' => 'CurrencyController@delete', 'as' => 'currency.delete']); - Route::get('/currency/default/{currency}', ['uses' => 'CurrencyController@defaultCurrency', 'as' => 'currency.default']); - - // google chart controller - Route::get('/chart/home/account', ['uses' => 'GoogleChartController@allAccountsBalanceChart']); - Route::get('/chart/home/budgets', ['uses' => 'GoogleChartController@allBudgetsHomeChart']); - Route::get('/chart/home/categories', ['uses' => 'GoogleChartController@allCategoriesHomeChart']); - Route::get('/chart/home/bills', ['uses' => 'GoogleChartController@billsOverview']); - Route::get('/chart/account/{account}/{view?}', ['uses' => 'GoogleChartController@accountBalanceChart']); - Route::get('/chart/reports/income-expenses/{year}', ['uses' => 'GoogleChartController@yearInExp']); - Route::get('/chart/reports/income-expenses-sum/{year}', ['uses' => 'GoogleChartController@yearInExpSum']); - Route::get('/chart/bills/{bill}', ['uses' => 'GoogleChartController@billOverview']); - - Route::get('/chart/piggy_history/{piggyBank}', ['uses' => 'GoogleChartController@piggyBankHistory']); - - // google chart for components (categories + budgets combined) - Route::get('/chart/budget/{budget}/spending/{year?}', ['uses' => 'GoogleChartController@budgetsAndSpending']); - Route::get('/chart/budgets/spending/{year?}', ['uses' => 'GoogleChartController@allBudgetsAndSpending']); - Route::get('/chart/budget/{budget}/{limitrepetition}', ['uses' => 'GoogleChartController@budgetLimitSpending']); - Route::get('/chart/category/{category}/spending/{year}', ['uses' => 'GoogleChartController@categoriesAndSpending']); - - // help controller - Route::get('/help/{route}', ['uses' => 'HelpController@show', 'as' => 'help.show']); - - // home controller - Route::get('/', ['uses' => 'HomeController@index', 'as' => 'index']); - Route::get('/flush', ['uses' => 'HomeController@flush', 'as' => 'flush']); # even though nothing is cached. - - // JSON controller - Route::get('/json/expense-accounts', ['uses' => 'JsonController@expenseAccounts', 'as' => 'json.expense-accounts']); - Route::get('/json/revenue-accounts', ['uses' => 'JsonController@revenueAccounts', 'as' => 'json.revenue-accounts']); - Route::get('/json/categories', ['uses' => 'JsonController@categories', 'as' => 'json.categories']); - - - // piggy bank controller - Route::get('/piggy_banks', ['uses' => 'PiggyBankController@index', 'as' => 'piggy_banks.index']); - Route::get('/piggy_banks/add/{piggyBank}', ['uses' => 'PiggyBankController@add']); # add money - Route::get('/piggy_banks/remove/{piggyBank}', ['uses' => 'PiggyBankController@remove']); #remove money - - Route::get('/piggy_banks/create', ['uses' => 'PiggyBankController@create', 'as' => 'piggy_banks.create']); - Route::get('/piggy_banks/edit/{piggyBank}', ['uses' => 'PiggyBankController@edit', 'as' => 'piggy_banks.edit']); - Route::get('/piggy_banks/delete/{piggyBank}', ['uses' => 'PiggyBankController@delete', 'as' => 'piggy_banks.delete']); - Route::get('/piggy_banks/show/{piggyBank}', ['uses' => 'PiggyBankController@show', 'as' => 'piggy_banks.show']); - - // preferences controller - Route::get('/preferences', ['uses' => 'PreferencesController@index', 'as' => 'preferences']); - - //profile controller - Route::get('/profile', ['uses' => 'ProfileController@index', 'as' => 'profile']); - Route::get('/profile/change-password', ['uses' => 'ProfileController@changePassword', 'as' => 'change-password']); - - // related controller: - Route::get('/related/alreadyRelated/{tj}', ['uses' => 'RelatedController@alreadyRelated', 'as' => 'related.alreadyRelated']); - Route::post('/related/relate/{tj}/{tjSecond}', ['uses' => 'RelatedController@relate', 'as' => 'related.relate']); - Route::get('/related/removeRelation/{tj}/{tjSecond}', ['uses' => 'RelatedController@removeRelation', 'as' => 'related.removeRelation']); - Route::get('/related/related/{tj}', ['uses' => 'RelatedController@related', 'as' => 'related.related']); - Route::post('/related/search/{tj}', ['uses' => 'RelatedController@search', 'as' => 'related.search']); - - // bills controller - Route::get('/bills', ['uses' => 'BillController@index', 'as' => 'bills.index']); - Route::get('/bills/rescan/{bill}', ['uses' => 'BillController@rescan', 'as' => 'bills.rescan']); # rescan for matching. - Route::get('/bills/create', ['uses' => 'BillController@create', 'as' => 'bills.create']); - Route::get('/bills/edit/{bill}', ['uses' => 'BillController@edit', 'as' => 'bills.edit']); - Route::get('/bills/delete/{bill}', ['uses' => 'BillController@delete', 'as' => 'bills.delete']); - Route::get('/bills/show/{bill}', ['uses' => 'BillController@show', 'as' => 'bills.show']); - - // repeated expenses controller: - Route::get('/repeatedexpenses', ['uses' => 'RepeatedExpenseController@index', 'as' => 'repeated.index']); - Route::get('/repeatedexpenses/create', ['uses' => 'RepeatedExpenseController@create', 'as' => 'repeated.create']); - Route::get('/repeatedexpenses/edit/{repeatedExpense}', ['uses' => 'RepeatedExpenseController@edit', 'as' => 'repeated.edit']); - Route::get('/repeatedexpenses/delete/{repeatedExpense}', ['uses' => 'RepeatedExpenseController@delete', 'as' => 'repeated.delete']); - Route::get('/repeatedexpenses/show/{repeatedExpense}', ['uses' => 'RepeatedExpenseController@show', 'as' => 'repeated.show']); - - // report controller: - Route::get('/reports', ['uses' => 'ReportController@index', 'as' => 'reports.index']); - Route::get('/reports/{year}', ['uses' => 'ReportController@year', 'as' => 'reports.year']); - Route::get('/reports/{year}/{month}', ['uses' => 'ReportController@month', 'as' => 'reports.month']); - Route::get('/reports/budget/{year}/{month}', ['uses' => 'ReportController@budget', 'as' => 'reports.budget']); - - // reminder controller - Route::get('/reminders/{reminder}', ['uses' => 'ReminderController@show', 'as' => 'reminders.show']); - Route::get('/reminders/{reminder}/dismiss', ['uses' => 'ReminderController@dismiss', 'as' => 'reminders.dismiss']); - Route::get('/reminders/{reminder}/notNow', ['uses' => 'ReminderController@notNow', 'as' => 'reminders.notNow']); - Route::get('/reminders/{reminder}/act', ['uses' => 'ReminderController@act', 'as' => 'reminders.act']); - - // search controller: - Route::get('/search', ['uses' => 'SearchController@index', 'as' => 'search']); - - // transaction controller: - Route::get('/transactions/{what}', ['uses' => 'TransactionController@index', 'as' => 'transactions.index'])->where( - ['what' => 'expenses|revenue|withdrawal|deposit|transfer|transfers'] - ); - Route::get('/transactions/create/{what}', ['uses' => 'TransactionController@create', 'as' => 'transactions.create'])->where( - ['what' => 'expenses|revenue|withdrawal|deposit|transfer|transfers'] - ); - Route::get('/transaction/edit/{tj}', ['uses' => 'TransactionController@edit', 'as' => 'transactions.edit']); - Route::get('/transaction/delete/{tj}', ['uses' => 'TransactionController@delete', 'as' => 'transactions.delete']); - Route::get('/transaction/show/{tj}', ['uses' => 'TransactionController@show', 'as' => 'transactions.show']); - Route::get('/transaction/relate/{tj}', ['uses' => 'TransactionController@relate', 'as' => 'transactions.relate']); - Route::post('/transactions/relatedSearch/{tj}', ['uses' => 'TransactionController@relatedSearch', 'as' => 'transactions.relatedSearch']); - Route::post('/transactions/alreadyRelated/{tj}', ['uses' => 'TransactionController@alreadyRelated', 'as' => 'transactions.alreadyRelated']); - Route::post('/transactions/doRelate', ['uses' => 'TransactionController@doRelate', 'as' => 'transactions.doRelate']); - Route::any('/transactions/unrelate/{tj}', ['uses' => 'TransactionController@unrelate', 'as' => 'transactions.unrelate']); - - // user controller - Route::get('/logout', ['uses' => 'UserController@logout', 'as' => 'logout']); - - Route::post('budgets/amount/{budget}', ['uses' => 'BudgetController@amount']); - - -} -); - -// protected + csrf routes (POST) -Route::group( - ['before' => 'csrf|auth'], function () { - // account controller: - Route::post('/accounts/store', ['uses' => 'AccountController@store', 'as' => 'accounts.store']); - Route::post('/accounts/update/{account}', ['uses' => 'AccountController@update', 'as' => 'accounts.update']); - Route::post('/accounts/destroy/{account}', ['uses' => 'AccountController@destroy', 'as' => 'accounts.destroy']); - - // budget controller: - Route::post('/budgets/income', ['uses' => 'BudgetController@postUpdateIncome', 'as' => 'budgets.postIncome']); - Route::post('/budgets/store', ['uses' => 'BudgetController@store', 'as' => 'budgets.store']); - Route::post('/budgets/update/{budget}', ['uses' => 'BudgetController@update', 'as' => 'budgets.update']); - Route::post('/budgets/destroy/{budget}', ['uses' => 'BudgetController@destroy', 'as' => 'budgets.destroy']); - - // category controller - Route::post('/categories/store', ['uses' => 'CategoryController@store', 'as' => 'categories.store']); - Route::post('/categories/update/{category}', ['uses' => 'CategoryController@update', 'as' => 'categories.update']); - Route::post('/categories/destroy/{category}', ['uses' => 'CategoryController@destroy', 'as' => 'categories.destroy']); - - // currency controller - Route::post('/currency/store', ['uses' => 'CurrencyController@store', 'as' => 'currency.store']); - Route::post('/currency/update/{currency}', ['uses' => 'CurrencyController@update', 'as' => 'currency.update']); - Route::post('/currency/destroy/{currency}', ['uses' => 'CurrencyController@destroy', 'as' => 'currency.destroy']); - - // piggy bank controller - Route::post('/piggy_banks/store', ['uses' => 'PiggyBankController@store', 'as' => 'piggy_banks.store']); - Route::post('/piggy_banks/update/{piggyBank}', ['uses' => 'PiggyBankController@update', 'as' => 'piggy_banks.update']); - Route::post('/piggy_banks/destroy/{piggyBank}', ['uses' => 'PiggyBankController@destroy', 'as' => 'piggy_banks.destroy']); - Route::post('/piggy_banks/add/{piggyBank}', ['uses' => 'PiggyBankController@postAdd', 'as' => 'piggy_banks.add']); # add money - Route::post('/piggy_banks/remove/{piggyBank}', ['uses' => 'PiggyBankController@postRemove', 'as' => 'piggy_banks.remove']); # remove money. - - // repeated expense controller - Route::post('/repeatedexpense/store', ['uses' => 'RepeatedExpenseController@store', 'as' => 'repeated.store']); - Route::post('/repeatedexpense/update/{repeatedExpense}', ['uses' => 'RepeatedExpenseController@update', 'as' => 'repeated.update']); - Route::post('/repeatedexpense/destroy/{repeatedExpense}', ['uses' => 'RepeatedExpenseController@destroy', 'as' => 'repeated.destroy']); - - // preferences controller - Route::post('/preferences', ['uses' => 'PreferencesController@postIndex']); - - // profile controller - Route::post('/profile/change-password', ['uses' => 'ProfileController@postChangePassword']); - - // bills controller - Route::post('/bills/store', ['uses' => 'BillController@store', 'as' => 'bills.store']); - Route::post('/bills/update/{bill}', ['uses' => 'BillController@update', 'as' => 'bills.update']); - Route::post('/bills/destroy/{bill}', ['uses' => 'BillController@destroy', 'as' => 'bills.destroy']); - - // transaction controller: - Route::post('/transactions/store/{what}', ['uses' => 'TransactionController@store', 'as' => 'transactions.store'])->where( - ['what' => 'expenses|revenue|withdrawal|deposit|transfer|transfers'] - ); - Route::post('/transaction/update/{tj}', ['uses' => 'TransactionController@update', 'as' => 'transactions.update']); - Route::post('/transaction/destroy/{tj}', ['uses' => 'TransactionController@destroy', 'as' => 'transactions.destroy']); - -} -); - -// guest routes: -Route::group( - ['before' => 'guest'], function () { - // user controller - Route::get('/login', ['uses' => 'UserController@login', 'as' => 'login']); - Route::get('/register', ['uses' => 'UserController@register', 'as' => 'register', 'before' => 'allow-register']); - Route::get('/reset/{reset}', ['uses' => 'UserController@reset', 'as' => 'reset']); - Route::get('/remindMe', ['uses' => 'UserController@remindMe', 'as' => 'remindMe']); - - Route::get('/oauth2callback', ['uses' => 'HomeController@marauder', 'as' => 'marauder']); - - -} -); - - -// guest + csrf routes: -Route::group( - ['before' => 'csrf|guest'], function () { - - // user controller - Route::post('/login', ['uses' => 'UserController@postLogin', 'as' => 'login.post']); - Route::post('/register', ['uses' => 'UserController@postRegister', 'as' => 'register.post', 'before' => 'allow-register']); - Route::post('/remindMe', ['uses' => 'UserController@postRemindMe', 'as' => 'remindMe.post']); -} -); diff --git a/app/start/artisan.php b/app/start/artisan.php deleted file mode 100644 index 8e36314924..0000000000 --- a/app/start/artisan.php +++ /dev/null @@ -1,14 +0,0 @@ -prepareForTests(); - - } - - static public function setupBeforeClass() - { - f::loadFactories(__DIR__ . '/factories'); - } - - public function tearDown() - { - //m::close(); - } - - /** - * Migrates the database and set the mailer to 'pretend'. - * This will cause the tests to run quickly. - * - */ - private function prepareForTests() - { - Artisan::call('migrate'); - Mail::pretend(true); - } -} diff --git a/app/tests/factories/Account.php b/app/tests/factories/Account.php deleted file mode 100644 index 3d4032b4d1..0000000000 --- a/app/tests/factories/Account.php +++ /dev/null @@ -1,10 +0,0 @@ - 'factory|User', - 'account_type_id' => 'factory|AccountType', - 'name' => 'word', - 'active' => 'boolean', - ] -); diff --git a/app/tests/factories/AccountMeta.php b/app/tests/factories/AccountMeta.php deleted file mode 100644 index a282aa9748..0000000000 --- a/app/tests/factories/AccountMeta.php +++ /dev/null @@ -1,9 +0,0 @@ - 'factory|Account', - 'name' => 'word', - 'data' => 'text' - ] -); diff --git a/app/tests/factories/AccountType.php b/app/tests/factories/AccountType.php deleted file mode 100644 index e893ea89af..0000000000 --- a/app/tests/factories/AccountType.php +++ /dev/null @@ -1,8 +0,0 @@ - 'word', - 'editable' => 'boolean' - ] -); diff --git a/app/tests/factories/Budget.php b/app/tests/factories/Budget.php deleted file mode 100644 index 1975cf53b0..0000000000 --- a/app/tests/factories/Budget.php +++ /dev/null @@ -1,8 +0,0 @@ - 'word', - 'user_id' => 'factory|User' - ] -); diff --git a/app/tests/factories/PiggyBank.php b/app/tests/factories/PiggyBank.php deleted file mode 100644 index aaab88cd71..0000000000 --- a/app/tests/factories/PiggyBank.php +++ /dev/null @@ -1,38 +0,0 @@ - 'factory|Account', - 'name' => 'word', - 'targetamount' => function () { - return rand(1, 400); - }, - 'startdate' => 'date|Y-m-d', - 'targetdate' => 'date|Y-m-d', - 'repeats' => 'boolean', - 'rep_length' => function () { - $set = ['day', 'week', 'quarter', 'month', 'year']; - - return $set[rand(0, count($set) - 1)]; - }, - 'rep_every' => function () { - return rand(0, 3); - }, - 'rep_times' => function () { - return rand(0, 3); - }, - 'reminder' => function () { - $set = ['day', 'week', 'quarter', 'month', 'year']; - - return $set[rand(0, count($set) - 1)]; - }, - 'reminder_skip' => function () { - return rand(0, 3); - }, - 'remind_me' => 'boolean', - 'order' => function () { - return rand(0, 10); - }, - - ] -); diff --git a/app/tests/factories/PiggyBankRepetition.php b/app/tests/factories/PiggyBankRepetition.php deleted file mode 100644 index a266af2283..0000000000 --- a/app/tests/factories/PiggyBankRepetition.php +++ /dev/null @@ -1,13 +0,0 @@ - 'factory|PiggyBank', - 'startdate' => 'date|Y-m-d', - 'targetdate' => 'date|Y-m-d', - 'currentamount' => function () { - return rand(0, 100); - }, - - ] -); diff --git a/app/tests/factories/Preference.php b/app/tests/factories/Preference.php deleted file mode 100644 index 89a26f5812..0000000000 --- a/app/tests/factories/Preference.php +++ /dev/null @@ -1,9 +0,0 @@ - 'factory|User', - 'name' => 'word', - 'data' => 'sentence', - ] -); diff --git a/app/tests/factories/Reminder.php b/app/tests/factories/Reminder.php deleted file mode 100644 index 62f2a3d513..0000000000 --- a/app/tests/factories/Reminder.php +++ /dev/null @@ -1,13 +0,0 @@ - 'factory|User', - 'startdate' => 'date|Y-m-d', - 'enddate' => 'date|Y-m-d', - 'active' => 'boolean', - 'notnow' => 'boolean', - 'remindersable_id' => 0, - 'remindersable_type' => '', - ] -); diff --git a/app/tests/factories/Transaction.php b/app/tests/factories/Transaction.php deleted file mode 100644 index 39f50f7ca5..0000000000 --- a/app/tests/factories/Transaction.php +++ /dev/null @@ -1,12 +0,0 @@ - 'factory|Account', - 'transaction_journal_id' => 'factory|TransactionJournal', - 'description' => 'sentence', - 'amount' => function () { - return round(rand(100, 10000) / 100, 2); - } - ] -); diff --git a/app/tests/factories/TransactionCurrency.php b/app/tests/factories/TransactionCurrency.php deleted file mode 100644 index cfb3b685b0..0000000000 --- a/app/tests/factories/TransactionCurrency.php +++ /dev/null @@ -1,30 +0,0 @@ - function () { - $code = ''; - for ($i = 0; $i < 3; $i++) { - $code .= chr(rand(65, 90)); - } - - return $code; - }, - 'name' => function () { - $code = ''; - for ($i = 0; $i < 8; $i++) { - $code .= chr(rand(65, 90)); - } - - return $code; - }, - 'symbol' => function () { - $code = ''; - for ($i = 0; $i < 2; $i++) { - $code .= chr(rand(65, 90)); - } - - return $code; - } - ] -); diff --git a/app/tests/factories/TransactionGroup.php b/app/tests/factories/TransactionGroup.php deleted file mode 100644 index 74e917a8ae..0000000000 --- a/app/tests/factories/TransactionGroup.php +++ /dev/null @@ -1,8 +0,0 @@ - 'factory|User', - 'relation' => 'balance', - ] -); diff --git a/app/tests/factories/TransactionJournal.php b/app/tests/factories/TransactionJournal.php deleted file mode 100644 index 58fd89d200..0000000000 --- a/app/tests/factories/TransactionJournal.php +++ /dev/null @@ -1,12 +0,0 @@ - 'factory|TransactionType', - 'transaction_currency_id' => 'factory|TransactionCurrency', - 'description' => 'text', - 'date' => 'date|Y-m-d', - 'completed' => 'boolean', - 'user_id' => 'factory|User' - ] -); diff --git a/app/tests/factories/TransactionType.php b/app/tests/factories/TransactionType.php deleted file mode 100644 index 0876277d2c..0000000000 --- a/app/tests/factories/TransactionType.php +++ /dev/null @@ -1,7 +0,0 @@ - 'word', - ] -); diff --git a/app/tests/factories/User.php b/app/tests/factories/User.php deleted file mode 100644 index 92efe04843..0000000000 --- a/app/tests/factories/User.php +++ /dev/null @@ -1,7 +0,0 @@ - 'email', - 'password' => 'empty' - ] -); diff --git a/app/views/accounts/create.blade.php b/app/views/accounts/create.blade.php deleted file mode 100644 index a0455b2c00..0000000000 --- a/app/views/accounts/create.blade.php +++ /dev/null @@ -1,55 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $what) }} -{{Form::open(['class' => 'form-horizontal','id' => 'store','route' => 'accounts.store'])}} -{{Form::hidden('what',$what)}} -
-
-
-
- Mandatory fields -
-
- {{Form::ffText('name')}} -
-
-

- -

-
- -
- - -
-
- Optional fields -
-
- @if($what == 'asset') - {{Form::ffBalance('openingBalance')}} - {{Form::ffDate('openingBalanceDate', date('Y-m-d'))}} - {{Form::ffSelect('account_role',Config::get('firefly.accountRoles'))}} - @endif - {{Form::ffCheckbox('active','1',true)}} -
-
- - - -
-
- Options -
-
- {{Form::ffOptionsList('create','account')}} -
-
- -
-
- -{{Form::close()}} -@stop diff --git a/app/views/accounts/delete.blade.php b/app/views/accounts/delete.blade.php deleted file mode 100644 index 017224a1fd..0000000000 --- a/app/views/accounts/delete.blade.php +++ /dev/null @@ -1,33 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $account) }} -{{Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('accounts.destroy',$account->id)])}} -
-
-
-
- Delete account "{{{$account->name}}}" -
-
-

- Are you sure? -

- - @if($account->transactions()->count() > 0) -

- Account "{{{$account->name}}}" still has {{$account->transactions()->count()}} transaction(s) associated to it. - These will be deleted as well. -

- @endif - -

- - Cancel -

-
-
-
-
- -{{Form::close()}} -@stop diff --git a/app/views/accounts/edit.blade.php b/app/views/accounts/edit.blade.php deleted file mode 100644 index 62d246ec3c..0000000000 --- a/app/views/accounts/edit.blade.php +++ /dev/null @@ -1,51 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $account) }} -{{Form::model($account, ['class' => 'form-horizontal','id' => 'update','url' => route('accounts.update',$account->id)])}} -
-
-
-
- Mandatory fields -
-
- {{Form::ffText('name')}} -
-
-

- -

-
-
-
-
- Optional fields -
-
- {{Form::ffCheckbox('active','1')}} - @if($account->accounttype->type == 'Default account' || $account->accounttype->type == 'Asset account') - {{Form::ffBalance('openingBalance',null, ['currency' => $openingBalance ? $openingBalance->transactionCurrency : null])}} - {{Form::ffDate('openingBalanceDate')}} - {{Form::ffSelect('account_role',Config::get('firefly.accountRoles'))}} - {{Form::hidden('what',$what)}} - @endif -
-
- - -
-
- Options -
-
- {{Form::ffOptionsList('update','account')}} -
-
- -
-
- -{{Form::close()}} -@stop diff --git a/app/views/accounts/index.blade.php b/app/views/accounts/index.blade.php deleted file mode 100644 index e837940541..0000000000 --- a/app/views/accounts/index.blade.php +++ /dev/null @@ -1,43 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $what) }} -
-
-
-
- {{{$subTitle}}} - - -
-
- - -
-
- - -
- @include('list.accounts') -
-
-
-@stop -@section('scripts') - - - - -{{HTML::script('assets/javascript/firefly/gcharts.options.js')}} -{{HTML::script('assets/javascript/firefly/gcharts.js')}} - - -{{HTML::script('assets/javascript/firefly/accounts.js')}} -@stop diff --git a/app/views/accounts/show.blade.php b/app/views/accounts/show.blade.php deleted file mode 100644 index 69d93d900b..0000000000 --- a/app/views/accounts/show.blade.php +++ /dev/null @@ -1,77 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $account) }} -
-
-
-
- {{{$account->name}}} - - - -
-
- - -
-
-
-
-
-
-
-
-
- - @include('partials.date_nav') -
-
- View options for {{{$account->name}}} -
-
-

- @if($range == 'all') - Stick to date-range - @else - Show all transactions - @endif -

-
-
-
-
- - -
-
-
-
- Transactions -
-
- @include('list.journals-full') -
-
-
- - - -@stop -@section('scripts') - - - -{{HTML::script('assets/javascript/firefly/gcharts.options.js')}} -{{HTML::script('assets/javascript/firefly/gcharts.js')}} -{{HTML::script('assets/javascript/firefly/accounts.js')}} -@stop diff --git a/app/views/bills/create.blade.php b/app/views/bills/create.blade.php deleted file mode 100644 index f2ddc3b828..0000000000 --- a/app/views/bills/create.blade.php +++ /dev/null @@ -1,64 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -{{Form::open(['class' => 'form-horizontal','id' => 'store','url' => route('bills.store')])}} - -
-
- -
-
- Mandatory fields -
-
- {{Form::ffText('name')}} - {{Form::ffTags('match')}} - {{Form::ffAmount('amount_min')}} - {{Form::ffAmount('amount_max')}} - {{Form::ffDate('date',Carbon\Carbon::now()->addDay()->format('Y-m-d'))}} - {{Form::ffSelect('repeat_freq',$periods,'monthly')}} -
-
-

- -

-
-
- -
-
- Optional fields -
-
- {{Form::ffInteger('skip',0)}} - {{Form::ffCheckbox('automatch',1,true)}} - {{Form::ffCheckbox('active',1,true)}} -
-
- - -
-
- Options -
-
- {{Form::ffOptionsList('create','bill')}} -
-
- -
-
- -{{Form::close()}} - - -@stop -@section('styles') -{{HTML::style('assets/stylesheets/tagsinput/bootstrap-tagsinput.css')}} -@stop -@section('scripts') -{{HTML::script('assets/javascript/tagsinput/bootstrap-tagsinput.min.js')}} - -@stop diff --git a/app/views/bills/delete.blade.php b/app/views/bills/delete.blade.php deleted file mode 100644 index 801db34b94..0000000000 --- a/app/views/bills/delete.blade.php +++ /dev/null @@ -1,37 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $bill) }} -{{Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('bills.destroy',$bill->id)])}} -
-
-
-
- Delete bill "{{{$bill->name}}}" -
-
-

- Are you sure? -

- -

- - Cancel -

-
-
-
-
- -
-
-
-
- -
-
-
-
- - -{{Form::close()}} -@stop diff --git a/app/views/bills/edit.blade.php b/app/views/bills/edit.blade.php deleted file mode 100644 index e68d445918..0000000000 --- a/app/views/bills/edit.blade.php +++ /dev/null @@ -1,62 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $bill) }} -{{Form::model($bill, ['class' => 'form-horizontal','id' => 'update','url' => route('bills.update', $bill->id)])}} - -
-
- -
-
- Mandatory fields -
-
- {{Form::ffText('name')}} - {{Form::ffTags('match')}} - {{Form::ffAmount('amount_min')}} - {{Form::ffAmount('amount_max')}} - {{Form::ffDate('date',$bill->date->format('Y-m-d'))}} - {{Form::ffSelect('repeat_freq',$periods)}} -
-
- -

- -

-
-
- -
-
- Optional fields -
-
- {{Form::ffInteger('skip')}} - {{Form::ffCheckbox('automatch',1)}} - {{Form::ffCheckbox('active',1)}} - -
-
-
-
- Options -
-
- {{Form::ffOptionsList('update','bill')}} -
- -
-
-
-{{Form::close()}} - - -@stop -@section('styles') -{{HTML::style('assets/stylesheets/tagsinput/bootstrap-tagsinput.css')}} -@stop -@section('scripts') -{{HTML::script('assets/javascript/tagsinput/bootstrap-tagsinput.min.js')}} -@stop diff --git a/app/views/bills/index.blade.php b/app/views/bills/index.blade.php deleted file mode 100644 index b6259ef431..0000000000 --- a/app/views/bills/index.blade.php +++ /dev/null @@ -1,32 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -
-
-
-
- {{{$title}}} - - -
-
- - -
-
-
-
- @include('list.bills') -
-
-
-
-@stop -@section('scripts') - -@stop diff --git a/app/views/bills/show.blade.php b/app/views/bills/show.blade.php deleted file mode 100644 index 6437e6fdcb..0000000000 --- a/app/views/bills/show.blade.php +++ /dev/null @@ -1,116 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $bill) }} -
-
-
-
- {{{$bill->name}}} - - @if($bill->active) - - @else - - @endif - - @if($bill->automatch) - - @else - - @endif - - -
-
- - -
-
- -
-
- - - - - - - - - -
- Matching on - @foreach(explode(',',$bill->match) as $word) - {{{$word}}} - @endforeach - between {{Amount::format($bill->amount_min)}} and {{Amount::format($bill->amount_max)}}. - Repeats {{$bill->repeat_freq}}.
Next expected match - @if($bill->nextExpectedMatch) - {{$bill->nextExpectedMatch->format('j F Y')}} - @else - Unknown - @endif -
-
-
-
-
-
-
- More -
- -
-
-
- -
-
-
-
- Chart -
-
-
-
-
-
-
- -
-
-
-
- Connected transaction journals -
-
- @include('list.journals-full') -
-
-
-
- -@stop - -@section('scripts') - - - -{{HTML::script('assets/javascript/firefly/gcharts.options.js')}} -{{HTML::script('assets/javascript/firefly/gcharts.js')}} - -{{HTML::script('assets/javascript/firefly/bills.js')}} -@stop diff --git a/app/views/budgets/create.blade.php b/app/views/budgets/create.blade.php deleted file mode 100644 index 53c67089ca..0000000000 --- a/app/views/budgets/create.blade.php +++ /dev/null @@ -1,42 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -{{Form::open(['class' => 'form-horizontal','id' => 'store','url' => route('budgets.store')])}} -
-
-
-
- Mandatory fields -
-
- {{Form::ffText('name')}} -
-
-

- -

- -
-
- -
-
- Options -
-
- {{Form::ffOptionsList('create','budget')}} -
-
- -
- -
- - - -{{Form::close()}} - - -@stop diff --git a/app/views/budgets/delete.blade.php b/app/views/budgets/delete.blade.php deleted file mode 100644 index 1e8a1a68d7..0000000000 --- a/app/views/budgets/delete.blade.php +++ /dev/null @@ -1,37 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $budget) }} -{{Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('budgets.destroy',$budget->id)])}} -
-
-
-
- Delete budget "{{{$budget->name}}}" -
-
-

- Are you sure? -

- -

- - Cancel -

-
-
-
-
- -
-
-
-
- -
-
-
-
- - -{{Form::close()}} -@stop diff --git a/app/views/budgets/edit.blade.php b/app/views/budgets/edit.blade.php deleted file mode 100644 index 94061cd926..0000000000 --- a/app/views/budgets/edit.blade.php +++ /dev/null @@ -1,42 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $budget) }} -
-
-

Use budgets to organize and limit your expenses.

-
-
- -{{Form::model($budget, ['class' => 'form-horizontal','id' => 'update','url' => route('budgets.update',$budget->id)])}} -
-
-
-
- Mandatory fields -
-
- {{Form::ffText('name')}} -
-
-

- -

-
-
- -
-
- Options -
-
- {{Form::ffOptionsList('update','budget')}} -
-
-
-
-{{Form::close()}} - - -@stop diff --git a/app/views/budgets/income.blade.php b/app/views/budgets/income.blade.php deleted file mode 100644 index 713c61a20c..0000000000 --- a/app/views/budgets/income.blade.php +++ /dev/null @@ -1,21 +0,0 @@ -
-{{Form::token()}} - -
diff --git a/app/views/budgets/index.blade.php b/app/views/budgets/index.blade.php deleted file mode 100644 index 5221602386..0000000000 --- a/app/views/budgets/index.blade.php +++ /dev/null @@ -1,154 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -
-
-
-
- {{\Session::get('start', \Carbon\Carbon::now()->startOfMonth())->format('F Y')}} -
-
-
-
- Budgeted: {{Amount::format(300)}} -
-
- Income {{\Session::get('start', \Carbon\Carbon::now()->startOfMonth())->format('F Y')}}: - {{Amount::format($amount)}} -
-
- -
-
-
-
-
-
-
-
-
-
-
- Spent: {{Amount::format($spent)}} -
-
-
-
-
- @if($overspent) -
-
- @else -
- @endif -
-
-
- -
-
-
-
- - @include('partials.date_nav') - - -
-
- -
-@foreach($budgets as $budget) -
-
-
- @if(isset($budget->currentRep)) - {{{$budget->name}}} - @else - {{{$budget->name}}} - @endif - - - -
-
- - -
-
- -
-
- -

- @if($budget->currentRep) - - @else - - @endif -

- -

- - - @if($budget->currentRep) - - Budgeted: - - - @if($budget->currentRep->amount > $budget->spent) - {{Amount::getCurrencySymbol()}} - @else - {{Amount::getCurrencySymbol()}} - @endif - - @else - No budget - - - - @endif - -

-

- Spent: {{Amount::format($budget->spent)}} -

-
-
-
-@endforeach -
-
-
- Create budget -
- -
-
- - - - - -@stop -@section('scripts') -{{HTML::script('assets/javascript/firefly/budgets.js')}} -@stop diff --git a/app/views/budgets/noBudget.blade.php b/app/views/budgets/noBudget.blade.php deleted file mode 100644 index dea483315f..0000000000 --- a/app/views/budgets/noBudget.blade.php +++ /dev/null @@ -1,24 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -
-
- - @include('partials.date_nav') -
-
-
-
-
-
- {{{$subTitle}}} -
-
- @include('list.journals-full',['journals' => $list]) -
-
-
-
- - -@stop diff --git a/app/views/budgets/show.blade.php b/app/views/budgets/show.blade.php deleted file mode 100644 index 7378d42146..0000000000 --- a/app/views/budgets/show.blade.php +++ /dev/null @@ -1,91 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $budget, $repetition) }} -
-
-
-
- Overview -
-
-
-
-
- -
-
- Transactions -
- @include('list.journals-full') -
-
-
- @foreach($limits as $limit) - @foreach($limit->limitrepetitions as $rep) -
- -
-
-
- Amount: {{Amount::format($rep->amount)}} -
-
- Spent: {{Amount::format($rep->spentInRepetition())}} -
-
-
-
- spentInRepetition() > $rep->amount; - ?> - @if($overspent) - amount / $rep->spentInRepetition()*100; - ?> -
-
-
-
- @else - spentInRepetition() / $rep->amount*100; - ?> -
-
-
-
- @endif -
-
-
-
- @endforeach - @endforeach - - -
-
- -@stop -@section('scripts') - - - - -{{HTML::script('assets/javascript/firefly/gcharts.options.js')}} -{{HTML::script('assets/javascript/firefly/gcharts.js')}} -{{HTML::script('assets/javascript/firefly/budgets.js')}} - -@stop diff --git a/app/views/categories/create.blade.php b/app/views/categories/create.blade.php deleted file mode 100644 index 22faffe5f5..0000000000 --- a/app/views/categories/create.blade.php +++ /dev/null @@ -1,41 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -{{Form::open(['class' => 'form-horizontal','id' => 'store','url' => route('categories.store')])}} - -
-
-
-
- Mandatory fields -
-
- {{Form::ffText('name')}} -
-
-

- -

-
- -
- - -
-
- Options -
-
- {{Form::ffOptionsList('create','category')}} -
-
- -
-
- -{{Form::close()}} - - -@stop diff --git a/app/views/categories/delete.blade.php b/app/views/categories/delete.blade.php deleted file mode 100644 index 52d457b457..0000000000 --- a/app/views/categories/delete.blade.php +++ /dev/null @@ -1,37 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $category) }} -{{Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('categories.destroy',$category->id)])}} -
-
-
-
- Delete category "{{{$category->name}}}" -
-
-

- Are you sure? -

- -

- - Cancel -

-
-
-
-
- -
-
-
-
- -
-
-
-
- - -{{Form::close()}} -@stop diff --git a/app/views/categories/edit.blade.php b/app/views/categories/edit.blade.php deleted file mode 100644 index 69987b85a6..0000000000 --- a/app/views/categories/edit.blade.php +++ /dev/null @@ -1,38 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $category) }} -{{Form::model($category, ['class' => 'form-horizontal','id' => 'update','url' => route('categories.update',$category->id)])}} -
-
-
-
- Mandatory fields -
-
- {{Form::ffText('name')}} -
-
-

- -

-
-
- - - -
-
- Options -
-
- {{Form::ffOptionsList('update','category')}} -
-
- -
-
- -{{Form::close()}} -@stop diff --git a/app/views/categories/index.blade.php b/app/views/categories/index.blade.php deleted file mode 100644 index 3c176f36b6..0000000000 --- a/app/views/categories/index.blade.php +++ /dev/null @@ -1,39 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -
-
-
-
- Categories - - -
-
- - -
-
- - -
- @include('list.categories') -
-
-
-@stop -@section('scripts') - - - -{{HTML::script('assets/javascript/firefly/gcharts.options.js')}} -{{HTML::script('assets/javascript/firefly/gcharts.js')}} -{{HTML::script('assets/javascript/firefly/categories.js')}} -@stop diff --git a/app/views/categories/noCategory.blade.php b/app/views/categories/noCategory.blade.php deleted file mode 100644 index dea483315f..0000000000 --- a/app/views/categories/noCategory.blade.php +++ /dev/null @@ -1,24 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -
-
- - @include('partials.date_nav') -
-
-
-
-
-
- {{{$subTitle}}} -
-
- @include('list.journals-full',['journals' => $list]) -
-
-
-
- - -@stop diff --git a/app/views/categories/show.blade.php b/app/views/categories/show.blade.php deleted file mode 100644 index bdfefd3e52..0000000000 --- a/app/views/categories/show.blade.php +++ /dev/null @@ -1,42 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $category) }} -
-
-
-
- Overview -
-
-
-
-
- -
-
- Transactions -
-
- @include('list.journals-full') -
-
-
-
- BLa bla something here. -
-
- -@stop -@section('scripts') - - - -{{HTML::script('assets/javascript/firefly/gcharts.options.js')}} -{{HTML::script('assets/javascript/firefly/gcharts.js')}} -{{HTML::script('assets/javascript/firefly/categories.js')}} - -@stop diff --git a/app/views/currency/create.blade.php b/app/views/currency/create.blade.php deleted file mode 100644 index 1cca5bee88..0000000000 --- a/app/views/currency/create.blade.php +++ /dev/null @@ -1,40 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -{{Form::open(['class' => 'form-horizontal','id' => 'store','route' => 'currency.store'])}} -
-
-
-
- Mandatory fields -
-
- {{Form::ffText('name',null,['maxlength' => 48])}} - {{Form::ffText('symbol',null,['maxlength' => 8])}} - {{Form::ffText('code',null,['maxlength' => 3])}} -
-
-

- -

-
- -
- - -
-
- Options -
-
- {{Form::ffOptionsList('create','currency')}} -
-
- -
-
- -{{Form::close()}} -@stop diff --git a/app/views/currency/delete.blade.php b/app/views/currency/delete.blade.php deleted file mode 100644 index 8fd0af69aa..0000000000 --- a/app/views/currency/delete.blade.php +++ /dev/null @@ -1,25 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $currency) }} -{{Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('currency.destroy',$currency->id)])}} -
-
-
-
- Delete currency "{{{$currency->name}}}" -
-
-

- Are you sure? -

-

- - Cancel -

-
-
-
-
- -{{Form::close()}} -@stop diff --git a/app/views/currency/edit.blade.php b/app/views/currency/edit.blade.php deleted file mode 100644 index 246f9d5c9d..0000000000 --- a/app/views/currency/edit.blade.php +++ /dev/null @@ -1,40 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -{{Form::model($currency, ['class' => 'form-horizontal','id' => 'update','url' => route('currency.update',$currency->id)])}} -
-
-
-
- Mandatory fields -
-
- {{Form::ffText('name',null,['maxlength' => 48])}} - {{Form::ffText('symbol',null,['maxlength' => 8])}} - {{Form::ffText('code',null,['maxlength' => 3])}} -
-
-

- -

-
- -
- - -
-
- Options -
-
- {{Form::ffOptionsList('update','currency')}} -
-
- -
-
- -{{Form::close()}} -@stop diff --git a/app/views/currency/index.blade.php b/app/views/currency/index.blade.php deleted file mode 100644 index be3662c948..0000000000 --- a/app/views/currency/index.blade.php +++ /dev/null @@ -1,53 +0,0 @@ -@extends('layouts.default') -@section('content') - {{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} - -
-
-
-
- Currencies -
-
-

- Firefly III supports various currencies which you can set and enable here. -

-
    - @if(count($currencies) > 0) - @foreach($currencies as $currency) -
  • - - - {{{$currency->name}}} ({{{$currency->code}}}) ({{{$currency->symbol}}}) - @if($currency->id == $defaultCurrency->id) - default - @else - make default - - @endif -
  • - @endforeach - @endif -
  • Add another currency
  • -
-
-
-
-
-
-
- Supported -
-
-
    -
  • Set the default currency display;
  • -
  • Set the default currency for new transactions;
  • -
  • Add, modify and remove supported currencies.
  • -
  • Display the actual currency of a transaction
  • -
  • Update a transaction's currency.
  • -
-
-
-
-
-@stop diff --git a/app/views/emails/user/register-html.blade.php b/app/views/emails/user/register-html.blade.php deleted file mode 100644 index e81ca6d95e..0000000000 --- a/app/views/emails/user/register-html.blade.php +++ /dev/null @@ -1,19 +0,0 @@ - - - - - -

- Hi! -

-

- Here's the password you need to login at Firefly: {{$password}} -

-

- Cya! -

- - - diff --git a/app/views/emails/user/register-text.blade.php b/app/views/emails/user/register-text.blade.php deleted file mode 100644 index 0993031a88..0000000000 --- a/app/views/emails/user/register-text.blade.php +++ /dev/null @@ -1,5 +0,0 @@ -Hi! - -Here's the password you need to login at Firefly: {{$password}} - -Cya! diff --git a/app/views/emails/user/verify-html.blade.php b/app/views/emails/user/verify-html.blade.php deleted file mode 100644 index 90b477e351..0000000000 --- a/app/views/emails/user/verify-html.blade.php +++ /dev/null @@ -1,19 +0,0 @@ - - - - - -

- Hi! -

-

- To verify your registration, please verify your e-mail address. -

-

- Cya! -

- - - diff --git a/app/views/emails/user/verify-text.blade.php b/app/views/emails/user/verify-text.blade.php deleted file mode 100644 index 27f1d553a0..0000000000 --- a/app/views/emails/user/verify-text.blade.php +++ /dev/null @@ -1,7 +0,0 @@ -Hi! - -To verify your registration, please verify your e-mail address: - -{{route('reset',$reset)}} - -Cya! diff --git a/app/views/error.blade.php b/app/views/error.blade.php deleted file mode 100644 index 4140018572..0000000000 --- a/app/views/error.blade.php +++ /dev/null @@ -1,16 +0,0 @@ -@extends('layouts.guest') -@section('content') -
-
-

Firefly
- Error -

-
-
- -
-
- {{$message or 'General unknown errror'}} -
-
-@stop diff --git a/app/views/form/amount.blade.php b/app/views/form/amount.blade.php deleted file mode 100644 index e1c99a4c05..0000000000 --- a/app/views/form/amount.blade.php +++ /dev/null @@ -1,20 +0,0 @@ -
- -
-
-
- - -
- {{Form::input('number', $name, $value, $options)}} - {{Form::input('hidden','amount_currency_id',$defaultCurrency->id)}} - @include('form.feedback') -
-
-
\ No newline at end of file diff --git a/app/views/form/balance.blade.php b/app/views/form/balance.blade.php deleted file mode 100644 index ba7f2c5d06..0000000000 --- a/app/views/form/balance.blade.php +++ /dev/null @@ -1,20 +0,0 @@ -
- -
-
-
- - -
- {{Form::input('number', $name, $value, $options)}} - {{Form::input('hidden','balance_currency_id',$defaultCurrency->id)}} - @include('form.feedback') -
-
-
\ No newline at end of file diff --git a/app/views/form/checkbox.blade.php b/app/views/form/checkbox.blade.php deleted file mode 100644 index 5772bbf3f1..0000000000 --- a/app/views/form/checkbox.blade.php +++ /dev/null @@ -1,11 +0,0 @@ -
- -
-
- -
- @include('form.feedback') -
-
\ No newline at end of file diff --git a/app/views/form/date.blade.php b/app/views/form/date.blade.php deleted file mode 100644 index beb3228f9e..0000000000 --- a/app/views/form/date.blade.php +++ /dev/null @@ -1,7 +0,0 @@ -
- -
- {{Form::input('date', $name, $value, $options)}} - @include('form.feedback') -
-
\ No newline at end of file diff --git a/app/views/form/feedback.blade.php b/app/views/form/feedback.blade.php deleted file mode 100644 index 72c3762e4b..0000000000 --- a/app/views/form/feedback.blade.php +++ /dev/null @@ -1,12 +0,0 @@ -@if(Session::has('errors') && Session::get('errors')->has($name)) - -

{{{Session::get('errors')->first($name)}}}

-@endif -@if(Session::has('warnings') && Session::get('warnings')->has($name)) - -

{{{Session::get('warnings')->first($name)}}}

-@endif -@if(Session::has('successes') && Session::get('successes')->has($name)) - -

{{{Session::get('successes')->first($name)}}}

-@endif \ No newline at end of file diff --git a/app/views/form/integer.blade.php b/app/views/form/integer.blade.php deleted file mode 100644 index fd10ca6ca6..0000000000 --- a/app/views/form/integer.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -
- -
-
- {{Form::input('number', $name, $value, $options)}} - @include('form.feedback') -
-
-
\ No newline at end of file diff --git a/app/views/form/options.blade.php b/app/views/form/options.blade.php deleted file mode 100644 index 5373a0c60e..0000000000 --- a/app/views/form/options.blade.php +++ /dev/null @@ -1,69 +0,0 @@ -@if($type == 'create') -
- -
-
- -
-
-
-@endif -@if($type == 'update') -
- -
-
- -
-
-
-@endif - -
- -
-
- -
-
-
- -@if($type == 'create') -
- -
-
- -
-
-
-@endif - -@if($type == 'update') -
- -
-
-
-
-
-@endif \ No newline at end of file diff --git a/app/views/form/select.blade.php b/app/views/form/select.blade.php deleted file mode 100644 index cc35a7b4ea..0000000000 --- a/app/views/form/select.blade.php +++ /dev/null @@ -1,8 +0,0 @@ -
- -
- {{Form::select($name, $list, $selected , $options )}} - @include('form.feedback') - -
-
\ No newline at end of file diff --git a/app/views/form/tags.blade.php b/app/views/form/tags.blade.php deleted file mode 100644 index 3094ba8e25..0000000000 --- a/app/views/form/tags.blade.php +++ /dev/null @@ -1,7 +0,0 @@ -
- -
- {{Form::input('text', $name, $value, $options)}} - @include('form.feedback') -
-
\ No newline at end of file diff --git a/app/views/form/text.blade.php b/app/views/form/text.blade.php deleted file mode 100644 index 3094ba8e25..0000000000 --- a/app/views/form/text.blade.php +++ /dev/null @@ -1,7 +0,0 @@ -
- -
- {{Form::input('text', $name, $value, $options)}} - @include('form.feedback') -
-
\ No newline at end of file diff --git a/app/views/help/show.blade.php b/app/views/help/show.blade.php deleted file mode 100644 index e864585fd5..0000000000 --- a/app/views/help/show.blade.php +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/app/views/index.blade.php b/app/views/index.blade.php deleted file mode 100644 index 22520f85b5..0000000000 --- a/app/views/index.blade.php +++ /dev/null @@ -1,129 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists() }} -@if($count == 0) -
-
-

Welcome to Firefly III.

- -

- Create a new asset account to get started. -

-
-
-
- - @else - - - -
-
- -
- -
-
-
-
- -
- -
-
-
-
- -
- -
-
-
-
-
-
- Savings -
-
- (todo) -
-
- - - -
-
- - @include('partials.date_nav') - - -
-
- Bills -
-
-
-
-
- - - @foreach($transactions as $data) -
-
- - {{{$data[1]->name}}} - - - -
-
- - -
-
- - - -
-
- @include('list.journals-tiny',['transactions' => $data[0],'account' => $data[1]]) -
-
- @endforeach -
-
- -@endif - - -@stop -@section('scripts') - - - -{{HTML::script('assets/javascript/firefly/gcharts.options.js')}} -{{HTML::script('assets/javascript/firefly/gcharts.js')}} - - - -{{HTML::script('assets/javascript/firefly/index.js')}} -@stop -@section('styles') -@stop diff --git a/app/views/layouts/default.blade.php b/app/views/layouts/default.blade.php deleted file mode 100644 index b091d3b070..0000000000 --- a/app/views/layouts/default.blade.php +++ /dev/null @@ -1,115 +0,0 @@ - - -getName();?> - - - - - - Firefly - @if(isset($title) && $title != 'Firefly') - // {{{$title}}} - @endif - @if(isset($subTitle)) - // {{{$subTitle}}} - @endif - - {{HTML::style('assets/stylesheets/bootstrap/bootstrap.min.css')}} - {{HTML::style('assets/stylesheets/metisMenu/metisMenu.min.css')}} - {{HTML::style('assets/stylesheets/sbadmin/sb.css')}} - {{HTML::style('assets/stylesheets/fa/css/font-awesome.min.css')}} - {{HTML::style('https://fonts.googleapis.com/css?family=Roboto2')}} - @yield('styles') - - - - - - - - - - - - - - - - - - - - - - - - -
- - @include('partials.menu') - -
- -
-
-

- @if(isset($mainTitleIcon)) - - @endif - {{$title or '(no title)'}} - @if(isset($subTitle)) - - @if(isset($subTitleIcon)) - - @endif - {{$subTitle}} - - @endif - -

- -
- -
- - @include('partials.flashes') - @yield('content') - - - - -
-
- - - - -{{HTML::script('assets/javascript/jquery/jquery-2.1.1.min.js')}} -{{HTML::script('assets/javascript/bootstrap/bootstrap.min.js')}} -{{HTML::script('assets/javascript/metisMenu/jquery.metisMenu.min.js')}} -{{HTML::script('assets/javascript/sb-admin/sb-admin-2.js')}} -{{HTML::script('assets/javascript/firefly/help.js')}} -{{HTML::script('assets/javascript/firefly/firefly.js')}} -@yield('scripts') - - diff --git a/app/views/layouts/guest.blade.php b/app/views/layouts/guest.blade.php deleted file mode 100644 index 006619c34c..0000000000 --- a/app/views/layouts/guest.blade.php +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - Firefly III - - {{HTML::style('assets/stylesheets/bootstrap/bootstrap.min.css')}} - {{HTML::style('assets/stylesheets/metisMenu/metisMenu.min.css')}} - {{HTML::style('assets/stylesheets/sbadmin/sb.css')}} - {{HTML::style('assets/stylesheets/fa/css/font-awesome.min.css')}} - - - - - - - - - - - - - - - - - - - - - - - - -
- @include('partials.flashes') - @yield('content') -
- - diff --git a/app/views/list/accounts.blade.php b/app/views/list/accounts.blade.php deleted file mode 100644 index 84f88bdfcc..0000000000 --- a/app/views/list/accounts.blade.php +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - @foreach($accounts as $account) - - - - - - - - - - @endforeach -
 NameRoleCurrent balanceActiveLast activity
-
- - -
-
{{{$account->name}}}{{{$account->accountRole}}}{{Amount::format(Steam::balance($account))}} - @if($account->active) - - @else - - @endif - - @if($account->lastActivityDate) - {{{$account->lastActivityDate->format('j F Y')}}} - @else - Never - @endif -
diff --git a/app/views/list/bills.blade.php b/app/views/list/bills.blade.php deleted file mode 100644 index 1540af42de..0000000000 --- a/app/views/list/bills.blade.php +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - @foreach($bills as $entry) - - - - - - - - - - - - - @endforeach -
 NameMatches onMatching amountLast seen matchNext expected matchIs activeWill be automatchedRepeats every
-
- - -
-
- {{{$entry->name}}} - - @foreach(explode(',',$entry->match) as $match) - {{{$match}}} - @endforeach - - {{Amount::format($entry->amount_min)}} - — - {{Amount::format($entry->amount_max)}} - - @if($entry->lastFoundMatch) - {{$entry->lastFoundMatch->format('j F Y')}} - @else - Unknown - @endif - - @if($entry->nextExpectedMatch) - {{$entry->nextExpectedMatch->format('j F Y')}} - @else - Unknown - @endif - - @if($entry->active) - - @else - - @endif - - @if($entry->automatch) - - @else - - @endif - - {{{$entry->repeat_freq}}} - @if($entry->skip > 0) - skips over {{$entry->skip}} - @endif -
diff --git a/app/views/list/categories.blade.php b/app/views/list/categories.blade.php deleted file mode 100644 index c12a88762c..0000000000 --- a/app/views/list/categories.blade.php +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - @foreach($categories as $category) - - - - - - @endforeach -
 NameLast activity
 Without a category 
-
- - -
-
- {{{$category->name}}} - - lastActionDate(); ?> - @if($active) - {{{$active->format('j F Y')}}} - @else - Never - @endif -
diff --git a/app/views/list/journals-full.blade.php b/app/views/list/journals-full.blade.php deleted file mode 100644 index 4979b6a428..0000000000 --- a/app/views/list/journals-full.blade.php +++ /dev/null @@ -1,120 +0,0 @@ -@if(is_object($journals) && method_exists($journals, 'links')) -{{$journals->links()}} -@endif - - - - - - - - - @if(!isset($hideBudget) || (isset($hideBudget) && $hideBudget=== false)) - - @endif - @if(!isset($hideCategory) || (isset($hideCategory) && $hideCategory=== false)) - - @endif - @if(!isset($hideBill) || (isset($hideBill) && $hideBill=== false)) - - @endif - - @foreach($journals as $journal) - @if(!isset($journal->transactions[1]) || !isset($journal->transactions[0])) - - - - - - - @else - - - - - - - - - @if(!isset($hideBudget) || (isset($hideBudget) && $hideBudget=== false)) - - @endif - @if(!isset($hideCategory) || (isset($hideCategory) && $hideCategory=== false)) - - @endif - @if(!isset($hideBill) || (isset($hideBill) && $hideBill=== false)) - - @endif - - - - @endif - - @endforeach -
 DescriptionAmountDateFromTo
-
- -
-
 {{{$journal->description}}}Invalid journal: Found {{$journal->transactions()->count()}} transaction(s)
-
- - -
-
- @if($journal->transactiontype->type == 'Withdrawal') - - @endif - @if($journal->transactiontype->type == 'Deposit') - - @endif - @if($journal->transactiontype->type == 'Transfer') - - @endif - @if($journal->transactiontype->type == 'Opening balance') - - @endif - - {{{$journal->description}}} - - @if($journal->transactiontype->type == 'Withdrawal') - {{Amount::formatTransaction($journal->transactions[1],false)}} - @endif - @if($journal->transactiontype->type == 'Deposit') - {{Amount::formatTransaction($journal->transactions[1],false)}} - @endif - @if($journal->transactiontype->type == 'Transfer') - {{Amount::formatTransaction($journal->transactions[1],false)}} - @endif - - {{$journal->date->format('j F Y')}} - - @if($journal->transactions[0]->account->accounttype->description == 'Cash account') - (cash) - @else - {{{$journal->transactions[0]->account->name}}} - @endif - - @if($journal->transactions[1]->account->accounttype->description == 'Cash account') - (cash) - @else - {{{$journal->transactions[1]->account->name}}} - @endif - - budgets[0]) ? $journal->budgets[0] : null; ?> - @if($budget) - {{{$budget->name}}} - @endif - - categories[0]) ? $journal->categories[0] : null; ?> - @if($category) - {{{$category->name}}} - @endif - - @if($journal->bill) - {{{$journal->bill->name}}} - @endif -
- -@if(is_object($journals) && method_exists($journals, 'links')) -{{$journals->links()}} -@endif diff --git a/app/views/list/journals-small.blade.php b/app/views/list/journals-small.blade.php deleted file mode 100644 index b1ba57dacf..0000000000 --- a/app/views/list/journals-small.blade.php +++ /dev/null @@ -1,44 +0,0 @@ - - - @foreach($journals as $journal) - - - - - - - - @endforeach - @if(isset($displaySum) && $displaySum === true) - - - - - - @endif -
- {{{$journal->description}}} - - transactions[1]->amount);?> - @if($journal->transactiontype->type == 'Withdrawal') - {{Amount::formatTransaction($journal->transactions[1],false)}} - @endif - @if($journal->transactiontype->type == 'Deposit') - {{Amount::formatTransaction($journal->transactions[1],false)}} - @endif - @if($journal->transactiontype->type == 'Transfer') - {{Amount::formatTransaction($journal->transactions[1],false)}} - @endif - - {{$journal->date->format('j F Y')}} - - @foreach($journal->transactions as $t) - @if(floatval($t->amount < 0)) - @if($t->account->accounttype->description == 'Cash account') - (cash) - @else - {{{$t->account->name}}} - @endif - @endif - @endforeach -
Sum{{Amount::format($tableSum)}}
diff --git a/app/views/list/journals-tiny.blade.php b/app/views/list/journals-tiny.blade.php deleted file mode 100644 index 9987e28ae4..0000000000 --- a/app/views/list/journals-tiny.blade.php +++ /dev/null @@ -1,35 +0,0 @@ - diff --git a/app/views/list/piggy-bank-events.blade.php b/app/views/list/piggy-bank-events.blade.php deleted file mode 100644 index e7527ed54e..0000000000 --- a/app/views/list/piggy-bank-events.blade.php +++ /dev/null @@ -1,33 +0,0 @@ - - - @if(isset($showPiggyBank) && $showPiggyBank === true) - - @endif - - - - @foreach($events as $event) - - @if(isset($showPiggyBank) && $showPiggyBank === true) - - @endif - - - - - @endforeach -
Piggy bankDateAmount
- {{{$event->piggyBank->name}}} - - @if(!is_null($event->transaction_journal_id)) - {{$event->date->format('j F Y')}} - @else - {{$event->date->format('j F Y')}} - @endif - - @if($event->amount < 0) - Removed {{Amount::format($event->amount*-1,false)}} - @else - Added {{Amount::format($event->amount,false)}} - @endif -
diff --git a/app/views/partials/date_nav.blade.php b/app/views/partials/date_nav.blade.php deleted file mode 100644 index 1230471443..0000000000 --- a/app/views/partials/date_nav.blade.php +++ /dev/null @@ -1,28 +0,0 @@ -
-
- - {{{\Session::get('period')}}} - - -
-
- - -
-
- -
- -
diff --git a/app/views/partials/flashes.blade.php b/app/views/partials/flashes.blade.php deleted file mode 100644 index e97d346de0..0000000000 --- a/app/views/partials/flashes.blade.php +++ /dev/null @@ -1,27 +0,0 @@ -@if(Session::has('success')) - -@endif - -@if(Session::has('info')) - -@endif - -@if(Session::has('warning')) - -@endif - -@if(Session::has('error')) - -@endif diff --git a/app/views/partials/menu.blade.php b/app/views/partials/menu.blade.php deleted file mode 100644 index 07c825d9e3..0000000000 --- a/app/views/partials/menu.blade.php +++ /dev/null @@ -1,190 +0,0 @@ - - diff --git a/app/views/piggy_banks/add.blade.php b/app/views/piggy_banks/add.blade.php deleted file mode 100644 index b9ee7be0d0..0000000000 --- a/app/views/piggy_banks/add.blade.php +++ /dev/null @@ -1,24 +0,0 @@ -
-{{Form::token()}} - -
diff --git a/app/views/piggy_banks/create.blade.php b/app/views/piggy_banks/create.blade.php deleted file mode 100644 index dea0c3573f..0000000000 --- a/app/views/piggy_banks/create.blade.php +++ /dev/null @@ -1,94 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -{{Form::open(['class' => 'form-horizontal','id' => 'store','url' => route('piggy_banks.store')])}} - -
-
-
-
- Mandatory fields -
-
- {{Form::ffText('name')}} - {{Form::ffSelect('account_id',$accounts,null,['label' => 'Save on account'])}} - {{Form::ffAmount('targetamount')}} - -
-
-

- -

-
-
- -
-
- Optional fields -
-
- {{Form::ffDate('targetdate')}} - {{Form::ffCheckbox('remind_me','1',false,['label' => 'Remind me'])}} - {{Form::ffSelect('reminder',$periods,'month',['label' => 'Remind every'])}} -
-
- - -
-
- Options -
-
- {{Form::ffOptionsList('create','piggy bank')}} -
-
- -
-
-{{-- - -

Mandatory fields

- -

Optional fields

- - -
- {{ Form::label('reminder', 'Remind you every', ['class' => 'col-sm-4 control-label'])}} -
- - - - @if($errors->has('reminder')) -

{{$errors->first('reminder')}}

- @else - Enter a number and a period and Firefly will remind you to add money - to this piggy bank every now and then. - @endif -
-
- - -
-
- -
-
- -
-
- -
-
-
-
---}} - -{{Form::close()}} -@stop diff --git a/app/views/piggy_banks/delete.blade.php b/app/views/piggy_banks/delete.blade.php deleted file mode 100644 index 790ee835bd..0000000000 --- a/app/views/piggy_banks/delete.blade.php +++ /dev/null @@ -1,37 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $piggyBank) }} -{{Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('piggy_banks.destroy',$piggyBank->id)])}} -
-
-
-
- Delete piggy bank "{{{$piggyBank->name}}}" -
-
-

- Are you sure? -

- -

- - Cancel -

-
-
-
-
- -
-
-
-
- -
-
-
-
- - -{{Form::close()}} -@stop diff --git a/app/views/piggy_banks/edit.blade.php b/app/views/piggy_banks/edit.blade.php deleted file mode 100644 index 6532a61a27..0000000000 --- a/app/views/piggy_banks/edit.blade.php +++ /dev/null @@ -1,94 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $piggyBank) }} -{{Form::model($piggyBank, ['class' => 'form-horizontal','id' => 'update','url' => route('piggy_banks.update',$piggyBank->id)])}} - -
-
-
-
- Mandatory fields -
-
- {{Form::ffText('name')}} - {{Form::ffSelect('account_id',$accounts,null,['label' => 'Save on account'])}} - {{Form::ffAmount('targetamount')}} - -
-
-

- -

-
-
- -
-
- Optional fields -
-
- {{Form::ffDate('targetdate')}} - {{Form::ffCheckbox('remind_me','1',$preFilled['remind_me'],['label' => 'Remind me'])}} - {{Form::ffSelect('reminder',$periods,$preFilled['reminder'],['label' => 'Remind every'])}} -
-
- - -
-
- Options -
-
- {{Form::ffOptionsList('update','piggy bank')}} -
-
- -
-
-{{-- - -

Mandatory fields

- -

Optional fields

- - -
- {{ Form::label('reminder', 'Remind you every', ['class' => 'col-sm-4 control-label'])}} -
- - - - @if($errors->has('reminder')) -

{{$errors->first('reminder')}}

- @else - Enter a number and a period and Firefly will remind you to add money - to this piggy bank every now and then. - @endif -
-
- - -
- - -
-
- -
-
- -
-
-
-
---}} - -{{Form::close()}} -@stop diff --git a/app/views/piggy_banks/index.blade.php b/app/views/piggy_banks/index.blade.php deleted file mode 100644 index 73b7744545..0000000000 --- a/app/views/piggy_banks/index.blade.php +++ /dev/null @@ -1,132 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -
- -
-@foreach($piggyBanks as $piggyBank) -
-
-
-
- {{{$piggyBank->name}}} - - -
-
- - -
-
- -
-
-
- -
-
- @if($piggyBank->leftToSave > 0) - - @endif - -
-
- -
-
- - -
-
- -
- {{Amount::format($piggyBank->savedSoFar,true)}} -
- -
-
-
percentage == 100) - class="progress-bar progress-bar-success" - @else - class="progress-bar progress-bar-info" - @endif - role="progressbar" aria-valuenow="{{$piggyBank->percentage}}" aria-valuemin="0" aria-valuemax="100" style="min-width: 40px;width: {{$piggyBank->percentage}}%;"> - {{$piggyBank->percentage}}% -
-
-
- -
- {{Amount::format($piggyBank->targetamount,true)}} -
- -
- @if($piggyBank->leftToSave > 0) - {{Amount::format($piggyBank->leftToSave)}} - @endif -
-
-
-
-
-
-@endforeach -
- -
- -
-
-
-
- Account status -
-
- - - - - - - - - - @foreach($accounts as $id => $info) - - - - - - - - - @endforeach -
AccountBalanceLeft for piggy banksSum of piggy banksSaved so farLeft to save
{{{$info['name']}}}{{Amount::format($info['balance'])}}{{Amount::format($info['leftForPiggyBanks'])}}{{Amount::format($info['sumOfTargets'])}}{{Amount::format($info['sumOfSaved'])}}{{Amount::format($info['leftToSave'])}}
-
-
-
-
- - - - -@stop -@section('scripts') -{{HTML::script('assets/javascript/firefly/piggy_banks.js')}} -@stop diff --git a/app/views/piggy_banks/remove.blade.php b/app/views/piggy_banks/remove.blade.php deleted file mode 100644 index 90129fecc6..0000000000 --- a/app/views/piggy_banks/remove.blade.php +++ /dev/null @@ -1,24 +0,0 @@ -
-{{Form::token()}} - -
diff --git a/app/views/piggy_banks/show.blade.php b/app/views/piggy_banks/show.blade.php deleted file mode 100644 index f11b4a74ac..0000000000 --- a/app/views/piggy_banks/show.blade.php +++ /dev/null @@ -1,125 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $piggyBank) }} -
-
-
-
- Events -
-
-
-
-
-
-
-
-
- Details - - -
-
- - -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - @if(!is_null($piggyBank->reminder)) - - - - - @endif - - - - - - - - -
Account{{{$piggyBank->account->name}}}
Target amount{{Amount::format($piggyBank->targetamount)}}
Saved so far{{Amount::format($piggyBank->currentRelevantRep()->currentamount)}}
Left to save{{Amount::format($piggyBank->targetamount-$piggyBank->currentRelevantRep()->currentamount)}}
Start date - @if(is_null($piggyBank->startdate)) - No start date - @endif - @if(is_object($piggyBank->startdate)) - {{$piggyBank->startdate->format('jS F Y')}} - @endif -
Target date - @if(is_null($piggyBank->targetdate)) - No target date - @endif - @if(is_object($piggyBank->targetdate)) - {{$piggyBank->targetdate->format('jS F Y')}} - @endif -
Reminder - @if(intval($piggyBank->remind_me) == 0) - (no reminder) - @else - Every - @if($piggyBank->reminder_skip != 0) - {{$piggyBank->reminder_skip}} - @endif - {{$piggyBank->reminder}}(s) - @endif -
Reminders left(in progress...)
Expected amount per reminder(in progress...)
-
-
-
-
- Table -
-
- @include('list.piggy-bank-events') -
-
-
- -
-@stop - -@section('scripts') - - - - -{{HTML::script('assets/javascript/firefly/gcharts.options.js')}} -{{HTML::script('assets/javascript/firefly/gcharts.js')}} -{{HTML::script('assets/javascript/firefly/piggy_banks.js')}} -@stop diff --git a/app/views/preferences/index.blade.php b/app/views/preferences/index.blade.php deleted file mode 100644 index 9a567a97e1..0000000000 --- a/app/views/preferences/index.blade.php +++ /dev/null @@ -1,105 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} - -{{Form::open(['class' => 'form-horizontal','id' => 'preferences'])}} - -
-
-
-
- Home screen accounts -
-
-

Which accounts should be displayed on the home page?

- @foreach($accounts as $account) -
-
-
- -
-
-
- @endforeach -
-
-
-
- Budget settings -
-
-

- What's the maximum amount of money a budget envelope may contain? -

- {{Form::ffAmount('budgetMaximum',$budgetMaximum,['label' => 'Budget maximum'])}} -
-
- -
-
-
-
- Home view range -
-
-

By default, Firefly will show you one month of data.

-
- -
- -
- -
- -
- -
- -
- -
- -
- -
-
-
-
-
-
-
-
-
- -
-
-
-
- - -{{Form::close()}} - -@stop -@section('scripts') -@stop diff --git a/app/views/profile/change-password.blade.php b/app/views/profile/change-password.blade.php deleted file mode 100644 index 3b15e68988..0000000000 --- a/app/views/profile/change-password.blade.php +++ /dev/null @@ -1,44 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -
-
-
-
- Change your password -
-
- {{Form::open(['class' => 'form-horizontal','id' => 'change-password'])}} -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
-
-
- -
-
- {{Form::close()}} -
-
-
-
-@stop -@section('scripts') -@stop diff --git a/app/views/profile/index.blade.php b/app/views/profile/index.blade.php deleted file mode 100644 index ef0440ffd5..0000000000 --- a/app/views/profile/index.blade.php +++ /dev/null @@ -1,18 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -
-
-
-
- Options -
- -
-
-
-@stop -@section('scripts') -@stop diff --git a/app/views/related/relate.blade.php b/app/views/related/relate.blade.php deleted file mode 100644 index d3cb6d62d3..0000000000 --- a/app/views/related/relate.blade.php +++ /dev/null @@ -1,27 +0,0 @@ - diff --git a/app/views/reminders/show.blade.php b/app/views/reminders/show.blade.php deleted file mode 100644 index d0fcd29f7a..0000000000 --- a/app/views/reminders/show.blade.php +++ /dev/null @@ -1,32 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $reminder) }} -
-
-
-
- A reminder about - @if(get_class($reminder->remindersable) == 'PiggyBank') - your piggy bank labelled "{{{$reminder->remindersable->name}}}" - @endif -
-
-

- @if(get_class($reminder->remindersable) == 'Piggybank') - Somewhere between {{$reminder->startdate->format('j F Y')}} and {{$reminder->enddate->format('j F Y')}} you - should deposit {{Amount::format($amount)}} in piggy bank {{{$reminder->remindersable->name}}} - in order to make your goal of saving {{Amount::format($reminder->remindersable->targetamount)}} on {{$reminder->remindersable->targetdate->format('j F Y')}} - - @endif -

-

- I want to do this - I already did this - Not this time - -

-
-
-
-
-@stop diff --git a/app/views/repeatedExpense/create.blade.php b/app/views/repeatedExpense/create.blade.php deleted file mode 100644 index 374579360d..0000000000 --- a/app/views/repeatedExpense/create.blade.php +++ /dev/null @@ -1,97 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -{{Form::open(['class' => 'form-horizontal','id' => 'store','url' => route('repeated.store')])}} - -
-
-
-
- Mandatory fields -
-
- {{Form::ffText('name')}} - {{Form::ffSelect('account_id',$accounts,null,['label' => 'Save on account'])}} - {{Form::ffAmount('targetamount')}} - {{Form::ffDate('targetdate',null,['label' => 'First target date'])}} - {{Form::ffSelect('rep_length',$periods,'month',['label' => 'Repeats every'])}} - {{Form::ffInteger('rep_every',0,['label' => 'Skip period'])}} - {{Form::ffInteger('rep_times',0,['label' => 'Repeat times'])}} -
-
-

- -

-
-
- -
-
- Optional fields -
-
- - {{Form::ffCheckbox('remind_me','1',false,['label' => 'Remind me'])}} - {{Form::ffSelect('reminder',$periods,'month',['label' => 'Remind every'])}} -
-
- - -
-
- Options -
-
- {{Form::ffOptionsList('create','repeated expense')}} -
-
- -
-
-{{-- - -

Mandatory fields

- -

Optional fields

- - -
- {{ Form::label('reminder', 'Remind you every', ['class' => 'col-sm-4 control-label'])}} -
- - - - @if($errors->has('reminder')) -

{{$errors->first('reminder')}}

- @else - Enter a number and a period and Firefly will remind you to add money - to this piggy bank every now and then. - @endif -
-
- - - - - -
-
- -
-
- -
-
-
-
---}} - -{{Form::close()}} -@stop diff --git a/app/views/repeatedExpense/delete.blade.php b/app/views/repeatedExpense/delete.blade.php deleted file mode 100644 index 518278e74a..0000000000 --- a/app/views/repeatedExpense/delete.blade.php +++ /dev/null @@ -1,37 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $repeatedExpense) }} -{{Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('repeated.destroy',$repeatedExpense->id)])}} -
-
-
-
- Delete repeated expense "{{{$repeatedExpense->name}}}" -
-
-

- Are you sure? -

- -

- - Cancel -

-
-
-
-
- -
-
-
-
- -
-
-
-
- - -{{Form::close()}} -@stop diff --git a/app/views/repeatedExpense/edit.blade.php b/app/views/repeatedExpense/edit.blade.php deleted file mode 100644 index 8464cf0866..0000000000 --- a/app/views/repeatedExpense/edit.blade.php +++ /dev/null @@ -1,97 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $repeatedExpense) }} -{{Form::model($repeatedExpense, ['class' => 'form-horizontal','id' => 'update','url' => route('repeated.update',$repeatedExpense->id)])}} - -
-
-
-
- Mandatory fields -
-
- {{Form::ffText('name')}} - {{Form::ffSelect('account_id',$accounts,null,['label' => 'Save on account'])}} - {{Form::ffAmount('targetamount')}} - {{Form::ffDate('targetdate',null,['label' => 'First target date'])}} - {{Form::ffSelect('rep_length',$periods,null,['label' => 'Repeats every'])}} - {{Form::ffInteger('rep_every',null,['label' => 'Skip period'])}} - {{Form::ffInteger('rep_times',null,['label' => 'Repeat times'])}} - -
-
-

- -

-
-
- -
-
- Optional fields -
-
- {{Form::ffCheckbox('remind_me','1',$preFilled['remind_me'],['label' => 'Remind me'])}} - {{Form::ffSelect('reminder',$periods,$preFilled['reminder'],['label' => 'Remind every'])}} -
-
- - -
-
- Options -
-
- {{Form::ffOptionsList('update','piggy bank')}} -
-
- -
-
-{{-- - -

Mandatory fields

- -

Optional fields

- - -
- {{ Form::label('reminder', 'Remind you every', ['class' => 'col-sm-4 control-label'])}} -
- - - - @if($errors->has('reminder')) -

{{$errors->first('reminder')}}

- @else - Enter a number and a period and Firefly will remind you to add money - to this piggy bank every now and then. - @endif -
-
- - - - - -
-
- -
-
- -
-
-
-
---}} - -{{Form::close()}} -@stop diff --git a/app/views/repeatedExpense/index.blade.php b/app/views/repeatedExpense/index.blade.php deleted file mode 100644 index a25336619a..0000000000 --- a/app/views/repeatedExpense/index.blade.php +++ /dev/null @@ -1,69 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -
- -
- -@foreach($expenses as $entry) -
-
-
-
- {{{$entry->name}}} - ({{Amount::format($entry->targetamount)}}) - - -
-
- - -
-
-
-
-
-
- @if(Steam::percentage($entry,$entry->currentRep) > 30) - {{Amount::format($entry->currentRep->currentamount,false)}} - @endif -
- @if(Steam::percentage($entry,$entry->currentRep) <= 30) -  {{Amount::format($entry->currentRep->currentamount,false)}} - @endif -
-
- -
-
-
- @endforeach - -
- -
- - - - -@stop -@section('scripts') -@stop diff --git a/app/views/repeatedExpense/show.blade.php b/app/views/repeatedExpense/show.blade.php deleted file mode 100644 index f5678bb688..0000000000 --- a/app/views/repeatedExpense/show.blade.php +++ /dev/null @@ -1,61 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $repeatedExpense) }} -
-
- @foreach($repetitions as $rep) - bars->count()) == 0 ? 1 : floor(12 / $rep->bars->count()); - ?> - - -
-
- Repetition from {{$rep->startdate->format('j F Y')}} to {{$rep->targetdate->format('j F Y')}} -
-
-

- Target amount: {{Amount::format($repeatedExpense->targetamount)}}. Currently saved: {{Amount::format($rep->currentamount)}}. -

-
- @foreach($rep->bars as $bar) -
-
- -
- @if($bar->percentage() > 50 && $bar->percentage() == 100) - @if($bar->hasReminder() && $bar->getReminder()->active == 1) - - @endif - @if($bar->hasReminder() && $bar->getReminder()->active == 0 && $bar->getReminder()->notnow == 0) - - @endif - @if($bar->hasReminder() && $bar->getReminder()->active == 0 && $bar->getReminder()->notnow == 1) - - @endif - @endif - @if($bar->percentage() > 50 && $bar->percentage() < 100) - {{Amount::format($rep->currentamount,false)}} - @endif -
-
-
-

- {{$bar->getStartDate()->format('j F Y')}} — {{$bar->getTargetDate()->format('j F Y')}} -

- -
- @endforeach -
-
-
- @endforeach -
-
-@stop diff --git a/app/views/reports/budget.blade.php b/app/views/reports/budget.blade.php deleted file mode 100644 index bab3a63918..0000000000 --- a/app/views/reports/budget.blade.php +++ /dev/null @@ -1,156 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $date) }} -
-
- - - - - - - - @foreach($accounts as $account) - - - - - - - @endforeach -
AccountStart of monthCurrent balanceSpent
{{{$account->name}}}{{Amount::format($account->startBalance)}}{{Amount::format($account->endBalance)}}{{Amount::format($account->startBalance - $account->endBalance,false)}}
-
-
-
-
- - - - - - @foreach($accounts as $account) - - id] = 0; - ?> - @endforeach - - - @foreach($budgets as $id => $budget) - - - - - @foreach($accounts as $account) - @if(isset($account->budgetInformation[$id])) - - budgetInformation[$id]['amount']); - $accountSums[$account->id] += floatval($account->budgetInformation[$id]['amount']); - ?> - @else - - @endif - @endforeach - - - - @endforeach - - - @foreach($accounts as $account) - @if(isset($account->budgetInformation[0])) - - @else - - @endif - @endforeach - - - - - @foreach($accounts as $account) - - @endforeach - - - - - - @foreach($accounts as $account) - id] += $account->balancedAmount; - ?> - @if(isset($account->budgetInformation[0])) - - @else - - @endif - @endforeach - - - - - @foreach($accounts as $account) - - @endforeach - - - - - @foreach($accounts as $account) - - @endforeach - - - -
Budgets{{{$account->name}}} - Left in budget -
{{{$budget['name']}}} - @if($id == 0) - - @endif - {{Amount::format($budget['amount'])}} - @if($id == 0) - {{Amount::format($account->budgetInformation[$id]['amount'])}} - @else - {{Amount::format($account->budgetInformation[$id]['amount'])}} - @endif - {{Amount::format(0)}}{{Amount::format($budget['amount'] + $budget['spent'])}}{{Amount::format($budget['amount'] + $spent)}}
Without budget - - - {{Amount::format($account->budgetInformation[0]['amount'])}} - {{Amount::format(0)}} 
Balanced by transfers - {{Amount::format($account->balancedAmount)}} -  
Left unbalanced - {{Amount::format($account->budgetInformation[0]['amount'] + $account->balancedAmount)}} - {{Amount::format(0)}} 
Sum{{Amount::format($accountSums[$account->id])}} 
Expected balance{{Amount::format($account->startBalance + $accountSums[$account->id])}} 
-
-
- - - - -@stop -@section('scripts') -{{HTML::script('assets/javascript/firefly/reports.js')}} -@stop diff --git a/app/views/reports/index.blade.php b/app/views/reports/index.blade.php deleted file mode 100644 index 75980f7376..0000000000 --- a/app/views/reports/index.blade.php +++ /dev/null @@ -1,50 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -
-
-
-
- Yearly reports -
-
-
    - @foreach($years as $year) -
  • {{$year}}
  • - @endforeach -
-
-
-
- -
-
-
- Monthly reports -
-
- -
-
-
- -
-
-
- Budget reports -
-
- -
-
-
-
-@stop diff --git a/app/views/reports/month.blade.php b/app/views/reports/month.blade.php deleted file mode 100644 index 6943a09ba8..0000000000 --- a/app/views/reports/month.blade.php +++ /dev/null @@ -1,231 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $date) }} -
-
-
-
Income
- - - @foreach($income as $entry) - - - - - - - @endforeach - @if(isset($displaySum) && $displaySum === true) - - - - - - @endif -
- {{{$entry->description}}} - - amount);?> - @if($entry->type == 'Withdrawal') - {{Amount::format($entry->amount,false)}} - @endif - @if($entry->type == 'Deposit') - {{Amount::format($entry->amount,false)}} - @endif - @if($entry->type == 'Transfer') - {{Amount::format($entry->amount,false)}} - @endif - - {{$entry->date->format('j F Y')}} - - {{{$entry->name}}} -
Sum{{Amount::format($tableSum)}}
-
-
-
-
-
Expenses (top 10)
- - - @foreach($expenses as $id => $expense) - - - @if($id > 0) - - @else - - @endif - - - @endforeach - - - - -
{{{$expense['name']}}}{{{$expense['name']}}}{{Amount::format($expense['amount'])}}
Sum{{Amount::format($sum)}}
-
-
-
-
-
Sums
- transactions[1]->amount); - } - ?> - - - - - - - - - - - - - -
In{{Amount::format($in)}}
Out{{Amount::format($sum)}}
Difference{{Amount::format($in - $sum)}}
-
-
-
-
-
-
-
Budgets
- - - - - - - - - @foreach($budgets as $id => $budget) - - - - - - - - @endforeach - - - - - - -
BudgetEnvelopeSpentLeft
- @if($id > 0) - {{{$budget['name']}}} - @else - {{{$budget['name']}}} - @endif - {{Amount::format($budget['amount'])}}{{Amount::format($budget['spent'],false)}}{{Amount::format($budget['amount'] + $budget['spent'])}}
Sum{{Amount::format($sumEnvelope)}}{{Amount::format($sumSpent)}}{{Amount::format($sumLeft)}}
-
-
-
-
-
Categories
- - - - - - - @foreach($categories as $id => $category) - - - - - - @endforeach - - - - -
CategorySpent
- @if($id > 0) - {{{$category['name']}}} - @else - {{{$category['name']}}} - @endif - {{Amount::format($category['amount'],false)}}
Sum{{Amount::format($sum)}}
-
-
-
-
-
-
-
Accounts
- - - @foreach($accounts as $id => $account) - - - - - - - - @endforeach - - - - - - -
{{{$account['name']}}}{{Amount::format($account['startBalance'])}}{{Amount::format($account['endBalance'])}}{{Amount::format($account['difference'])}}
Sum{{Amount::format($sumStart)}}{{Amount::format($sumEnd)}}{{Amount::format($sumDiff)}}
-
-
-
-
-
-
-
Piggy banks
-
Body
-
-
-
-
-
Repeated expenses
-
Body
-
-
-
-
-
-
-
Bills
-
Body
-
-
-
-
-
-
-
Outside of budgets
-
Body
-
-
-
-@stop diff --git a/app/views/reports/year.blade.php b/app/views/reports/year.blade.php deleted file mode 100644 index f82304d469..0000000000 --- a/app/views/reports/year.blade.php +++ /dev/null @@ -1,170 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $date) }} -
-
-
-
- Income vs. expenses -
-
-
-
-
-
-
-
-
- Income vs. expenses -
-
-
-
-
-
-
- -
-
-
-
- Account balance -
- - - @foreach($balances as $balance) - - - - - - - - @endforeach - - - - - - -
- {{{$balance['account']->name}}} - @if($balance['shared']) - shared - @endif - {{Amount::format($balance['start'])}}{{Amount::format($balance['end'])}}{{Amount::format($balance['end']-$balance['start'])}}
Sum of sums{{Amount::format($start)}}{{Amount::format($end)}}{{Amount::format($diff)}}
-
- -
-
- Income vs. expense -
- amount); - } - foreach($groupedExpenses as $exp) { - $expenseSum += floatval($exp['amount']); - } - $incomeSum = floatval($incomeSum*-1); - - ?> - - - - - - - - - - - - - - -
In{{Amount::format($incomeSum)}}
Out{{Amount::format($expenseSum*-1)}}
Difference{{Amount::format($incomeSum - $expenseSum)}}
-
-
-
-
-
- Income -
- - - @foreach($groupedIncomes as $income) - amount)*-1;?> - - - - - @endforeach - - - - -
{{{$income->name}}}{{Amount::format(floatval($income->amount)*-1)}}
Sum{{Amount::format($sum)}}
-
-
-
-
-
- Expenses -
- - - @foreach($groupedExpenses as $id => $expense) - - - - - - @endforeach - - - - -
{{{$expense['name']}}}{{Amount::format(floatval($expense['amount'])*-1)}}
Sum{{Amount::format($sum)}}
-
-
-
-
-
-
-
- Budgets -
-
-
-
-
-
-
- - -@stop -@section('scripts') - - -{{HTML::script('assets/javascript/firefly/gcharts.options.js')}} -{{HTML::script('assets/javascript/firefly/gcharts.js')}} - - - -{{HTML::script('assets/javascript/firefly/reports.js')}} - -@stop diff --git a/app/views/search/index.blade.php b/app/views/search/index.blade.php deleted file mode 100644 index c6f6f16a4b..0000000000 --- a/app/views/search/index.blade.php +++ /dev/null @@ -1,106 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $query) }} -@if(!is_null($query)) -
- @if(isset($result['transactions']) && $result['transactions']->count() > 0) -
-
-
- Transactions ({{$result['transactions']->count()}}) -
-
- @include('list.journals-small',['journals' => $result['transactions']]) -
-
-
- @endif - @if(isset($result['categories']) && $result['categories']->count() > 0) -
-
-
- Categories ({{$result['categories']->count()}}) -
-
-
- @foreach($result['categories'] as $category) - - {{{$category->name}}} - - @endforeach -
-
-
-
- @endif - @if(isset($result['tags']) && $result['tags']->count() > 0) -
-
-
- Tags ({{$result['tags']->count()}}) -
-
-

Bla bla

-
-
-
- @endif - @if(isset($result['accounts']) && $result['accounts']->count() > 0) -
-
-
- Accounts ({{$result['accounts']->count()}}) -
-
-
- @foreach($result['accounts'] as $account) - - {{{$account->name}}} - - @endforeach -
-
-
-
- @endif - @if(isset($result['budgets']) && $result['budgets']->count() > 0) -
-
-
- Budgets ({{$result['budgets']->count()}}) -
-
-
- @foreach($result['budgets'] as $budget) - - {{{$budget->name}}} - - @endforeach -
-
-
-
- @endif - -
-@endif - - - -@stop -@section('scripts') - -@stop diff --git a/app/views/transactions/create.blade.php b/app/views/transactions/create.blade.php deleted file mode 100644 index 5585ddb4c6..0000000000 --- a/app/views/transactions/create.blade.php +++ /dev/null @@ -1,96 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $what) }} -{{Form::open(['class' => 'form-horizontal','id' => 'store','url' => route('transactions.store',$what)])}} -{{Form::hidden('reminder',Input::get('reminder_id'))}} - -
-
- -
-
- Mandatory fields -
-
- - {{Form::ffText('description')}} - @if($what == 'deposit' || $what == 'withdrawal') - {{Form::ffSelect('account_id',$accounts)}} - @endif - - - - @if($what == 'withdrawal') - {{Form::ffText('expense_account')}} - @endif - - - @if($what == 'deposit') - {{Form::ffText('revenue_account')}} - @endif - - - - @if($what == 'transfer') - {{Form::ffSelect('account_from_id',$accounts)}} - {{Form::ffSelect('account_to_id',$accounts)}} - @endif - - - - {{Form::ffAmount('amount')}} - - - {{Form::ffDate('date', date('Y-m-d'))}} -
-
-

- -

- -
-
- -
-
- Optional fields -
-
- - @if($what == 'withdrawal') - {{Form::ffSelect('budget_id',$budgets,0)}} - @endif - - {{Form::ffText('category')}} - - - - - - @if($what == 'transfer' && count($piggies) > 0) - {{Form::ffSelect('piggy_bank_id',$piggies)}} - @endif -
-
- -
-
- Options -
-
- {{Form::ffOptionsList('create','transaction')}} -
-
-
-
- - -{{Form::close()}} - -@stop -@section('scripts') -{{HTML::script('assets/javascript/typeahead/bootstrap3-typeahead.min.js')}} -{{HTML::script('assets/javascript/firefly/transactions.js')}} -@stop diff --git a/app/views/transactions/delete.blade.php b/app/views/transactions/delete.blade.php deleted file mode 100644 index aef2335fc8..0000000000 --- a/app/views/transactions/delete.blade.php +++ /dev/null @@ -1,43 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $journal) }} -{{Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('transactions.destroy',$journal->id)])}} - -
-
- -
-
- Destroy "{{{$journal->description}}}" -
-
-

- Deleting stuff from Firefly is permanent. This action will remove the transaction and all - associated data. -

-

- This action will not destroy categories, piggy banks, accounts, etc. -

-

- Are you sure? -

-
- - @if($journal->transactiontype->type == 'Withdrawal') - Cancel - @endif - @if($journal->transactiontype->type == 'Deposit') - Cancel - @endif - @if($journal->transactiontype->type == 'Transfer') - Cancel - @endif -
-
-
-
-
- -{{Form::close()}} - -@stop diff --git a/app/views/transactions/edit.blade.php b/app/views/transactions/edit.blade.php deleted file mode 100644 index 0996995257..0000000000 --- a/app/views/transactions/edit.blade.php +++ /dev/null @@ -1,96 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $journal) }} -{{Form::open(['class' => 'form-horizontal','id' => 'update','url' => route('transactions.update',$journal->id)])}} - - -
-
- -
-
- Mandatory fields -
-
- - {{Form::ffText('description',$journal->description)}} - - - @if($what == 'deposit' || $what == 'withdrawal') - {{Form::ffSelect('account_id',$accounts,$data['account_id'])}} - @endif - - - @if($what == 'withdrawal') - {{Form::ffText('expense_account',$data['expense_account'])}} - @endif - - @if($what == 'deposit') - {{Form::ffText('revenue_account',$data['revenue_account'])}} - @endif - - - @if($what == 'transfer') - {{Form::ffSelect('account_from_id',$accounts,$data['account_from_id'])}} - {{Form::ffSelect('account_to_id',$accounts,$data['account_to_id'])}} - @endif - - - {{Form::ffAmount('amount',$data['amount'],['currency' => $journal->transactionCurrency])}} - - - {{Form::ffDate('date',$data['date'])}} -
-
- -

- -

- -
-
- -
-
- Optional fields -
-
- - @if($what == 'withdrawal') - {{Form::ffSelect('budget_id',$budgets,$data['budget_id'])}} - @endif - - {{Form::ffText('category',$data['category'])}} - - - - - @if($what == 'transfer' && count($piggies) > 0) - {{Form::ffSelect('piggy_bank_id',$piggies,$data['piggy_bank_id'])}} - @endif -
-
- - -
-
- Options -
-
- {{Form::ffOptionsList('update','transaction')}} -
-
-
-
- - -{{Form::close()}} - - -@stop -@section('scripts') -{{HTML::script('assets/javascript/typeahead/bootstrap3-typeahead.min.js')}} -{{HTML::script('assets/javascript/firefly/transactions.js')}} -@stop diff --git a/app/views/transactions/index.blade.php b/app/views/transactions/index.blade.php deleted file mode 100644 index 0df468cb34..0000000000 --- a/app/views/transactions/index.blade.php +++ /dev/null @@ -1,16 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $what) }} -
-
-
-
- {{{$subTitle}}} -
- @include('list.journals-full') -
-
-
- - -@stop diff --git a/app/views/transactions/show.blade.php b/app/views/transactions/show.blade.php deleted file mode 100644 index 2bdc086cf1..0000000000 --- a/app/views/transactions/show.blade.php +++ /dev/null @@ -1,131 +0,0 @@ -@extends('layouts.default') -@section('content') -{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $journal) }} -
-
-
-
- Metadata -
-
- - - - - - - - - - - - - - - - - - @foreach($journal->budgets()->get() as $budget) - - - - - @endforeach - @foreach($journal->categories()->get() as $category) - - - - - @endforeach - -
Date{{{$journal->date->format('jS F Y')}}}
Currency{{{$journal->transactioncurrency->code}}}
Type{{{$journal->transactiontype->type}}}
Completed - @if($journal->completed == 1) - Yes - @else - No - @endif -
{{$budget->class}}{{{$budget->name}}}
{{$category->class}}{{{$category->name}}}
-
-
- - @if(count($journal->piggyBankEvents) > 0) -
-
- Piggy banks -
-
- @include('list.piggy-bank-events',['events' => $journal->piggyBankEvents,'showPiggyBank' => true]) -
-
- @endif -
-
- Related transactions -
- @if($members->count() == 0) -
-

- No related transactions -

-
- @else - - @foreach($members as $jrnl) - - - - - - @endforeach -
{{{$jrnl->description}}}{{Amount::formatJournal($jrnl, $jrnl->getAmount())}}
- @endif - -
-
-
- - @foreach($journal->transactions as $t) -
-
- {{{$t->account->name}}}
{{{$t->account->accounttype->description}}} -
-
- - - - - - - - - - @if(!is_null($t->description)) - - - - - @endif -
Amount{{Amount::formatTransaction($t)}}
New balance{{Amount::format($t->before)}} → {{Amount::format($t->after)}}
Description{{{$t->description}}}
-
-
- @endforeach -
-
- -
-
- -
-
- -@stop -@section('scripts') -{{HTML::script('assets/javascript/firefly/transactions.js')}} -{{HTML::script('assets/javascript/firefly/related-manager.js')}} -@stop diff --git a/app/views/user/login.blade.php b/app/views/user/login.blade.php deleted file mode 100644 index a2efbcfa9e..0000000000 --- a/app/views/user/login.blade.php +++ /dev/null @@ -1,39 +0,0 @@ -@extends('layouts.guest') -@section('content') -
-
- -
-
-@stop diff --git a/app/views/user/register.blade.php b/app/views/user/register.blade.php deleted file mode 100644 index a7a11f07fc..0000000000 --- a/app/views/user/register.blade.php +++ /dev/null @@ -1,33 +0,0 @@ -@extends('layouts.guest') -@section('content') -
-
- -
-
-@stop diff --git a/app/views/user/registered.blade.php b/app/views/user/registered.blade.php deleted file mode 100644 index ce4e3e056e..0000000000 --- a/app/views/user/registered.blade.php +++ /dev/null @@ -1,19 +0,0 @@ -@extends('layouts.guest') -@section('content') -
-
-

Firefly
- Password sent! -

-
-
- -
-
-

- You're about to get an e-mail. Use the contents to log in. -

-
-
- -@stop diff --git a/app/views/user/remindMe-html.blade.php b/app/views/user/remindMe-html.blade.php deleted file mode 100644 index 16f09cc04d..0000000000 --- a/app/views/user/remindMe-html.blade.php +++ /dev/null @@ -1,19 +0,0 @@ - - - - - -

- Hi! -

-

- To get a new password, please verify your e-mail address. -

-

- Cya! -

- - - diff --git a/app/views/user/remindMe-text.blade.php b/app/views/user/remindMe-text.blade.php deleted file mode 100644 index 8d1980a3e4..0000000000 --- a/app/views/user/remindMe-text.blade.php +++ /dev/null @@ -1,5 +0,0 @@ -Hi! - -To get a new password, please verify your e-mail address: {{route('reset',$reset)}} - -Cya! diff --git a/app/views/user/remindMe.blade.php b/app/views/user/remindMe.blade.php deleted file mode 100644 index 18b48954ac..0000000000 --- a/app/views/user/remindMe.blade.php +++ /dev/null @@ -1,27 +0,0 @@ -@extends('layouts.guest') -@section('content') -
-
- -
-
-@stop diff --git a/app/views/user/verification-pending.blade.php b/app/views/user/verification-pending.blade.php deleted file mode 100644 index a10b2d53da..0000000000 --- a/app/views/user/verification-pending.blade.php +++ /dev/null @@ -1,19 +0,0 @@ -@extends('layouts.guest') -@section('content') -
-
-

Firefly
- Verification pending -

-
-
- -
-
-

- You're about to get an e-mail. Please follow its instructions. -

-
-
- -@stop diff --git a/build/logs/.gitignore b/build/logs/.gitignore deleted file mode 100644 index b81c7954b7..0000000000 --- a/build/logs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.xml \ No newline at end of file diff --git a/composer.json b/composer.json index f06c862101..92e2d53ced 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { "name": "grumpydictator/firefly-iii", "description": "A web-application to manage your finances. This version will replace grumpydictator/firefly when it's finished.", - "license": "MIT", "keywords": ["finance", "finances", "manager", "euro", "laravel", "money", "financials", "budgets", "transactions", "transfers", "management"], + "license": "MIT", "homepage": "https://github.com/JC5/firefly-iii", "type": "project", "authors": [ @@ -20,57 +20,45 @@ }, "require": { - "laravel/framework": "4.2.*", - "davejamesmiller/laravel-breadcrumbs": "2.*", + "laravel/framework": "5.0.*", + "davejamesmiller/laravel-breadcrumbs": "@stable", "grumpydictator/gchart": "1.*", - "michelf/php-markdown": "1.*", - "watson/validating": "0.10.*", - "doctrine/dbal": "~2.3" + "michelf/php-markdown": "@stable", + "watson/validating": "dev-master", + "doctrine/dbal": "~2.5" }, "require-dev": { "barryvdh/laravel-debugbar": "@stable", "barryvdh/laravel-ide-helper": "@stable", - "satooshi/php-coveralls": "*", - "mockery/mockery": "@stable", - "league/factory-muffin": "~2.1", - "codeception/codeception": "*", - "codeception/c3": "2.*", - "sebastian/phpcpd": "*", - "sebastian/phpdcd": "*", - "codeception/phpbuiltinserver": "*", - "codeception/specify": "*", - "codeception/verify": "*", - "fzaninotto/faker": "1.*", - "codeclimate/php-test-reporter": "dev-master" - + "phpunit/phpunit": "~4.0", + "phpspec/phpspec": "~2.1" }, "autoload": { "classmap": [ - "app/commands", - "app/controllers", - "app/models", - "app/database/migrations", - "app/database/seeds", - "app/tests/TestCase.php" + "database" ], - "psr-0": { - "Firefly": "app/lib/" + "psr-4": { + "App\\": "app/" } }, + "autoload-dev": { + "classmap": [ + "tests/TestCase.php" + ] + }, "scripts": { "post-install-cmd": [ "php artisan clear-compiled", - "php artisan optimize", - "Codeception\\c3\\Installer::copyC3ToRoot" + "php artisan optimize" ], "post-update-cmd": [ "php artisan clear-compiled", - "php artisan optimize", - "Codeception\\c3\\Installer::copyC3ToRoot" + "php artisan optimize" ], "post-create-project-cmd": [ + "php -r \"copy('.env.example', '.env');\"", "php artisan key:generate" ] }, diff --git a/provider/assets/javascripts/jquery.min.js b/provider/assets/javascripts/jquery.min.js deleted file mode 100644 index da4170647d..0000000000 --- a/provider/assets/javascripts/jquery.min.js +++ /dev/null @@ -1,6 +0,0 @@ -/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license -//@ sourceMappingURL=jquery-1.10.2.min.map -*/ -(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+yt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="
",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return pt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=ft(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=dt(n);function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[vt(bt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--)o=Tt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="
a",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="
t
",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="
",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t -}({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while(t=a[r++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/\s*$/g,At={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X
","
"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?""!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle); -u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nn(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("