List rules as inactive if relevant #1392

This commit is contained in:
James Cole
2018-04-30 06:12:55 +02:00
parent f2b71bc280
commit 3ead4d4587
4 changed files with 12 additions and 4 deletions

View File

@@ -393,11 +393,11 @@ class BillRepository implements BillRepositoryInterface
$rules = $this->user->rules()
->leftJoin('rule_actions', 'rule_actions.rule_id', '=', 'rules.id')
->where('rule_actions.action_type', 'link_to_bill')
->get(['rules.id', 'rules.title', 'rule_actions.action_value']);
->get(['rules.id', 'rules.title', 'rule_actions.action_value','rules.active']);
$array = [];
foreach ($rules as $rule) {
$array[$rule->action_value] = $array[$rule->action_value] ?? [];
$array[$rule->action_value][] = ['id' => $rule->id, 'title' => $rule->title];
$array[$rule->action_value][] = ['id' => $rule->id, 'title' => $rule->title,'active' => $rule->active];
}
$return = [];
foreach ($collection as $bill) {

View File

@@ -667,6 +667,7 @@ return [
'bill_will_automatch' => 'Bill will automatically linked to matching transactions',
'skips_over' => 'skips over',
'bill_store_error' => 'An unexpected error occurred while storing your new bill. Please check the log files',
'list_inactive_rule' => 'inactive rule',
// accounts:
'details_for_asset' => 'Details for asset account ":name"',

View File

@@ -73,7 +73,9 @@
{% if rules.count > 0 %}
<ul>
{% for rule in rules %}
<li><a href="{{ route('rules.edit', [rule.id]) }}">{{ rule.title }}</a></li>
<li><a href="{{ route('rules.edit', [rule.id]) }}">{{ rule.title }}</a>
{% if not rule.active %}({{ 'list_inactive_rule'|_|lower }}){% endif %}
</li>
{% endfor %}
</ul>
{% endif %}

View File

@@ -46,7 +46,12 @@
{% if entry.rules|length > 0 %}
<ul class="list-unstyled">
{% for rule in entry.rules %}
<li><a href="{{ route('rules.edit', [rule.id]) }}">{{ rule.title }}</a></li>
<li>
<a href="{{ route('rules.edit', [rule.id]) }}">
{{ rule.title }}
</a>
{% if not rule.active %}({{ 'list_inactive_rule'|_|lower }}){% endif %}
</li>
{% endfor %}
</ul>
{% endif %}