Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Remove code no longer used.
James Cole0dd7ecbfbe45
diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.phpindex e8a9d8c592..b1530b08ca 100644--- a/app/Providers/FireflyServiceProvider.php+++ b/app/Providers/FireflyServiceProvider.php@@ -15,7 +15,6 @@ namespace FireflyIII\Providers;use FireflyIII\Support\Amount;use FireflyIII\Support\ExpandedForm;-use FireflyIII\Support\ExpandedMultiForm;use FireflyIII\Support\FireflyConfig;use FireflyIII\Support\Navigation;use FireflyIII\Support\Preferences;@@ -93,11 +92,6 @@ class FireflyServiceProvider extends ServiceProviderreturn new ExpandedForm;});- $this->app->bind(- 'expandedmultiform', function () {- return new ExpandedMultiForm;- }- );$this->app->bind('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface', 'FireflyIII\Repositories\Currency\CurrencyRepository');$this->app->bind('FireflyIII\Support\Search\SearchInterface', 'FireflyIII\Support\Search\Search');diff --git a/app/Support/ExpandedMultiForm.php b/app/Support/ExpandedMultiForm.phpdeleted file mode 100644index e8340c7b9b..0000000000--- a/app/Support/ExpandedMultiForm.php+++ /dev/null@@ -1,188 +0,0 @@-<?php-/**- * ExpandedMultiForm.php- * Copyright (C) 2016 [email protected]- *- * This software may be modified and distributed under the terms of the- * Creative Commons Attribution-ShareAlike 4.0 International License.- *- * See the LICENSE file for details.- */--declare(strict_types = 1);--namespace FireflyIII\Support;--use Amount as Amt;-use Carbon\Carbon;-use Illuminate\Support\MessageBag;-use Input;-use RuntimeException;-use Session;--/**- * Class ExpandedMultiForm- *- * @package FireflyIII\Support- */-class ExpandedMultiForm-{-- /**- * @param string $name- * @param int $index- * @param null $value- * @param array $options- *- * @return string- */- public function amount(string $name, int $index, $value = null, array $options = []): string- {- $label = $this->label($name, $options);- $options = $this->expandOptionArray($name, $index, $label, $options);- $classes = $this->getHolderClasses($name, $index);- $value = $this->fillFieldValue($name, $index, $value);- $options['step'] = 'any';- $options['min'] = '0.01';- $defaultCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency();- $currencies = Amt::getAllCurrencies();- $options['data-hiddenfield'] = 'amount_currency_id_' . $name . '_' . $index;- unset($options['currency']);- unset($options['placeholder']);- $html = view('form.multi.amount', compact('defaultCurrency', 'index', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();-- return $html;-- }-- /**- * @param string $name- * @param int $index- * @param array $list- * @param null $selected- * @param array $options- *- * @return string- */- public function select(string $name, int $index, array $list = [], $selected = null, array $options = []): string- {- $label = $this->label($name, $options);- $options = $this->expandOptionArray($name, $index, $label, $options);- $classes = $this->getHolderClasses($name, $index);- $selected = $this->fillFieldValue($name, $index, $selected);- unset($options['autocomplete']);- unset($options['placeholder']);- $html = view('form.multi.select', compact('classes', 'index', 'name', 'label', 'selected', 'options', 'list'))->render();-- return $html;- }-- /**- * @param string $name- * @param int $index- * @param null $value- * @param array $options- *- * @return string- */- public function text(string $name, int $index, $value = null, array $options = []): string- {- $label = $this->label($name, $options);- $options = $this->expandOptionArray($name, $index, $label, $options);- $classes = $this->getHolderClasses($name, $index);- $value = $this->fillFieldValue($name, $index, $value);- $html = view('form.multi.text', compact('classes', 'name', 'index', 'label', 'value', 'options'))->render();-- return $html;-- }-- /**- * @param string $name- * @param int $index- * @param string $label- * @param array $options- *- * @return array- */- protected function expandOptionArray(string $name, int $index, string $label, array $options): array- {- $options['class'] = 'form-control';- $options['id'] = 'ffInput_' . $name . '_' . $index;- $options['autocomplete'] = 'off';- $options['placeholder'] = ucfirst($label);-- return $options;- }-- /**- * @param string $name- * @param int $index- * @param $value- *- * @return mixed- */- protected function fillFieldValue(string $name, int $index, $value)- {- if (Session::has('preFilled')) {- $preFilled = session('preFilled');- $value = isset($preFilled[$name][$index]) && is_null($value) ? $preFilled[$name][$index] : $value;- }- try {- if (!is_null(Input::old($name)[$index])) {- $value = Input::old($name)[$index];- }- } catch (RuntimeException $e) {- // don't care about session errors.- }- if ($value instanceof Carbon) {- $value = $value->format('Y-m-d');- }--- return $value;- }-- /**- * @param string $name- * @param int $index- *- * @return string- */- protected function getHolderClasses(string $name, int $index): string- {- /*- * Get errors from session:- */- /** @var MessageBag $errors */- $errors = session('errors');- $classes = 'form-group';- $set = [];-- if (!is_null($errors)) {- $set = $errors->get($name . '.' . $index);- }-- if (!is_null($errors) && count($set) > 0) {- $classes = 'form-group has-error has-feedback';- }-- return $classes;- }-- /**- * @param string $name- * @param array $options- *- * @return string- */- protected function label(string $name, array $options): string- {- if (isset($options['label'])) {- return $options['label'];- }-- return strval(trans('form.' . $name));-- }-}\ No newline at end of filediff --git a/app/Support/Facades/ExpandedMultiForm.php b/app/Support/Facades/ExpandedMultiForm.phpdeleted file mode 100644index 064f3bb305..0000000000--- a/app/Support/Facades/ExpandedMultiForm.php+++ /dev/null@@ -1,35 +0,0 @@-<?php-/**- * ExpandedMultiForm.php- * Copyright (C) 2016 [email protected]- *- * This software may be modified and distributed under the terms of the- * Creative Commons Attribution-ShareAlike 4.0 International License.- *- * See the LICENSE file for details.- */--declare(strict_types = 1);--namespace FireflyIII\Support\Facades;--use Illuminate\Support\Facades\Facade;--/**- * Class Amount- *- * @package FireflyIII\Support\Facades- */-class ExpandedMultiForm extends Facade-{- /**- * Get the registered name of the component.- *- * @return string- */- protected static function getFacadeAccessor(): string- {- return 'expandedmultiform';- }--}diff --git a/config/app.php b/config/app.phpindex d60998fa86..51daf78b6d 100755--- a/config/app.php+++ b/config/app.php@@ -267,7 +267,6 @@ return ['Amount' => 'FireflyIII\Support\Facades\Amount','Steam' => 'FireflyIII\Support\Facades\Steam','ExpandedForm' => 'FireflyIII\Support\Facades\ExpandedForm',- 'ExpandedMultiForm' => 'FireflyIII\Support\Facades\ExpandedMultiForm','Entrust' => 'Zizaco\Entrust\EntrustFacade','Input' => 'Illuminate\Support\Facades\Input','Google2FA' => 'PragmaRX\Google2FA\Vendor\Laravel\Facade',diff --git a/config/twigbridge.php b/config/twigbridge.phpindex 5a4822e22f..886f44d6e1 100644--- a/config/twigbridge.php+++ b/config/twigbridge.php@@ -162,11 +162,6 @@ return ['multiRadio', 'file', 'multiCheckbox', 'staticText', 'amountSmall',],],- 'ExpandedMultiForm' => [- 'is_safe' => [- 'text','select','amount'- ],- ],'Form' => ['is_safe' => ['input', 'select', 'checkbox', 'model', 'open', 'radio', 'textarea', 'file',diff --git a/public/js/ff/firefly.js b/public/js/ff/firefly.jsindex b3e4b7bf93..d63eddbcc3 100644--- a/public/js/ff/firefly.js+++ b/public/js/ff/firefly.js@@ -5,9 +5,6 @@ $(function () {// when you click on a currency, this happens:$('.currency-option').click(currencySelect);- // when you click on a multi currency, this happens:- $('.multi-currency-option').click(multiCurrencySelect);-var ranges = {};ranges[dateRangeConfig.currentPeriod] = [moment(dateRangeConfig.ranges.current[0]), moment(dateRangeConfig.ranges.current[1])];ranges[dateRangeConfig.previousPeriod] = [moment(dateRangeConfig.ranges.previous[0]), moment(dateRangeConfig.ranges.previous[1])];@@ -60,47 +57,6 @@ $(function () {});-function multiCurrencySelect(e) {- "use strict";- // clicked on- var target = $(e.target); // target is the <A> tag.-- // name of the field in question:- var name = target.data('name');-- // index of the field in question:- var index = target.data('index');- console.log('name is ' + name + ':' + index);-- // id of menu button (used later on):- var menuID = 'currency_dropdown_' + name + '_' + index;-- // the hidden input with the actual value of the selected currency:- var hiddenInputName = 'amount_currency_id_' + name + '_' + index;- console.log('Looking for hidden input: ' + hiddenInputName);-- // span with the current selection (next to the caret):- var spanId = 'currency_select_symbol_' + name + '_' + index;-- // the selected currency symbol:- var symbol = target.data('symbol');-- // id of the selected currency.- var id = target.data('id');-- // update the hidden input:- $('input[name="' + hiddenInputName + '"]').val(id);-- // update the symbol:- $('#' + spanId).text(symbol);-- // close the menu (hack hack)- $('#' + menuID).click();--- return false;-}-function currencySelect(e) {"use strict";// clicked ondiff --git a/resources/views/form/multi/amount.twig b/resources/views/form/multi/amount.twigdeleted file mode 100644index 4e6fc1590f..0000000000--- a/resources/views/form/multi/amount.twig+++ /dev/null@@ -1,30 +0,0 @@-<div class="{{ classes }}" id="{{ name }}_{{ index }}_holder">- <label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>- <div class="col-sm-8">- <div class="input-group">- <div class="input-group-btn">- <button type="button"- class="btn btn-default dropdown-toggle currency-dropdown" id="currency_dropdown_{{ name }}_{{ index }}" data-toggle="dropdown"- aria-expanded="false">- <span id="currency_select_symbol_{{ name }}_{{ index }}">{{ defaultCurrency.symbol|raw }}</span> <span class="caret"></span>- </button>- <ul class="dropdown-menu currency-dropdown-menu" role="menu">- {% for currency in currencies %}- <li>- <a href="#"- class="multi-currency-option"- data-id="{{ currency.id }}"- data-name="{{ name }}"- data-index="{{ index }}"- data-currency="{{ currency.code }}"- data-symbol="{{ currency.symbol|raw }}">{{ currency.name }}</a></li>- {% endfor %}- </ul>- </div>- {{ Form.input('number', name~'['~index~']', value, options) }}- </div>- {% include 'form.multi.feedback.twig' %}- </div>-- <input type="hidden" name="amount_currency_id_{{ name }}_{{ index }}" value="{{ defaultCurrency.id }}"/>-</div>diff --git a/resources/views/form/multi/feedback.twig b/resources/views/form/multi/feedback.twigdeleted file mode 100644index 92c00d26d9..0000000000--- a/resources/views/form/multi/feedback.twig+++ /dev/null@@ -1,4 +0,0 @@-{% if errors.has(name~'.'~index) %}- <span class="form-control-feedback"><i class="fa fa-fw fa-remove"></i></span>- <p class="text-danger">{{ errors.first(name~'.'~index) }}</p>-{% endif %}diff --git a/resources/views/form/multi/select.twig b/resources/views/form/multi/select.twigdeleted file mode 100644index 1c6d81b31a..0000000000--- a/resources/views/form/multi/select.twig+++ /dev/null@@ -1,10 +0,0 @@-<div class="{{ classes }}" id="{{ name }}_{{ index }}_holder">- <label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>-- <div class="col-sm-8">- {{ Form.select(name~'['~index~']', list, selected , options ) }}- {% include 'form.help.twig' %}- {% include 'form.multi.feedback.twig' %}-- </div>-</div>diff --git a/resources/views/form/multi/text.twig b/resources/views/form/multi/text.twigdeleted file mode 100644index 5f0b154fbd..0000000000--- a/resources/views/form/multi/text.twig+++ /dev/null@@ -1,9 +0,0 @@-<div class="{{ classes }}" id="{{ name }}_{{ index }}_holder">- <label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>-- <div class="col-sm-8">- {{ Form.input('text', name~'['~index~']', value, options) }}- {% include 'form/help.twig' %}- {% include 'form.multi.feedback.twig' %}- </div>-</div>