Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix #11267
James Cole521a496c179c
diff --git a/app/TransactionRules/Actions/AddTag.php b/app/TransactionRules/Actions/AddTag.phpindex d5e25c8be9..c7bcea80ee 100644--- a/app/TransactionRules/Actions/AddTag.php+++ b/app/TransactionRules/Actions/AddTag.php@@ -23,6 +23,7 @@ declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;+use FireflyIII\Enums\TransactionTypeEnum;use Illuminate\Support\Facades\Log;use FireflyIII\Events\Model\Rule\RuleActionFailedOnArray;use FireflyIII\Events\TriggeredAuditLog;@@ -54,6 +55,13 @@ class AddTag implements ActionInterface$tagName = $this->action->getValue($journal);$tag = $factory->findOrCreate($tagName);+ $type = $journal['transaction_type_type'];+ if(TransactionTypeEnum::OPENING_BALANCE->value === $type || TransactionTypeEnum::LIABILITY_CREDIT->value === $type || TransactionTypeEnum::INVALID->value === $type) {+ // fail silently on invalid transaction types.++ return false;+ }+if (null === $tag) {// could not find, could not create tag.event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.find_or_create_tag_failed', ['tag' => $tagName])));@@ -61,11 +69,7 @@ class AddTag implements ActionInterfacereturn false;}- $count = DB::table('tag_transaction_journal')- ->where('tag_id', $tag->id)- ->where('transaction_journal_id', $journal['transaction_journal_id'])- ->count()- ;+ $count = DB::table('tag_transaction_journal')->where('tag_id', $tag->id)->where('transaction_journal_id', $journal['transaction_journal_id'])->count();if (0 === $count) {// add to journal:DB::table('tag_transaction_journal')->insert(['tag_id' => $tag->id, 'transaction_journal_id' => $journal['transaction_journal_id']]);diff --git a/changelog.md b/changelog.mdindex 821ec7980c..bd45a2ec20 100644--- a/changelog.md+++ b/changelog.md@@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).### Fixed- [Discussion 11211](https://github.com/orgs/firefly-iii/discussions/11211) (question about Transaction journal ID) started by @zhiiwg+- #11267### API