Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix #10898
James Colef13e0991fbed
diff --git a/app/Helpers/Collector/Extensions/MetaCollection.php b/app/Helpers/Collector/Extensions/MetaCollection.phpindex 42a025e8b7..11a15ef799 100644--- a/app/Helpers/Collector/Extensions/MetaCollection.php+++ b/app/Helpers/Collector/Extensions/MetaCollection.php@@ -598,16 +598,16 @@ trait MetaCollection$foundTagCount = 0;foreach ($object['transactions'] as $transaction) {$transactionTagCount = count($transaction['tags']);- app('log')->debug(sprintf('Transaction #%d has %d tag(s)', $transaction['transaction_journal_id'], $transactionTagCount));+ Log::debug(sprintf('Transaction #%d has %d tag(s)', $transaction['transaction_journal_id'], $transactionTagCount));if ($transactionTagCount < $expectedTagCount) {- app('log')->debug(sprintf('Transaction has %d tag(s), we expect %d tag(s), return false.', $transactionTagCount, $expectedTagCount));+ Log::debug(sprintf('Transaction has %d tag(s), we expect %d tag(s), return false.', $transactionTagCount, $expectedTagCount));return false;}foreach ($transaction['tags'] as $tag) {Log::debug(sprintf('"%s" versus', strtolower((string) $tag['name'])), $list);if (in_array(strtolower((string) $tag['name']), $list, true)) {- app('log')->debug(sprintf('Transaction has tag "%s" so count++.', $tag['name']));+ Log::debug(sprintf('Transaction has tag "%s" so count++.', $tag['name']));++$foundTagCount;$journalId = $transaction['transaction_journal_id'];// #8377 prevent adding a transaction twice when multiple tag searches find this transaction@@ -776,6 +776,9 @@ trait MetaCollection$this->withTagInformation();$this->query->whereNotNull('tag_transaction_journal.tag_id');+ // Added this while fixing #10898, not sure why a post filter was ever necessary.+ $this->query->whereIn('tag_transaction_journal.tag_id', $tags->pluck('id')->toArray());+// this method adds a "postFilter" to the collector.$list = $tags->pluck('tag')->toArray();$list = array_map('strtolower', $list);@@ -785,13 +788,13 @@ trait MetaCollectionforeach ($transaction['tags'] as $tag) {Log::debug(sprintf('"%s" versus', strtolower((string) $tag['name'])), $list);if (in_array(strtolower((string) $tag['name']), $list, true)) {- app('log')->debug(sprintf('Transaction has tag "%s" so return true.', $tag['name']));+ Log::debug(sprintf('Transaction has tag "%s" so return true.', $tag['name']));return true;}}}- app('log')->debug('Transaction has no tags from the list, so return false.');+ Log::debug('Transaction has no tags from the list, so return false.');return false;};@@ -813,11 +816,11 @@ trait MetaCollection$filter = static function (array $object) use ($list): bool {Log::debug(sprintf('Now in setWithoutSpecificTags(%s) filter', implode(', ', $list)));foreach ($object['transactions'] as $transaction) {- app('log')->debug(sprintf('Transaction has %d tag(s)', count($transaction['tags'])));+ Log::debug(sprintf('Transaction has %d tag(s)', count($transaction['tags'])));foreach ($transaction['tags'] as $tag) {Log::debug(sprintf('"%s" versus', strtolower((string) $tag['name'])), $list);if (in_array(strtolower((string) $tag['name']), $list, true)) {- app('log')->debug(sprintf('Transaction has tag "%s", but should not have it, return false.', $tag['name']));+ Log::debug(sprintf('Transaction has tag "%s", but should not have it, return false.', $tag['name']));return false;}diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.phpindex abc28ee56f..d8d12cf498 100644--- a/app/Helpers/Collector/GroupCollector.php+++ b/app/Helpers/Collector/GroupCollector.php@@ -631,7 +631,7 @@ class GroupCollector implements GroupCollectorInterface}// also merge attachments:- if (array_key_exists('attachment_id', $result)) {+ if (array_key_exists('attachment_id', $result) && null !== $result['attachment_id']) {$uploaded = 1 === (int)$result['attachment_uploaded'];$attachmentId = (int)$augumentedJournal['attachment_id'];if (0 !== $attachmentId && $uploaded) {@@ -659,7 +659,7 @@ class GroupCollector implements GroupCollectorInterfaceprivate function convertToInteger(array $array): array{foreach ($this->integerFields as $field) {- $array[$field] = array_key_exists($field, $array) ? (int)$array[$field] : null;+ $array[$field] = array_key_exists($field, $array) && null !== $array[$field] ? (int)$array[$field] : null;}return $array;diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.phpindex 82020490e3..f69cd62c24 100644--- a/app/Http/Controllers/TagController.php+++ b/app/Http/Controllers/TagController.php@@ -250,10 +250,7 @@ class TagController extends Controller/** @var GroupCollectorInterface $collector */$collector = app(GroupCollectorInterface::class);- $collector->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withAccountInformation()- ->setTag($tag)->withBudgetInformation()->withCategoryInformation()- ->withAttachmentInformation()- ;+ $collector->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withAccountInformation()->setTag($tag)->withBudgetInformation()->withCategoryInformation()->withAttachmentInformation();$groups = $collector->getPaginatedGroups();$groups->setPath($path);$sums = $this->repository->sumsOfTag($tag, $start, $end);diff --git a/changelog.md b/changelog.mdindex c3f105011f..63af89f3bd 100644--- a/changelog.md+++ b/changelog.md@@ -32,6 +32,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).- [Discussion 10883](https://github.com/orgs/firefly-iii/discussions/10883) (Initial balance for account is missing from exported CSV) started by @ajaskiewiczpl- #10888- #10891+- #10898### API