Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Merge branch 'develop' into 5.8-dev And fix rule creation and edit etc
James Cole9bfa52f3ce57
diff --cc app/Http/Controllers/Rule/CreateController.phpindex c5095b6274,c5095b6274..3f3ea7d123--- a/app/Http/Controllers/Rule/CreateController.php+++ b/app/Http/Controllers/Rule/CreateController.php@@@ -261,6 -261,6 +261,7 @@@ class CreateController extends Controllpublic function store(RuleFormRequest $request){$data = $request->getRuleData();++$rule = $this->ruleRepos->store($data);session()->flash('success', (string) trans('firefly.stored_new_rule', ['title' => $rule->title]));app('preferences')->mark();diff --cc app/Http/Controllers/Rule/EditController.phpindex c5a14153d4,c5a14153d4..5cac64a28e--- a/app/Http/Controllers/Rule/EditController.php+++ b/app/Http/Controllers/Rule/EditController.php@@@ -189,7 -189,7 +189,8 @@@ class EditController extends Controllepublic function update(RuleFormRequest $request, Rule $rule){$data = $request->getRuleData();-- $this->ruleRepos->update($rule, $data);++++ //$this->ruleRepos->update($rule, $data);session()->flash('success', (string) trans('firefly.updated_rule', ['title' => $rule->title]));app('preferences')->mark();diff --cc app/Http/Requests/RuleFormRequest.phpindex 9ccdebb399,9ccdebb399..8a71856f96--- a/app/Http/Requests/RuleFormRequest.php+++ b/app/Http/Requests/RuleFormRequest.php@@@ -66,11 -66,11 +66,14 @@@ class RuleFormRequest extends FormRequeif (is_array($triggerData)) {foreach ($triggerData as $trigger) {$stopProcessing = $trigger['stop_processing'] ?? '0';-- $return[] = [++ $prohibited = $trigger['prohibited'] ?? '0';++ $set = ['type' => $trigger['type'] ?? 'invalid','value' => $trigger['value'] ?? '','stop_processing' => 1 === (int) $stopProcessing,++ 'prohibited' => 1 === (int) $prohibited,];++ $return[] = $set;}}diff --cc app/Repositories/Rule/RuleRepository.phpindex 7305677f64,7305677f64..53e8ee1c45--- a/app/Repositories/Rule/RuleRepository.php+++ b/app/Repositories/Rule/RuleRepository.php@@@ -425,9 -425,9 +425,13 @@@ class RuleRepository implements RuleRep$value = $trigger['value'] ?? '';$stopProcessing = $trigger['stop_processing'] ?? false;$active = $trigger['active'] ?? true;++ $type = $trigger['type'];++ if (true === $trigger['prohibited']) {++ $type = sprintf('-%s', $type);++ }$triggerValues = [-- 'action' => $trigger['type'],++ 'action' => $type,'value' => $value,'stop_processing' => $stopProcessing,'order' => $order,diff --cc app/Support/Http/Controllers/RenderPartialViews.phpindex 3990c7bbc2,3990c7bbc2..8360140fda--- a/app/Support/Http/Controllers/RenderPartialViews.php+++ b/app/Support/Http/Controllers/RenderPartialViews.php@@@ -317,14 -317,14 +317,19 @@@ trait RenderPartialViewif ('user_action' !== $entry->trigger_type) {$count = ($index + 1);try {++ $rootOperator = OperatorQuerySearch::getRootOperator($entry->trigger_type);++ if(str_starts_with($rootOperator, '-')) {++ $rootOperator = substr($rootOperator, 1);++ }$renderedEntries[] = view('rules.partials.trigger',[-- 'oldTrigger' => OperatorQuerySearch::getRootOperator($entry->trigger_type),-- 'oldValue' => $entry->trigger_value,-- 'oldChecked' => $entry->stop_processing,-- 'count' => $count,-- 'triggers' => $triggers,++ 'oldTrigger' => $rootOperator,++ 'oldValue' => $entry->trigger_value,++ 'oldChecked' => $entry->stop_processing,++ 'oldProhibited' => str_starts_with($entry->trigger_type, '-'),++ 'count' => $count,++ 'triggers' => $triggers,])->render();diff --cc app/Support/Http/Controllers/RuleManagement.phpindex 2144fa036d,2144fa036d..a833732101--- a/app/Support/Http/Controllers/RuleManagement.php+++ b/app/Support/Http/Controllers/RuleManagement.php@@@ -98,11 -98,11 +98,12 @@@ trait RuleManagemen$renderedEntries[] = view('rules.partials.trigger',[-- 'oldTrigger' => OperatorQuerySearch::getRootOperator($oldTrigger['type']),-- 'oldValue' => $oldTrigger['value'],-- 'oldChecked' => 1 === (int) ($oldTrigger['stop_processing'] ?? '0'),-- 'count' => $index + 1,-- 'triggers' => $triggers,++ 'oldTrigger' => OperatorQuerySearch::getRootOperator($oldTrigger['type']),++ 'oldValue' => $oldTrigger['value'],++ 'oldChecked' => 1 === (int) ($oldTrigger['stop_processing'] ?? '0'),++ 'oldProhibited' => 1 === (int) ($oldTrigger['prohibited'] ?? '0'),++ 'count' => $index + 1,++ 'triggers' => $triggers,])->render();} catch (Throwable $e) { // @phpstan-ignore-linediff --cc public/v1/js/ff/rules/create-edit.jsindex b9d2299b56,f454473eac..3955315a3e--- a/public/v1/js/ff/rules/create-edit.js+++ b/public/v1/js/ff/rules/create-edit.js@@@ -353,6 -346,6 +353,7 @@@ function updateTriggerInput(selectListcase 'has_any_tag':case 'has_attachments':case 'source_is_cash':++ case 'has_no_attachments':case 'destination_is_cash':case 'account_is_cash':case 'no_external_url':diff --cc resources/lang/en_US/firefly.phpindex 71ef5389db,755842b29d..73888a04d8--- a/resources/lang/en_US/firefly.php+++ b/resources/lang/en_US/firefly.php@@@ -1025,144 -850,10 +1025,144 @@@ return'rule_trigger_attachment_notes_starts' => 'Any attachment\'s notes start with ":trigger_value"','rule_trigger_attachment_notes_ends_choice' => 'Any attachment\'s notes end with..','rule_trigger_attachment_notes_ends' => 'Any attachment\'s notes end with ":trigger_value"',+ 'rule_trigger_reconciled_choice' => 'Transaction is reconciled',+ 'rule_trigger_reconciled' => 'Transaction is reconciled',+ 'rule_trigger_exists_choice' => 'Any transaction matches(!)',+ 'rule_trigger_exists' => 'Any transaction matches',++ // more values for new types:+ 'rule_trigger_not_account_id' => 'Account ID is not ":trigger_value"',+ 'rule_trigger_not_source_account_id' => 'Source account ID is not ":trigger_value"',+ 'rule_trigger_not_destination_account_id' => 'Destination account ID is not ":trigger_value"',+ 'rule_trigger_not_transaction_type' => 'Transaction type is not ":trigger_value"',+ 'rule_trigger_not_tag_is' => 'Tag is not ":trigger_value"',+ 'rule_trigger_not_tag_is_not' => 'Tag is ":trigger_value"',+ 'rule_trigger_not_description_is' => 'Description is not ":trigger_value"',+ 'rule_trigger_not_description_contains' => 'Description does not contain',+ 'rule_trigger_not_description_ends' => 'Description does not end with ":trigger_value"',+ 'rule_trigger_not_description_starts' => 'Description does not start with ":trigger_value"',+ 'rule_trigger_not_notes_is' => 'Notes are not ":trigger_value"',+ 'rule_trigger_not_notes_contains' => 'Notes do not contain ":trigger_value"',+ 'rule_trigger_not_notes_ends' => 'Notes do not end on ":trigger_value"',+ 'rule_trigger_not_notes_starts' => 'Notes do not start with ":trigger_value"',+ 'rule_trigger_not_source_account_is' => 'Source account is not ":trigger_value"',+ 'rule_trigger_not_source_account_contains' => 'Source account does not contain ":trigger_value"',+ 'rule_trigger_not_source_account_ends' => 'Source account does not end on ":trigger_value"',+ 'rule_trigger_not_source_account_starts' => 'Source account does not start with ":trigger_value"',+ 'rule_trigger_not_source_account_nr_is' => 'Source account number / IBAN is not ":trigger_value"',+ 'rule_trigger_not_source_account_nr_contains' => 'Source account number / IBAN does not contain ":trigger_value"',+ 'rule_trigger_not_source_account_nr_ends' => 'Source account number / IBAN does not end on ":trigger_value"',+ 'rule_trigger_not_source_account_nr_starts' => 'Source account number / IBAN does not start with ":trigger_value"',+ 'rule_trigger_not_destination_account_is' => 'Destination account is not ":trigger_value"',+ 'rule_trigger_not_destination_account_contains' => 'Destination account does not contain ":trigger_value"',+ 'rule_trigger_not_destination_account_ends' => 'Destination account does not end on ":trigger_value"',+ 'rule_trigger_not_destination_account_starts' => 'Destination account does not start with ":trigger_value"',+ 'rule_trigger_not_destination_account_nr_is' => 'Destination account number / IBAN is not ":trigger_value"',+ 'rule_trigger_not_destination_account_nr_contains' => 'Destination account number / IBAN does not contain ":trigger_value"',+ 'rule_trigger_not_destination_account_nr_ends' => 'Destination account number / IBAN does not end on ":trigger_value"',+ 'rule_trigger_not_destination_account_nr_starts' => 'Destination account number / IBAN does not start with ":trigger_value"',+ 'rule_trigger_not_account_is' => 'Neither account is ":trigger_value"',+ 'rule_trigger_not_account_contains' => 'Neither account contains ":trigger_value"',+ 'rule_trigger_not_account_ends' => 'Neither account ends on ":trigger_value"',+ 'rule_trigger_not_account_starts' => 'Neither account starts with ":trigger_value"',+ 'rule_trigger_not_account_nr_is' => 'Neither account number / IBAN is ":trigger_value"',+ 'rule_trigger_not_account_nr_contains' => 'Neither account number / IBAN contains ":trigger_value"',+ 'rule_trigger_not_account_nr_ends' => 'Neither account number / IBAN ends on ":trigger_value"',+ 'rule_trigger_not_account_nr_starts' => 'Neither account number / IBAN starts with ":trigger_value"',+ 'rule_trigger_not_category_is' => 'Neither category is ":trigger_value"',+ 'rule_trigger_not_category_contains' => 'Neither category contains ":trigger_value"',+ 'rule_trigger_not_category_ends' => 'Neither category ends on ":trigger_value"',+ 'rule_trigger_not_category_starts' => 'Neither category starts with ":trigger_value"',+ 'rule_trigger_not_budget_is' => 'Neither budget is ":trigger_value"',+ 'rule_trigger_not_budget_contains' => 'Neither budget contains ":trigger_value"',+ 'rule_trigger_not_budget_ends' => 'Neither budget ends on ":trigger_value"',+ 'rule_trigger_not_budget_starts' => 'Neither budget starts with ":trigger_value"',- 'rule_trigger_not_bill_is' => 'Neither bill is ":trigger_value"',- 'rule_trigger_not_bill_contains' => 'Neither bill contains ":trigger_value"',- 'rule_trigger_not_bill_ends' => 'Neither bill ends on ":trigger_value"',- 'rule_trigger_not_bill_starts' => 'Neither bill starts with ":trigger_value"',++ 'rule_trigger_not_bill_is' => 'Bill is not is ":trigger_value"',++ 'rule_trigger_not_bill_contains' => 'Bill does not contain ":trigger_value"',++ 'rule_trigger_not_bill_ends' => 'Bill does not end on ":trigger_value"',++ 'rule_trigger_not_bill_starts' => 'Bill does not end with ":trigger_value"',+ 'rule_trigger_not_external_id_is' => 'External ID is not ":trigger_value"',+ 'rule_trigger_not_external_id_contains' => 'External ID does not contain ":trigger_value"',+ 'rule_trigger_not_external_id_ends' => 'External ID does not end on ":trigger_value"',+ 'rule_trigger_not_external_id_starts' => 'External ID does not start with ":trigger_value"',+ 'rule_trigger_not_internal_reference_is' => 'Internal reference is not ":trigger_value"',+ 'rule_trigger_not_internal_reference_contains' => 'Internal reference does not contain ":trigger_value"',+ 'rule_trigger_not_internal_reference_ends' => 'Internal reference does not end on ":trigger_value"',+ 'rule_trigger_not_internal_reference_starts' => 'Internal reference does not start with ":trigger_value"',+ 'rule_trigger_not_external_url_is' => 'External URL is not ":trigger_value"',+ 'rule_trigger_not_external_url_contains' => 'External URL does not contain ":trigger_value"',+ 'rule_trigger_not_external_url_ends' => 'External URL does not end on ":trigger_value"',+ 'rule_trigger_not_external_url_starts' => 'External URL does not start with ":trigger_value"',+ 'rule_trigger_not_currency_is' => 'Currency is not ":trigger_value"',+ 'rule_trigger_not_foreign_currency_is' => 'Foreign currency is not ":trigger_value"',+ 'rule_trigger_not_id' => 'Transaction ID is not ":trigger_value"',+ 'rule_trigger_not_journal_id' => 'Transaction journal ID is not ":trigger_value"',+ 'rule_trigger_not_recurrence_id' => 'Recurrence ID is not ":trigger_value"',+ 'rule_trigger_not_date_on' => 'Date is not on ":trigger_value"',+ 'rule_trigger_not_date_before' => 'Date is not before ":trigger_value"',+ 'rule_trigger_not_date_after' => 'Date is not after ":trigger_value"',+ 'rule_trigger_not_interest_date_on' => 'Interest date is not on ":trigger_value"',+ 'rule_trigger_not_interest_date_before' => 'Interest date is not before ":trigger_value"',+ 'rule_trigger_not_interest_date_after' => 'Interest date is not after ":trigger_value"',+ 'rule_trigger_not_book_date_on' => 'Book date is not on ":trigger_value"',+ 'rule_trigger_not_book_date_before' => 'Book date is not before ":trigger_value"',+ 'rule_trigger_not_book_date_after' => 'Book date is not after ":trigger_value"',+ 'rule_trigger_not_process_date_on' => 'Process date is not on ":trigger_value"',+ 'rule_trigger_not_process_date_before' => 'Process date is not before ":trigger_value"',+ 'rule_trigger_not_process_date_after' => 'Process date is not after ":trigger_value"',+ 'rule_trigger_not_due_date_on' => 'Due date is not on ":trigger_value"',+ 'rule_trigger_not_due_date_before' => 'Due date is not before ":trigger_value"',+ 'rule_trigger_not_due_date_after' => 'Due date is not after ":trigger_value"',+ 'rule_trigger_not_payment_date_on' => 'Payment date is not on ":trigger_value"',+ 'rule_trigger_not_payment_date_before' => 'Payment date is not before ":trigger_value"',+ 'rule_trigger_not_payment_date_after' => 'Payment date is not after ":trigger_value"',+ 'rule_trigger_not_invoice_date_on' => 'Invoice date is not on ":trigger_value"',+ 'rule_trigger_not_invoice_date_before' => 'Invoice date is not before ":trigger_value"',+ 'rule_trigger_not_invoice_date_after' => 'Invoice date is not after ":trigger_value"',+ 'rule_trigger_not_created_at_on' => 'Transaction is not created on ":trigger_value"',+ 'rule_trigger_not_created_at_before' => 'Transaction is not created before ":trigger_value"',+ 'rule_trigger_not_created_at_after' => 'Transaction is not created after ":trigger_value"',+ 'rule_trigger_not_updated_at_on' => 'Transaction is not updated on ":trigger_value"',+ 'rule_trigger_not_updated_at_before' => 'Transaction is not updated before ":trigger_value"',+ 'rule_trigger_not_updated_at_after' => 'Transaction is not updated after ":trigger_value"',+ 'rule_trigger_not_amount_is' => 'Transaction amount is not ":trigger_value"',+ 'rule_trigger_not_amount_less' => 'Transaction amount is more than ":trigger_value"',+ 'rule_trigger_not_amount_more' => 'Transaction amount is less than ":trigger_value"',+ 'rule_trigger_not_foreign_amount_is' => 'Foreign transaction amount is not ":trigger_value"',+ 'rule_trigger_not_foreign_amount_less' => 'Foreign transaction amount is more than ":trigger_value"',+ 'rule_trigger_not_foreign_amount_more' => 'Foreign transaction amount is less than ":trigger_value"',+ 'rule_trigger_not_attachment_name_is' => 'No attachment is named ":trigger_value"',+ 'rule_trigger_not_attachment_name_contains' => 'No attachment name contains ":trigger_value"',+ 'rule_trigger_not_attachment_name_starts' => 'No attachment name starts with ":trigger_value"',+ 'rule_trigger_not_attachment_name_ends' => 'No attachment name ends on ":trigger_value"',+ 'rule_trigger_not_attachment_notes_are' => 'No attachment notes are ":trigger_value"',+ 'rule_trigger_not_attachment_notes_contains' => 'No attachment notes contain ":trigger_value"',+ 'rule_trigger_not_attachment_notes_starts' => 'No attachment notes start with ":trigger_value"',+ 'rule_trigger_not_attachment_notes_ends' => 'No attachment notes end on ":trigger_value"',+ 'rule_trigger_not_reconciled' => 'Transaction is not reconciled',+ 'rule_trigger_not_exists' => 'Transaction does not exist',+ 'rule_trigger_not_has_attachments' => 'Transaction has no attachments',+ 'rule_trigger_not_has_any_category' => 'Transaction has no category',+ 'rule_trigger_not_has_any_budget' => 'Transaction has no category',+ 'rule_trigger_not_has_any_bill' => 'Transaction has no bill',+ 'rule_trigger_not_has_any_tag' => 'Transaction has no tags',+ 'rule_trigger_not_any_notes' => 'Transaction has no notes',+ 'rule_trigger_not_any_external_url' => 'Transaction has no external URL',+ 'rule_trigger_not_has_no_attachments' => 'Transaction has a (any) attachment(s)',+ 'rule_trigger_not_has_no_category' => 'Transaction has a (any) category',+ 'rule_trigger_not_has_no_budget' => 'Transaction has a (any) budget',+ 'rule_trigger_not_has_no_bill' => 'Transaction has a (any) bill',+ 'rule_trigger_not_has_no_tag' => 'Transaction has a (any) tag',+ 'rule_trigger_not_no_notes' => 'Transaction has any notes',+ 'rule_trigger_not_no_external_url' => 'Transaction has an external URL',+ 'rule_trigger_not_source_is_cash' => 'Source account is not a cash account',+ 'rule_trigger_not_destination_is_cash' => 'Destination account is not a cash account',+ 'rule_trigger_not_account_is_cash' => 'Neither account is a cash account',+// actions- 'rule_action_delete_transaction_choice' => 'DELETE transaction (!)',- 'rule_action_delete_transaction' => 'DELETE transaction (!)',+ 'rule_action_delete_transaction_choice' => 'DELETE transaction(!)',+ 'rule_action_delete_transaction' => 'DELETE transaction(!)','rule_action_set_category' => 'Set category to ":action_value"','rule_action_clear_category' => 'Clear category','rule_action_set_budget' => 'Set budget to ":action_value"',diff --cc resources/views/rules/rule/create.twigindex 2eac095b73,2eac095b73..e8a134ee7c--- a/resources/views/rules/rule/create.twig+++ b/resources/views/rules/rule/create.twig@@@ -69,6 -69,6 +69,7 @@@<thead><tr><th colspan="2">{{ 'trigger'|_ }}</th>++ <th>{{ 'is_not_rule_trigger'|_ }}</th><th>{{ 'trigger_value'|_ }}</th><th>{{ 'stop_processing_other_triggers'|_ }}</th></tr>