Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Remove references to ExpandedForm.
James Cole71b63bd33bbe
diff --git a/app/Http/Controllers/RuleGroupController.php b/app/Http/Controllers/RuleGroupController.phpindex 8aa82f72f7..3c65632544 100644--- a/app/Http/Controllers/RuleGroupController.php+++ b/app/Http/Controllers/RuleGroupController.php@@ -23,11 +23,9 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers;use Carbon\Carbon;-use ExpandedForm;use FireflyIII\Http\Requests\RuleGroupFormRequest;use FireflyIII\Http\Requests\SelectTransactionsRequest;use FireflyIII\Jobs\ExecuteRuleGroupOnExistingTransactions;-use FireflyIII\Models\AccountType;use FireflyIII\Models\RuleGroup;use FireflyIII\Repositories\Account\AccountRepositoryInterface;use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;@@ -75,22 +73,18 @@ class RuleGroupController extends Controller}/**- * @param RuleGroupRepositoryInterface $repository- * @param RuleGroup $ruleGroup+ * @param RuleGroup $ruleGroup** @return View*/- public function delete(RuleGroupRepositoryInterface $repository, RuleGroup $ruleGroup)+ public function delete(RuleGroup $ruleGroup){$subTitle = trans('firefly.delete_rule_group', ['title' => $ruleGroup->title]);- $ruleGroupList = ExpandedForm::makeSelectListWithEmpty($repository->get());- unset($ruleGroupList[$ruleGroup->id]);-// put previous url in session$this->rememberPreviousUri('rule-groups.delete.uri');- return view('rules.rule-group.delete', compact('ruleGroup', 'subTitle', 'ruleGroupList'));+ return view('rules.rule-group.delete', compact('ruleGroup', 'subTitle'));}/**@@ -179,17 +173,17 @@ class RuleGroupController extends Controller}/**- * @param RuleGroup $ruleGroup+ * @param RuleGroup $ruleGroup** @return View*/public function selectTransactions(RuleGroup $ruleGroup){- $first = session('first')->format('Y-m-d');- $today = Carbon::create()->format('Y-m-d');- $subTitle = (string)trans('firefly.apply_rule_group_selection', ['title' => $ruleGroup->title]);+ $first = session('first')->format('Y-m-d');+ $today = Carbon::create()->format('Y-m-d');+ $subTitle = (string)trans('firefly.apply_rule_group_selection', ['title' => $ruleGroup->title]);- return view('rules.rule-group.select-transactions', compact( 'first', 'today', 'ruleGroup', 'subTitle'));+ return view('rules.rule-group.select-transactions', compact('first', 'today', 'ruleGroup', 'subTitle'));}/**diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.phpindex 899b93e8b9..c40e574e5a 100644--- a/app/Support/ExpandedForm.php+++ b/app/Support/ExpandedForm.php@@ -32,6 +32,7 @@ use FireflyIII\Models\TransactionCurrency;use FireflyIII\Repositories\Account\AccountRepositoryInterface;use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;+use Form;use Illuminate\Support\Collection;use Illuminate\Support\MessageBag;use RuntimeException;@@ -49,6 +50,7 @@ class ExpandedForm** @return string* @throws \FireflyIII\Exceptions\FireflyException+ * @throws \Throwable*/public function amount(string $name, $value = null, array $options = []): string{@@ -128,7 +130,7 @@ class ExpandedForm}unset($options['class']);- $html = view('form.assetAccountCheckList', compact('classes','selected', 'name', 'label', 'options', 'grouped'))->render();+ $html = view('form.assetAccountCheckList', compact('classes', 'selected', 'name', 'label', 'options', 'grouped'))->render();return $html;}@@ -545,9 +547,37 @@ class ExpandedFormforeach ($list as $group) {$array[$group->id] = $group->title;}- $res = $this->select($name, $array, $value, $options);- return $res;+ return $this->select($name, $array, $value, $options);+ }++ /**+ * @param string $name+ * @param null $value+ * @param null $options+ *+ * @return \Illuminate\Support\HtmlString+ */+ public function ruleGroupListWithEmpty(string $name, $value = null, $options = null)+ {+ $options = $options ?? [];+ $options['class'] = 'form-control';+ /** @var RuleGroupRepositoryInterface $groupRepos */+ $groupRepos = app(RuleGroupRepositoryInterface::class);++ // get all currencies:+ $list = $groupRepos->get();+ $array = [+ 0 => trans('firefly.none_in_select_list'),+ ];+ /** @var RuleGroup $group */+ foreach ($list as $group) {+ if (isset($options['hidden']) && (int)$options['hidden'] !== $group->id) {+ $array[$group->id] = $group->title;+ }+ }++ return Form::select($name, $array, $value, $options);}/**diff --git a/config/twigbridge.php b/config/twigbridge.phpindex 2e2b1d98c7..46aa7f0f50 100644--- a/config/twigbridge.php+++ b/config/twigbridge.php@@ -188,7 +188,7 @@ return ['is_safe' => ['date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer', 'textarea', 'location','multiRadio', 'file', 'multiCheckbox', 'staticText', 'amountSmall', 'password', 'nonSelectableBalance', 'nonSelectableAmount',- 'number', 'assetAccountList','amountNoCurrency','currencyList','ruleGroupList','assetAccountCheckList'+ 'number', 'assetAccountList','amountNoCurrency','currencyList','ruleGroupList','assetAccountCheckList','ruleGroupListWithEmpty'],],'Form' => [diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.phpindex 19233057ac..1f34455d49 100644--- a/resources/lang/en_US/firefly.php+++ b/resources/lang/en_US/firefly.php@@ -179,6 +179,7 @@ return ['authorization_request_intro' => '<strong>:client</strong> is requesting permission to access your financial administration. Would you like to authorize <strong>:client</strong> to access these records?','scopes_will_be_able' => 'This application will be able to:','button_authorize' => 'Authorize',+ 'none_in_select_list' => '(none)',// check for updates:'update_check_title' => 'Check for updates',diff --git a/resources/views/rules/rule-group/delete.twig b/resources/views/rules/rule-group/delete.twigindex 0d5474343d..4b5618bc9e 100644--- a/resources/views/rules/rule-group/delete.twig+++ b/resources/views/rules/rule-group/delete.twig@@ -35,7 +35,7 @@</p><p>- {{ Form.select('move_rules_before_delete', ruleGroupList, null, {class: 'form-control'}) }}+ {{ ExpandedForm.ruleGroupListWithEmpty('move_rules_before_delete',null, {'hidden': ruleGroup.id}) }}</p>{% else %}<input type="hidden" name="move_rules_before_delete" value="0"/>