Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix #11122
James Colea4dff6d39fbd
diff --git a/app/Http/Controllers/Rule/CreateController.php b/app/Http/Controllers/Rule/CreateController.phpindex 24c9c8bd64..ef8ec6dc96 100644--- a/app/Http/Controllers/Rule/CreateController.php+++ b/app/Http/Controllers/Rule/CreateController.php@@ -268,7 +268,6 @@ class CreateController extends Controllerpublic function store(RuleFormRequest $request){$data = $request->getRuleData();-$rule = $this->ruleRepos->store($data);session()->flash('success_url', route('rules.select-transactions', [$rule->id]));session()->flash('success', (string) trans('firefly.stored_new_rule', ['title' => $rule->title]));@@ -283,6 +282,9 @@ class CreateController extends Controllerif ((int) $request->get('bill_id') > 0) {return redirect($this->getPreviousUrl('bills.create.url'));}+ if(true === $data['run_after_form']) {+ return redirect(route('rules.select-transactions', [$rule->id]));+ }$redirect = redirect($this->getPreviousUrl('rules.create.url'));diff --git a/app/Http/Controllers/Rule/EditController.php b/app/Http/Controllers/Rule/EditController.phpindex f1888c425d..520657f317 100644--- a/app/Http/Controllers/Rule/EditController.php+++ b/app/Http/Controllers/Rule/EditController.php@@ -205,6 +205,11 @@ class EditController extends Controllersession()->flash('success', (string) trans('firefly.updated_rule', ['title' => $rule->title]));app('preferences')->mark();$redirect = redirect($this->getPreviousUrl('rules.edit.url'));++ if(true === $data['run_after_form']) {+ return redirect(route('rules.select-transactions', [$rule->id]));+ }+if (1 === (int) $request->get('return_to_edit')) {session()->put('rules.edit.fromUpdate', true);diff --git a/app/Http/Requests/RuleFormRequest.php b/app/Http/Requests/RuleFormRequest.phpindex 8b7d9ca061..e6b7390dd8 100644--- a/app/Http/Requests/RuleFormRequest.php+++ b/app/Http/Requests/RuleFormRequest.php@@ -54,6 +54,7 @@ class RuleFormRequest extends FormRequest'description' => $this->stringWithNewlines('description'),'stop_processing' => $this->boolean('stop_processing'),'strict' => $this->boolean('strict'),+ 'run_after_form' => $this->boolean('run_after_form'),'triggers' => $this->getRuleTriggerData(),'actions' => $this->getRuleActionData(),];@@ -150,6 +151,7 @@ class RuleFormRequest extends FormRequest'actions.*.type' => 'required|in:'.implode(',', $validActions),'actions.*.value' => [sprintf('required_if:actions.*.type,%s|min:0|max:1024', $contextActions), new IsValidActionExpression(), 'ruleActionValue'],'strict' => 'in:0,1',+ 'run_after_form' => 'in:0,1',];/** @var null|Rule $rule */diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.phpindex d06840a2d2..645560d033 100644--- a/resources/lang/en_US/firefly.php+++ b/resources/lang/en_US/firefly.php@@ -825,6 +825,8 @@ return ['apply_rule_group_selection' => 'Apply rule group ":title" to a selection of your transactions','apply_rule_group_selection_intro' => 'Rule groups like ":title" are normally only applied to new or updated transactions, but you can tell Firefly III to run all the rules in this group on a selection of your existing transactions. This can be useful when you have updated a group of rules and you need the changes to be applied to all of your other transactions.','applied_rule_group_selection' => 'Rule group ":title" has been applied to your selection.',+ 'rule_run_after_creation' => 'If you check this box, you get the opportunity to run the rule after it has been created.',+ 'rule_run_after_edit' => 'If you check this box, you get the opportunity to run the rule after it has been updated.',// actions and triggers'rule_trigger_store_journal' => 'When a transaction is created',diff --git a/resources/lang/en_US/form.php b/resources/lang/en_US/form.phpindex aec4ec5a28..38960dfc44 100644--- a/resources/lang/en_US/form.php+++ b/resources/lang/en_US/form.php@@ -66,6 +66,7 @@ return ['opening_balance' => 'Opening balance','tag_mode' => 'Tag mode','virtual_balance' => 'Virtual balance',+ 'run_after_form' => 'Run this rule',diff --git a/resources/views/rules/rule/create.twig b/resources/views/rules/rule/create.twigindex 3e48b4da33..b854a92a63 100644--- a/resources/views/rules/rule/create.twig+++ b/resources/views/rules/rule/create.twig@@ -132,6 +132,7 @@<h3 class="box-title">{{ 'options'|_ }}</h3></div><div class="box-body">+ {{ ExpandedForm.checkbox('run_after_form',1,null, {helpText: trans('firefly.rule_run_after_creation')}) }}{{ ExpandedForm.optionsList('create','rule') }}</div><div class="box-footer">diff --git a/resources/views/rules/rule/edit.twig b/resources/views/rules/rule/edit.twigindex ceb9b0dad1..5110f2cf25 100644--- a/resources/views/rules/rule/edit.twig+++ b/resources/views/rules/rule/edit.twig@@ -118,6 +118,7 @@<h3 class="box-title">{{ 'options'|_ }}</h3></div><div class="box-body">+ {{ ExpandedForm.checkbox('run_after_form',1,null, {helpText: trans('firefly.rule_run_after_edit')}) }}{{ ExpandedForm.optionsList('update','rule') }}</div><div class="box-footer">