No longer create a default rule.

This commit is contained in:
James Cole 2021-05-09 07:58:09 +02:00
parent 873dfa179c
commit 06a5b60aaf
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D
5 changed files with 10 additions and 58 deletions

View File

@ -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 = [

View File

@ -74,7 +74,6 @@ class IndexController extends Controller
public function index()
{
$this->createDefaultRuleGroup();
$this->createDefaultRule();
$this->ruleGroupRepos->resetOrder();
$ruleGroups = $this->ruleGroupRepos->getAllRuleGroupsWithRules(null);

View File

@ -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

View File

@ -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:',

View File

@ -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">