Skip to content

Firefly III: a personal finances manager

No longer create a default rule.

James Cole06a5b60aaf5c
diff --git a/app/Http/Controllers/Rule/CreateController.php b/app/Http/Controllers/Rule/CreateController.php
index d0ed539094..e6f675539b 100644
--- a/app/Http/Controllers/Rule/CreateController.php
+++ b/app/Http/Controllers/Rule/CreateController.php
@@ -80,7 +80,6 @@ class CreateController extends Controller
public function create(Request $request, RuleGroup $ruleGroup = null)
{
$this->createDefaultRuleGroup();
- $this->createDefaultRule();
$preFilled = [
'strict' => true,
];
@@ -145,7 +144,6 @@ class CreateController extends Controller
$request->session()->flash('info', (string)trans('firefly.instructions_rule_from_bill', ['name' => e($bill->name)]));
$this->createDefaultRuleGroup();
- $this->createDefaultRule();
$preFilled = [
'strict' => true,
'title' => (string)trans('firefly.new_rule_for_bill_title', ['name' => $bill->name]),
@@ -202,7 +200,6 @@ class CreateController extends Controller
$oldActions = [];
$this->createDefaultRuleGroup();
- $this->createDefaultRule();
// collect pre-filled information:
$preFilled = [
diff --git a/app/Http/Controllers/Rule/IndexController.php b/app/Http/Controllers/Rule/IndexController.php
index 2ce1d05fda..4c9d6b3a58 100644
--- a/app/Http/Controllers/Rule/IndexController.php
+++ b/app/Http/Controllers/Rule/IndexController.php
@@ -74,7 +74,6 @@ class IndexController extends Controller
public function index()
{
$this->createDefaultRuleGroup();
- $this->createDefaultRule();
$this->ruleGroupRepos->resetOrder();
$ruleGroups = $this->ruleGroupRepos->getAllRuleGroupsWithRules(null);
diff --git a/app/Support/Http/Controllers/RuleManagement.php b/app/Support/Http/Controllers/RuleManagement.php
index 09141fa90b..0d03105b5b 100644
--- a/app/Support/Http/Controllers/RuleManagement.php
+++ b/app/Support/Http/Controllers/RuleManagement.php
@@ -36,54 +36,6 @@ use Throwable;
*/
trait RuleManagement
{
- /**
- *
- */
- protected function createDefaultRule(): void
- {
- /** @var RuleRepositoryInterface $ruleRepository */
- $ruleRepository = app(RuleRepositoryInterface::class);
- if (0 === $ruleRepository->count()) {
- $data = [
- 'rule_group_id' => $ruleRepository->getFirstRuleGroup()->id,
- 'stop_processing' => 0,
- 'title' => (string)trans('firefly.default_rule_name'),
- 'description' => (string)trans('firefly.default_rule_description'),
- 'trigger' => 'store-journal',
- 'strict' => true,
- 'active' => true,
- 'triggers' => [
- [
- 'type' => 'description_is',
- 'value' => (string)trans('firefly.default_rule_trigger_description'),
- 'stop_processing' => false,
-
- ],
- [
- 'type' => 'from_account_is',
- 'value' => (string)trans('firefly.default_rule_trigger_source_account'),
- 'stop_processing' => false,
-
- ],
-
- ],
- 'actions' => [
- [
- 'type' => 'prepend_description',
- 'value' => (string)trans('firefly.default_rule_action_prepend'),
- 'stop_processing' => false,
- ],
- [
- 'type' => 'set_category',
- 'value' => (string)trans('firefly.default_rule_action_set_category'),
- 'stop_processing' => false,
- ],
- ],
- ];
-
- $ruleRepository->store($data);
- }
- }
/**
* @param Request $request
diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php
index d50aff7227..4b47faaad5 100644
--- a/resources/lang/en_US/firefly.php
+++ b/resources/lang/en_US/firefly.php
@@ -402,12 +402,6 @@ return [
'updated_rule' => 'Updated rule with title ":title"',
'default_rule_group_name' => 'Default rules',
'default_rule_group_description' => 'All your rules not in a particular group.',
- 'default_rule_name' => 'Your first default rule',
- 'default_rule_description' => 'This rule is an example. You can safely delete it.',
- 'default_rule_trigger_description' => 'The Man Who Sold the World',
- 'default_rule_trigger_source_account' => 'David Bowie',
- 'default_rule_action_prepend' => 'Bought the world from ',
- 'default_rule_action_set_category' => 'Large expenses',
'trigger' => 'Trigger',
'trigger_value' => 'Trigger on value',
'stop_processing_other_triggers' => 'Stop processing other triggers',
@@ -1708,9 +1702,13 @@ return [
'no_accounts_imperative_liabilities' => 'You don\'t have to use this feature, but it can be useful if you want to keep track of these things.',
'no_accounts_create_liabilities' => 'Create a liability',
'no_budgets_title_default' => 'Let\'s create a budget',
+ 'no_rules_title_default' => 'Let\'s create a rule',
'no_budgets_intro_default' => 'You have no budgets yet. Budgets are used to organize your expenses into logical groups, which you can give a soft-cap to limit your expenses.',
+ 'no_rules_intro_default' => 'You have no rules yet. Rules are powerful automations that can handle transactions for you.',
+ 'no_rules_imperative_default' => 'Rules can be very useful when you\'re managing transactions. Let\'s create one now:',
'no_budgets_imperative_default' => 'Budgets are the basic tools of financial management. Let\'s create one now:',
'no_budgets_create_default' => 'Create a budget',
+ 'no_rules_create_default' => 'Create a rule',
'no_categories_title_default' => 'Let\'s create a category!',
'no_categories_intro_default' => 'You have no categories yet. Categories are used to fine tune your transactions and label them with their designated category.',
'no_categories_imperative_default' => 'Categories are created automatically when you create transactions, but you can create one manually too. Let\'s create one now:',
diff --git a/resources/views/v1/rules/index.twig b/resources/views/v1/rules/index.twig
index 5c739219c9..405641dbf7 100644
--- a/resources/views/v1/rules/index.twig
+++ b/resources/views/v1/rules/index.twig
@@ -12,6 +12,12 @@
</div>
</div>
+ {% if ruleGroups|length == 1 and ruleGroups[0].rules.count() == 0 %}
+ {% include 'v1.partials.empty' with {objectType: 'default', type: 'rules',route: route('rules.create')} %}
+ {# make FF ignore demo for now. #}
+ {% set shownDemo = true %}
+ {% endif %}
+
{% for ruleGroup in ruleGroups %}
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">