Skip to content

Firefly III: a personal finances manager

Fix #11563

James Colee76ab21091a3
diff --git a/app/Helpers/Collector/Extensions/MetaCollection.php b/app/Helpers/Collector/Extensions/MetaCollection.php
index 99aea4872b..aa6ea84a88 100644
--- a/app/Helpers/Collector/Extensions/MetaCollection.php
+++ b/app/Helpers/Collector/Extensions/MetaCollection.php
@@ -773,31 +773,22 @@ trait MetaCollection
$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());
+ // Removed again for #11473 because it breaks multiple tag filters.
+ // $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);
$filter = static function (array $object) use ($list): bool {
- Log::debug(sprintf('Now in setTags(%s) filter', implode(', ', $list)));
+ Log::debug(sprintf('Now in setTags (any) filter: %s', implode(', ', $list)));
foreach ($object['transactions'] as $transaction) {
- $total = count($transaction['tags']);
- $matched = 0;
foreach ($transaction['tags'] as $tag) {
Log::debug(sprintf('"%s" versus', strtolower((string) $tag['name'])), $list);
if (in_array(strtolower((string) $tag['name']), $list, true)) {
Log::debug(sprintf('Transaction has tag "%s" so return true.', $tag['name']));
- ++$matched;
- if (1 === count($list)) {
- return true;
- }
+ return true;
}
}
- if (count($list) > 1 && $total === $matched && $matched === count($list)) {
- Log::debug(sprintf('All %d searched tags are present.', $total));
-
- return true;
- }
}
Log::debug('Transaction has no tags from the list, so return false.');
diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php
index 921f8acd1a..dd457cba01 100644
--- a/app/Helpers/Collector/GroupCollector.php
+++ b/app/Helpers/Collector/GroupCollector.php
@@ -48,7 +48,6 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Override;
use Safe\Exceptions\JsonException;
-
use function Safe\json_decode;
/**
@@ -68,15 +67,15 @@ class GroupCollector implements GroupCollectorInterface
*/
public function __construct()
{
- $this->sorting = [];
- $this->postFilters = [];
- $this->tags = [];
- $this->user = null;
- $this->userGroup = null;
- $this->limit = null;
- $this->page = null;
- $this->startRow = null;
- $this->endRow = null;
+ $this->sorting = [];
+ $this->postFilters = [];
+ $this->tags = [];
+ $this->user = null;
+ $this->userGroup = null;
+ $this->limit = null;
+ $this->page = null;
+ $this->startRow = null;
+ $this->endRow = null;
$this->hasAccountInfo = false;
$this->hasCatInformation = false;
@@ -274,9 +273,9 @@ class GroupCollector implements GroupCollectorInterface
foreach ($params as $param) {
$replace = sprintf('"%s"', $param);
if (is_int($param)) {
- $replace = (string) $param;
+ $replace = (string)$param;
}
- $pos = strpos($query, '?');
+ $pos = strpos($query, '?');
if (false !== $pos) {
$query = substr_replace($query, $replace, $pos, 1);
}
@@ -433,21 +432,24 @@ class GroupCollector implements GroupCollectorInterface
*/
public function getGroups(): Collection
{
+ Log::debug('Now in getGroups()');
if ($this->expandGroupSearch) {
// get group ID's for the query:
$groupIds = $this->getCollectedGroupIds();
// add to query:
$this->query->orWhereIn('transaction_journals.transaction_group_id', $groupIds);
}
- $result = $this->query->get($this->fields);
+ $result = $this->query->get($this->fields);
+ $this->dumpQueryInLogs();
+ Log::debug(sprintf('Count of result is %d', $result->count()));
// now to parse this into an array.
- $collection = $this->parseArray($result);
+ $collection = $this->parseArray($result);
// filter the array using all available post filters:
- $collection = $this->postFilterCollection($collection);
+ $collection = $this->postFilterCollection($collection);
// sort the collection, if sort instructions are present.
- $collection = $this->sortCollection($collection);
+ $collection = $this->sortCollection($collection);
// count it and continue:
$this->total = $collection->count();
@@ -471,8 +473,7 @@ class GroupCollector implements GroupCollectorInterface
return $this->query
->get(['transaction_journals.transaction_group_id'])
->pluck('transaction_group_id')
- ->toArray()
- ;
+ ->toArray();
}
/**
@@ -484,13 +485,13 @@ class GroupCollector implements GroupCollectorInterface
/** @var TransactionJournal $augumentedJournal */
foreach ($collection as $augumentedJournal) {
- $groupId = (int) $augumentedJournal->transaction_group_id;
+ $groupId = (int)$augumentedJournal->transaction_group_id;
if (!array_key_exists($groupId, $groups)) {
// make new array
- $parsedGroup = $this->parseAugmentedJournal($augumentedJournal);
- $groupArray = [
- 'id' => (int) $augumentedJournal->transaction_group_id,
+ $parsedGroup = $this->parseAugmentedJournal($augumentedJournal);
+ $groupArray = [
+ 'id' => (int)$augumentedJournal->transaction_group_id,
'user_id' => $augumentedJournal->user_id,
'user_group_id' => $augumentedJournal->user_group_id,
// Field transaction_group_title was added by the query.
@@ -503,7 +504,7 @@ class GroupCollector implements GroupCollectorInterface
'transactions' => [],
];
// Field transaction_journal_id was added by the query.
- $journalId = (int) $augumentedJournal->transaction_journal_id;
+ $journalId = (int)$augumentedJournal->transaction_journal_id;
$groupArray['transactions'][$journalId] = $parsedGroup;
$groups[$groupId] = $groupArray;
@@ -511,7 +512,7 @@ class GroupCollector implements GroupCollectorInterface
}
// or parse the rest.
// Field transaction_journal_id was added by the query.
- $journalId = (int) $augumentedJournal->transaction_journal_id;
+ $journalId = (int)$augumentedJournal->transaction_journal_id;
if (array_key_exists($journalId, $groups[$groupId]['transactions'])) {
// append data to existing group + journal (for multiple tags or multiple attachments)
$groups[$groupId]['transactions'][$journalId] = $this->mergeTags($groups[$groupId]['transactions'][$journalId], $augumentedJournal);
@@ -561,27 +562,27 @@ class GroupCollector implements GroupCollectorInterface
}
// try to process meta date value (if present)
- $dates = ['interest_date', 'payment_date', 'invoice_date', 'book_date', 'due_date', 'process_date'];
+ $dates = ['interest_date', 'payment_date', 'invoice_date', 'book_date', 'due_date', 'process_date'];
if (array_key_exists('meta_name', $result) && in_array($result['meta_name'], $dates, true)) {
$name = $result['meta_name'];
- if (array_key_exists('meta_data', $result) && '' !== (string) $result['meta_data']) {
- $result[$name] = Carbon::createFromFormat('!Y-m-d', substr((string) json_decode((string) $result['meta_data']), 0, 10));
+ if (array_key_exists('meta_data', $result) && '' !== (string)$result['meta_data']) {
+ $result[$name] = Carbon::createFromFormat('!Y-m-d', substr((string)json_decode((string)$result['meta_data']), 0, 10));
}
}
// convert values to integers:
- $result = $this->convertToInteger($result);
+ $result = $this->convertToInteger($result);
// convert to boolean
- $result = $this->convertToBoolean($result);
+ $result = $this->convertToBoolean($result);
// convert back to strings because SQLite is dumb like that.
- $result = $this->convertToStrings($result);
+ $result = $this->convertToStrings($result);
- $result['reconciled'] = 1 === (int) $result['reconciled'];
+ $result['reconciled'] = 1 === (int)$result['reconciled'];
if (array_key_exists('tag_id', $result) && null !== $result['tag_id']) { // assume the other fields are present as well.
- $tagId = (int) $augumentedJournal['tag_id'];
- $tagDate = null;
+ $tagId = (int)$augumentedJournal['tag_id'];
+ $tagDate = null;
try {
$tagDate = Carbon::parse($augumentedJournal['tag_date']);
@@ -590,7 +591,7 @@ class GroupCollector implements GroupCollectorInterface
}
$result['tags'][$tagId] = [
- 'id' => (int) $result['tag_id'],
+ 'id' => (int)$result['tag_id'],
'name' => $result['tag_name'],
'date' => $tagDate,
'description' => $result['tag_description'],
@@ -599,8 +600,8 @@ class GroupCollector implements GroupCollectorInterface
// also merge attachments:
if (array_key_exists('attachment_id', $result) && null !== $result['attachment_id']) {
- $uploaded = 1 === (int) $result['attachment_uploaded'];
- $attachmentId = (int) $augumentedJournal['attachment_id'];
+ $uploaded = 1 === (int)$result['attachment_uploaded'];
+ $attachmentId = (int)$augumentedJournal['attachment_id'];
$deleted = null !== $result['attachment_deleted_at'];
if (0 !== $attachmentId && $uploaded && !$deleted) {
$result['attachments'][$attachmentId] = [
@@ -634,7 +635,7 @@ class GroupCollector implements GroupCollectorInterface
private function convertToInteger(array $array): array
{
foreach ($this->integerFields as $field) {
- $array[$field] = array_key_exists($field, $array) && null !== $array[$field] ? (int) $array[$field] : null;
+ $array[$field] = array_key_exists($field, $array) && null !== $array[$field] ? (int)$array[$field] : null;
}
return $array;
@@ -643,7 +644,7 @@ class GroupCollector implements GroupCollectorInterface
private function convertToBoolean(array $array): array
{
foreach ($this->booleanFields as $field) {
- $array[$field] = array_key_exists($field, $array) ? (bool) $array[$field] : null;
+ $array[$field] = array_key_exists($field, $array) ? (bool)$array[$field] : null;
}
return $array;
@@ -652,7 +653,7 @@ class GroupCollector implements GroupCollectorInterface
private function convertToStrings(array $array): array
{
foreach ($this->stringFields as $field) {
- $array[$field] = array_key_exists($field, $array) && null !== $array[$field] ? (string) $array[$field] : null;
+ $array[$field] = array_key_exists($field, $array) && null !== $array[$field] ? (string)$array[$field] : null;
}
return $array;
@@ -662,9 +663,9 @@ class GroupCollector implements GroupCollectorInterface
{
$newArray = $newJournal->toArray();
if (array_key_exists('tag_id', $newArray)) { // assume the other fields are present as well.
- $tagId = (int) $newJournal['tag_id'];
+ $tagId = (int)$newJournal['tag_id'];
- $tagDate = null;
+ $tagDate = null;
try {
$tagDate = Carbon::parse($newArray['tag_date']);
@@ -673,7 +674,7 @@ class GroupCollector implements GroupCollectorInterface
}
$existingJournal['tags'][$tagId] = [
- 'id' => (int) $newArray['tag_id'],
+ 'id' => (int)$newArray['tag_id'],
'name' => $newArray['tag_name'],
'date' => $tagDate,
'description' => $newArray['tag_description'],
@@ -687,7 +688,7 @@ class GroupCollector implements GroupCollectorInterface
{
$newArray = $newJournal->toArray();
if (array_key_exists('attachment_id', $newArray)) {
- $attachmentId = (int) $newJournal['attachment_id'];
+ $attachmentId = (int)$newJournal['attachment_id'];
$existingJournal['attachments'][$attachmentId] = ['id' => $attachmentId];
}
@@ -704,13 +705,13 @@ class GroupCollector implements GroupCollectorInterface
foreach ($groups as $groudId => $group) {
/** @var array $transaction */
foreach ($group['transactions'] as $transaction) {
- $currencyId = (int) $transaction['currency_id'];
+ $currencyId = (int)$transaction['currency_id'];
if (null === $transaction['amount']) {
throw new FireflyException(sprintf('Amount is NULL for a transaction in group #%d, please investigate.', $groudId));
}
- $pcAmount = (string) ('' === $transaction['pc_amount'] ? '0' : $transaction['pc_amount']);
- $pcForeignAmount = (string) ('' === $transaction['pc_foreign_amount'] ? '0' : $transaction['pc_foreign_amount']);
- $foreignAmount = (string) ('' === $transaction['foreign_amount'] ? '0' : $transaction['foreign_amount']);
+ $pcAmount = (string)('' === $transaction['pc_amount'] ? '0' : $transaction['pc_amount']);
+ $pcForeignAmount = (string)('' === $transaction['pc_foreign_amount'] ? '0' : $transaction['pc_foreign_amount']);
+ $foreignAmount = (string)('' === $transaction['foreign_amount'] ? '0' : $transaction['foreign_amount']);
// set default:
if (!array_key_exists($currencyId, $groups[$groudId]['sums'])) {
@@ -721,11 +722,11 @@ class GroupCollector implements GroupCollectorInterface
$groups[$groudId]['sums'][$currencyId]['amount'] = '0';
$groups[$groudId]['sums'][$currencyId]['pc_amount'] = '0';
}
- $groups[$groudId]['sums'][$currencyId]['amount'] = bcadd((string) $groups[$groudId]['sums'][$currencyId]['amount'], $transaction['amount']);
- $groups[$groudId]['sums'][$currencyId]['pc_amount'] = bcadd((string) $groups[$groudId]['sums'][$currencyId]['pc_amount'], $pcAmount);
+ $groups[$groudId]['sums'][$currencyId]['amount'] = bcadd((string)$groups[$groudId]['sums'][$currencyId]['amount'], $transaction['amount']);
+ $groups[$groudId]['sums'][$currencyId]['pc_amount'] = bcadd((string)$groups[$groudId]['sums'][$currencyId]['pc_amount'], $pcAmount);
if (null !== $transaction['foreign_amount'] && null !== $transaction['foreign_currency_id']) {
- $currencyId = (int) $transaction['foreign_currency_id'];
+ $currencyId = (int)$transaction['foreign_currency_id'];
// set default:
if (!array_key_exists($currencyId, $groups[$groudId]['sums'])) {
@@ -736,7 +737,7 @@ class GroupCollector implements GroupCollectorInterface
$groups[$groudId]['sums'][$currencyId]['amount'] = '0';
$groups[$groudId]['sums'][$currencyId]['pc_amount'] = '0';
}
- $groups[$groudId]['sums'][$currencyId]['amount'] = bcadd((string) $groups[$groudId]['sums'][$currencyId]['amount'], $foreignAmount);
+ $groups[$groudId]['sums'][$currencyId]['amount'] = bcadd((string)$groups[$groudId]['sums'][$currencyId]['amount'], $foreignAmount);
$groups[$groudId]['sums'][$currencyId]['pc_amount'] = bcadd($groups[$groudId]['sums'][$currencyId]['amount'], $pcForeignAmount);
}
}
@@ -752,18 +753,19 @@ class GroupCollector implements GroupCollectorInterface
if (0 === $countFilters) {
return $currentCollection;
}
- Log::debug(sprintf(
- 'GroupCollector: postFilterCollection has %d filter(s) and %d transaction(s).',
- count($this->postFilters),
- count($currentCollection)
- ));
+ Log::debug(sprintf('GroupCollector: postFilterCollection has %d filter(s) and %d transaction(s).', count($this->postFilters), count($currentCollection)));
+
+ if (0 === $currentCollection->count()) {
+ Log::debug('Found nothing anyway, return empty collection.');
+ return $currentCollection;
+ }
/**
* @var Closure $function
*/
foreach ($this->postFilters as $function) {
Log::debug('Applying filter...');
- $nextCollection = new Collection();
+ $nextCollection = new Collection();
// loop everything in the current collection
// and save it (or not) in the new collection.
@@ -775,16 +777,22 @@ class GroupCollector implements GroupCollectorInterface
$result = $function($item);
if (false === $result) {
// skip other filters, continue to next item.
+ Log::debug('Result is false');
continue;
}
// if the result is a bool, use the unedited results.
if (true === $result) {
+ Log::debug('Result is true');
$nextCollection->push($item);
+ continue;
}
// if the result is an array, the filter has changed what's being returned.
if (is_array($result)) {
+ Log::debug('Result is array');
$nextCollection->push($result);
+ continue;
}
+ Log::debug('Result is something else!');
}
$currentCollection = $nextCollection;
Log::debug(sprintf('GroupCollector: postFilterCollection has %d transaction(s) left.', count($currentCollection)));
@@ -827,7 +835,8 @@ class GroupCollector implements GroupCollectorInterface
*/
public function getPaginatedGroups(): LengthAwarePaginator
{
- $set = $this->getGroups();
+ Log::debug('Now in getPaginatedGroups()');
+ $set = $this->getGroups();
if (0 === $this->limit) {
$this->setLimit(50);
}
@@ -1058,8 +1067,7 @@ class GroupCollector implements GroupCollectorInterface
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC')
->orderBy('transaction_journals.description', 'DESC')
- ->orderBy('source.amount', 'DESC')
- ;
+ ->orderBy('source.amount', 'DESC');
}
/**
@@ -1104,8 +1112,7 @@ class GroupCollector implements GroupCollectorInterface
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC')
->orderBy('transaction_journals.description', 'DESC')
- ->orderBy('source.amount', 'DESC')
- ;
+ ->orderBy('source.amount', 'DESC');
}
/**
@@ -1121,8 +1128,7 @@ class GroupCollector implements GroupCollectorInterface
// include budget ID + name (if any)
->withBudgetInformation()
// include bill ID + name (if any)
- ->withBillInformation()
- ;
+ ->withBillInformation();
return $this;
}
diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php
index a6764c3eba..19edaa39c8 100644
--- a/app/Support/Search/OperatorQuerySearch.php
+++ b/app/Support/Search/OperatorQuerySearch.php
@@ -61,26 +61,28 @@ use TypeError;
*/
class OperatorQuerySearch implements SearchInterface
{
- protected Carbon $date;
- private readonly AccountRepositoryInterface $accountRepository;
- private readonly BillRepositoryInterface $billRepository;
- private readonly BudgetRepositoryInterface $budgetRepository;
+ protected Carbon $date;
+ private readonly AccountRepositoryInterface $accountRepository;
+ private readonly BillRepositoryInterface $billRepository;
+ private readonly BudgetRepositoryInterface $budgetRepository;
private readonly CategoryRepositoryInterface $categoryRepository;
- private GroupCollectorInterface $collector;
+ private GroupCollectorInterface $collector;
private readonly CurrencyRepositoryInterface $currencyRepository;
- private array $excludeTags = [];
- private array $includeAnyTags = [];
+ private array $excludeTags = [];
+ private array $includeAnyTags = [];
// added to fix #8632
- private array $includeTags = [];
- private array $invalidOperators = [];
- private int $limit = 25;
- private readonly Collection $operators;
- private int $page = 1;
- private array $prohibitedWords = [];
- private readonly float $startTime;
+ private array $includeTags = [];
+ // added to fix #11473
+ private array $includeAllTags = [];
+ private array $invalidOperators = [];
+ private int $limit = 25;
+ private readonly Collection $operators;
+ private int $page = 1;
+ private array $prohibitedWords = [];
+ private readonly float $startTime;
private readonly TagRepositoryInterface $tagRepository;
- private readonly array $validOperators;
- private array $words = [];
+ private readonly array $validOperators;
+ private array $words = [];
/**
* OperatorQuerySearch constructor.
@@ -111,7 +113,7 @@ class OperatorQuerySearch implements SearchInterface
$operator = substr($operator, 1);
}
- $config = config(sprintf('search.operators.%s', $operator));
+ $config = config(sprintf('search.operators.%s', $operator));
if (null === $config) {
throw new FireflyException(sprintf('No configuration for search operator "%s"', $operator));
}
@@ -180,7 +182,7 @@ class OperatorQuerySearch implements SearchInterface
try {
$parsedQuery = $parser->parse($query);
- } catch (LogicException|TypeError $e) {
+ } catch (LogicException | TypeError $e) {
Log::error($e->getMessage());
Log::error(sprintf('Could not parse search: "%s".', $query));
@@ -205,10 +207,13 @@ class OperatorQuerySearch implements SearchInterface
public function searchTransactions(): LengthAwarePaginator
{
$this->parseTagInstructions();
- if (0 === count($this->getWords()) && 0 === count($this->getExcludedWords()) && 0 === count($this->getOperators())) {
+ if (
+ 0 === count($this->excludeTags) && 0 === count($this->includeAnyTags) && 0 === count($this->includeAllTags) &&
+ 0 === count($this->getWords()) && 0 === count($this->getExcludedWords()) && 0 === count($this->getOperators())) {
+ Log::warning('No need to search for anything');
return new LengthAwarePaginator([], 0, 5, 1);
}
-
+ Log::debug('Call getPaginatedGroups()');
return $this->collector->getPaginatedGroups();
}
@@ -241,10 +246,9 @@ class OperatorQuerySearch implements SearchInterface
$this->collector
->withAccountInformation()
->withCategoryInformation()
- ->withBudgetInformation()
- ;
+ ->withBudgetInformation();
- $this->setLimit((int) Preferences::getForUser($user, 'listPageSize', 50)->data);
+ $this->setLimit((int)Preferences::getForUser($user, 'listPageSize', 50)->data);
}
private function findCurrency(string $value): ?TransactionCurrency
@@ -276,7 +280,7 @@ class OperatorQuerySearch implements SearchInterface
$value = $node->getValue();
$prohibited = $node->isProhibited($flipProhibitedFlag);
- $context = config(sprintf('search.operators.%s.needs_context', $operator));
+ $context = config(sprintf('search.operators.%s.needs_context', $operator));
// is an operator that needs no context, and value is false, then prohibited = true.
if ('false' === $value && in_array($operator, $this->validOperators, true) && false === $context && !$prohibited) {
@@ -290,14 +294,14 @@ class OperatorQuerySearch implements SearchInterface
}
// must be valid operator:
- $inArray = in_array($operator, $this->validOperators, true);
+ $inArray = in_array($operator, $this->validOperators, true);
if ($inArray && $this->updateCollector($operator, $value, $prohibited)) {
- $this->operators->push(['type' => self::getRootOperator($operator), 'value' => $value, 'prohibited' => $prohibited]);
+ $this->operators->push(['type' => self::getRootOperator($operator), 'value' => $value, 'prohibited' => $prohibited]);
Log::debug(sprintf('Added operator type "%s"', $operator));
}
if (!$inArray) {
Log::debug(sprintf('Added INVALID operator type "%s"', $operator));
- $this->invalidOperators[] = ['type' => $operator, 'value' => $value];
+ $this->invalidOperators[] = ['type' => $operator, 'value' => $value];
}
}
@@ -344,7 +348,7 @@ class OperatorQuerySearch implements SearchInterface
private function handleStringNode(StringNode $node, bool $flipProhibitedFlag): void
{
- $string = $node->getValue();
+ $string = $node->getValue();
$prohibited = $node->isProhibited($flipProhibitedFlag);
@@ -369,7 +373,7 @@ class OperatorQuerySearch implements SearchInterface
$parsedDate = $parser->parseDate($value);
} catch (FireflyException) {
Log::debug(sprintf('Could not parse date "%s", will return empty array.', $value));
- $this->invalidOperators[] = ['type' => $type, 'value' => $value];
+ $this->invalidOperators[] = ['type' => $type, 'value' => $value];
return [];
}
@@ -395,30 +399,57 @@ class OperatorQuerySearch implements SearchInterface
$this->collector->setWithoutSpecificTags($collection);
}
// if include tags, include them:
- if (count($this->includeTags) > 0) {
- Log::debug(sprintf('%d include tag(s)', count($this->includeTags)));
- $collection = new Collection();
- foreach ($this->includeTags as $tagId) {
- $tag = $this->tagRepository->find($tagId);
- if (null !== $tag) {
- Log::debug(sprintf('Include tag "%s"', $tag->tag));
- $collection->push($tag);
+// if (count($this->includeTags) > 0) {
+// Log::debug(sprintf('%d include tag(s)', count($this->includeTags)));
+// $collection = new Collection();
+// foreach ($this->includeTags as $tagId) {
+// $tag = $this->tagRepository->find($tagId);
+// if (null !== $tag) {
+// Log::debug(sprintf('Include tag "%s"', $tag->tag));
+// $collection->push($tag);
+// }
+// }
+// $this->collector->setAllTags($collection);
+// }
+ // if include ALL tags, include them:
+ if (count($this->includeAllTags) > 0) {
+ Log::debug(sprintf('include ALL tag(s) in %d sets', count($this->includeAllTags)));
+ /** @var array|int|string $set */
+ foreach ($this->includeAllTags as $set) {
+ Log::debug('Loop set of includeAllTags');
+ if (!is_array($set)) {
+ throw new FireflyException('[a] Item is expected to be an array.');
+ }
+ $collection = new Collection();
+ foreach ($set as $tagId) {
+ $tag = $this->tagRepository->find($tagId);
+ if (null !== $tag) {
+ Log::debug(sprintf('Include tag (ALL) "%s"', $tag->tag));
+ $collection->push($tag);
+ }
+ $this->collector->setAllTags($collection);
}
+
}
- $this->collector->setAllTags($collection);
}
// if include ANY tags, include them: (see #8632)
if (count($this->includeAnyTags) > 0) {
- Log::debug(sprintf('%d include ANY tag(s)', count($this->includeAnyTags)));
- $collection = new Collection();
- foreach ($this->includeAnyTags as $tagId) {
- $tag = $this->tagRepository->find($tagId);
- if (null !== $tag) {
- Log::debug(sprintf('Include ANY tag "%s"', $tag->tag));
- $collection->push($tag);
+ Log::debug(sprintf('include ANY tag(s) with %d sets', count($this->includeAnyTags)));
+ foreach ($this->includeAnyTags as $set) {
+ if (!is_array($set)) {
+ throw new FireflyException('[b] Item is expected to be an array.');
+ }
+ Log::debug(sprintf('Set count is %d', count($set)));
+ $collection = new Collection();
+ foreach ($set as $tagId) {
+ $tag = $this->tagRepository->find($tagId);
+ if (null !== $tag) {
+ Log::debug(sprintf('Include tag (ANY) "%s"', $tag->tag));
+ $collection->push($tag);
+ }
}
+ $this->collector->setTags($collection);
}
- $this->collector->setTags($collection);
}
}
@@ -477,7 +508,7 @@ class OperatorQuerySearch implements SearchInterface
}
}
// string position (default): starts with:
- $stringMethod = 'str_starts_with';
+ $stringMethod = 'str_starts_with';
// string position: ends with:
if (StringPosition::ENDS === $stringPosition) {
@@ -491,7 +522,7 @@ class OperatorQuerySearch implements SearchInterface
}
// get accounts:
- $accounts = $this->accountRepository->searchAccount($value, $searchTypes, 1337);
+ $accounts = $this->accountRepository->searchAccount($value, $searchTypes, 1337);
if (0 === $accounts->count() && false === $prohibited) {
Log::warning('Found zero accounts, search for non existing account, NO results will be returned.');
$this->collector->findNothing();
@@ -504,7 +535,7 @@ class OperatorQuerySearch implements SearchInterface
return;
}
Log::debug(sprintf('Found %d accounts, will filter.', $accounts->count()));
- $filtered = $accounts->filter(static fn (Account $account): bool => $stringMethod(strtolower($account->name), strtolower($value)));
+ $filtered = $accounts->filter(static fn(Account $account): bool => $stringMethod(strtolower($account->name), strtolower($value)));
if (0 === $filtered->count()) {
Log::warning('Left with zero accounts, so cannot find anything, NO results will be returned.');
@@ -574,7 +605,7 @@ class OperatorQuerySearch implements SearchInterface
}
// string position (default): starts with:
- $stringMethod = 'str_starts_with';
+ $stringMethod = 'str_starts_with';
// string position: ends with:
if (StringPosition::ENDS === $stringPosition) {
@@ -588,7 +619,7 @@ class OperatorQuerySearch implements SearchInterface
}
// search for accounts:
- $accounts = $this->accountRepository->searchAccountNr($value, $searchTypes, 1337);
+ $accounts = $this->accountRepository->searchAccountNr($value, $searchTypes, 1337);
if (0 === $accounts->count()) {
Log::debug('Found zero accounts, search for invalid account.');
Log::warning('Call to findNothing() from searchAccountNr().');
@@ -599,14 +630,14 @@ class OperatorQuerySearch implements SearchInterface
// if found, do filter
Log::debug(sprintf('Found %d accounts, will filter.', $accounts->count()));
- $filtered = $accounts->filter(static function (Account $account) use ($value, $stringMethod): bool {
+ $filtered = $accounts->filter(static function (Account $account) use ($value, $stringMethod): bool {
// either IBAN or account number
- $ibanMatch = $stringMethod(strtolower((string) $account->iban), strtolower($value));
+ $ibanMatch = $stringMethod(strtolower((string)$account->iban), strtolower($value));
$accountNrMatch = false;
/** @var AccountMeta $meta */
foreach ($account->accountMeta as $meta) {
- if ('account_number' === $meta->name && $stringMethod(strtolower((string) $meta->data), strtolower($value))) {
+ if ('account_number' === $meta->name && $stringMethod(strtolower((string)$meta->data), strtolower($value))) {
$accountNrMatch = true;
}
}
@@ -646,7 +677,7 @@ class OperatorQuerySearch implements SearchInterface
case 'exact':
if ($value instanceof Carbon) {
$this->collector->setAfter($value);
- $this->operators->push(['type' => 'date_after', 'value' => $value->format('Y-m-d')]);
+ $this->operators->push(['type' => 'date_after', 'value' => $value->format('Y-m-d')]);
}
break;
@@ -655,7 +686,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set date_is_after YEAR value "%s"', $value));
$this->collector->yearAfter($value);
- $this->operators->push(['type' => 'date_after_year', 'value' => $value]);
+ $this->operators->push(['type' => 'date_after_year', 'value' => $value]);
}
break;
@@ -664,7 +695,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set date_is_after MONTH value "%s"', $value));
$this->collector->monthAfter($value);
- $this->operators->push(['type' => 'date_after_month', 'value' => $value]);
+ $this->operators->push(['type' => 'date_after_month', 'value' => $value]);
}
break;
@@ -673,7 +704,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set date_is_after DAY value "%s"', $value));
$this->collector->dayAfter($value);
- $this->operators->push(['type' => 'date_after_day', 'value' => $value]);
+ $this->operators->push(['type' => 'date_after_day', 'value' => $value]);
}
break;
@@ -702,7 +733,7 @@ class OperatorQuerySearch implements SearchInterface
case 'exact':
if ($value instanceof Carbon) {
$this->collector->setBefore($value);
- $this->operators->push(['type' => 'date_before', 'value' => $value->format('Y-m-d')]);
+ $this->operators->push(['type' => 'date_before', 'value' => $value->format('Y-m-d')]);
}
break;
@@ -711,7 +742,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set date_is_before YEAR value "%s"', $value));
$this->collector->yearBefore($value);
- $this->operators->push(['type' => 'date_before_year', 'value' => $value]);
+ $this->operators->push(['type' => 'date_before_year', 'value' => $value]);
}
break;
@@ -720,7 +751,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set date_is_before MONTH value "%s"', $value));
$this->collector->monthBefore($value);
- $this->operators->push(['type' => 'date_before_month', 'value' => $value]);
+ $this->operators->push(['type' => 'date_before_month', 'value' => $value]);
}
break;
@@ -729,7 +760,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set date_is_before DAY value "%s"', $value));
$this->collector->dayBefore($value);
- $this->operators->push(['type' => 'date_before_day', 'value' => $value]);
+ $this->operators->push(['type' => 'date_before_day', 'value' => $value]);
}
break;
@@ -759,7 +790,7 @@ class OperatorQuerySearch implements SearchInterface
if ($value instanceof Carbon) {
Log::debug(sprintf('Set date_is_exact value "%s"', $value->format('Y-m-d')));
$this->collector->setRange($value, $value);
- $this->operators->push(['type' => 'date_on', 'value' => $value->format('Y-m-d')]);
+ $this->operators->push(['type' => 'date_on', 'value' => $value->format('Y-m-d')]);
}
break;
@@ -767,7 +798,7 @@ class OperatorQuerySearch implements SearchInterface
case 'exact_not':
if ($value instanceof Carbon) {
$this->collector->excludeRange($value, $value);
- $this->operators->push(['type' => 'not_date_on', 'value' => $value->format('Y-m-d')]);
+ $this->operators->push(['type' => 'not_date_on', 'value' => $value->format('Y-m-d')]);
}
break;
@@ -776,7 +807,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set date_is_exact YEAR value "%s"', $value));
$this->collector->yearIs($value);
- $this->operators->push(['type' => 'date_on_year', 'value' => $value]);
+ $this->operators->push(['type' => 'date_on_year', 'value' => $value]);
}
break;
@@ -785,7 +816,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set date_is_exact_not YEAR value "%s"', $value));
$this->collector->yearIsNot($value);
- $this->operators->push(['type' => 'not_date_on_year', 'value' => $value]);
+ $this->operators->push(['type' => 'not_date_on_year', 'value' => $value]);
}
break;
@@ -794,7 +825,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set date_is_exact MONTH value "%s"', $value));
$this->collector->monthIs($value);
- $this->operators->push(['type' => 'date_on_month', 'value' => $value]);
+ $this->operators->push(['type' => 'date_on_month', 'value' => $value]);
}
break;
@@ -803,7 +834,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set date_is_exact not MONTH value "%s"', $value));
$this->collector->monthIsNot($value);
- $this->operators->push(['type' => 'not_date_on_month', 'value' => $value]);
+ $this->operators->push(['type' => 'not_date_on_month', 'value' => $value]);
}
break;
@@ -812,7 +843,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set date_is_exact DAY value "%s"', $value));
$this->collector->dayIs($value);
- $this->operators->push(['type' => 'date_on_day', 'value' => $value]);
+ $this->operators->push(['type' => 'date_on_day', 'value' => $value]);
}
break;
@@ -821,7 +852,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set not date_is_exact DAY value "%s"', $value));
$this->collector->dayIsNot($value);
- $this->operators->push(['type' => 'not_date_on_day', 'value' => $value]);
+ $this->operators->push(['type' => 'not_date_on_day', 'value' => $value]);
}
break;
@@ -853,7 +884,7 @@ class OperatorQuerySearch implements SearchInterface
if ($value instanceof Carbon) {
Log::debug(sprintf('Set %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
$this->collector->setMetaDateRange($value, $value, $field);
- $this->operators->push(['type' => sprintf('%s_on', $field), 'value' => $value->format('Y-m-d')]);
+ $this->operators->push(['type' => sprintf('%s_on', $field), 'value' => $value->format('Y-m-d')]);
}
break;
@@ -862,7 +893,7 @@ class OperatorQuerySearch implements SearchInterface
if ($value instanceof Carbon) {
Log::debug(sprintf('Set NOT %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
$this->collector->excludeMetaDateRange($value, $value, $field);
- $this->operators->push(['type' => sprintf('not_%s_on', $field), 'value' => $value->format('Y-m-d')]);
+ $this->operators->push(['type' => sprintf('not_%s_on', $field), 'value' => $value->format('Y-m-d')]);
}
break;
@@ -871,7 +902,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set %s_is_exact YEAR value "%s"', $field, $value));
$this->collector->metaYearIs($value, $field);
- $this->operators->push(['type' => sprintf('%s_on_year', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_on_year', $field), 'value' => $value]);
}
break;
@@ -880,7 +911,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set NOT %s_is_exact YEAR value "%s"', $field, $value));
$this->collector->metaYearIsNot($value, $field);
- $this->operators->push(['type' => sprintf('not_%s_on_year', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('not_%s_on_year', $field), 'value' => $value]);
}
break;
@@ -889,7 +920,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set %s_is_exact MONTH value "%s"', $field, $value));
$this->collector->metaMonthIs($value, $field);
- $this->operators->push(['type' => sprintf('%s_on_month', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_on_month', $field), 'value' => $value]);
}
break;
@@ -898,7 +929,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set NOT %s_is_exact MONTH value "%s"', $field, $value));
$this->collector->metaMonthIsNot($value, $field);
- $this->operators->push(['type' => sprintf('not_%s_on_month', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('not_%s_on_month', $field), 'value' => $value]);
}
break;
@@ -907,7 +938,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set %s_is_exact DAY value "%s"', $field, $value));
$this->collector->metaDayIs($value, $field);
- $this->operators->push(['type' => sprintf('%s_on_day', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_on_day', $field), 'value' => $value]);
}
break;
@@ -916,7 +947,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set NOT %s_is_exact DAY value "%s"', $field, $value));
$this->collector->metaDayIsNot($value, $field);
- $this->operators->push(['type' => sprintf('not_%s_on_day', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('not_%s_on_day', $field), 'value' => $value]);
}
break;
@@ -946,7 +977,7 @@ class OperatorQuerySearch implements SearchInterface
if ($value instanceof Carbon) {
Log::debug(sprintf('Set %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
$this->collector->setObjectRange($value, clone $value, $field);
- $this->operators->push(['type' => sprintf('%s_on', $field), 'value' => $value->format('Y-m-d')]);
+ $this->operators->push(['type' => sprintf('%s_on', $field), 'value' => $value->format('Y-m-d')]);
}
break;
@@ -955,7 +986,7 @@ class OperatorQuerySearch implements SearchInterface
if ($value instanceof Carbon) {
Log::debug(sprintf('Set NOT %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
$this->collector->excludeObjectRange($value, clone $value, $field);
- $this->operators->push(['type' => sprintf('not_%s_on', $field), 'value' => $value->format('Y-m-d')]);
+ $this->operators->push(['type' => sprintf('not_%s_on', $field), 'value' => $value->format('Y-m-d')]);
}
break;
@@ -964,7 +995,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set %s_is_exact YEAR value "%s"', $field, $value));
$this->collector->objectYearIs($value, $field);
- $this->operators->push(['type' => sprintf('%s_on_year', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_on_year', $field), 'value' => $value]);
}
break;
@@ -973,7 +1004,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set NOT %s_is_exact YEAR value "%s"', $field, $value));
$this->collector->objectYearIsNot($value, $field);
- $this->operators->push(['type' => sprintf('not_%s_on_year', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('not_%s_on_year', $field), 'value' => $value]);
}
break;
@@ -982,7 +1013,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set %s_is_exact MONTH value "%s"', $field, $value));
$this->collector->objectMonthIs($value, $field);
- $this->operators->push(['type' => sprintf('%s_on_month', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_on_month', $field), 'value' => $value]);
}
break;
@@ -991,7 +1022,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set NOT %s_is_exact MONTH value "%s"', $field, $value));
$this->collector->objectMonthIsNot($value, $field);
- $this->operators->push(['type' => sprintf('not_%s_on_month', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('not_%s_on_month', $field), 'value' => $value]);
}
break;
@@ -1000,7 +1031,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set %s_is_exact DAY value "%s"', $field, $value));
$this->collector->objectDayIs($value, $field);
- $this->operators->push(['type' => sprintf('%s_on_day', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_on_day', $field), 'value' => $value]);
}
break;
@@ -1009,7 +1040,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set NOT %s_is_exact DAY value "%s"', $field, $value));
$this->collector->objectDayIsNot($value, $field);
- $this->operators->push(['type' => sprintf('not_%s_on_day', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('not_%s_on_day', $field), 'value' => $value]);
}
break;
@@ -1038,7 +1069,7 @@ class OperatorQuerySearch implements SearchInterface
case 'exact':
if ($value instanceof Carbon) {
$this->collector->setMetaAfter($value, $field);
- $this->operators->push(['type' => sprintf('%s_after', $field), 'value' => $value->format('Y-m-d')]);
+ $this->operators->push(['type' => sprintf('%s_after', $field), 'value' => $value->format('Y-m-d')]);
}
break;
@@ -1047,7 +1078,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set %s_is_after YEAR value "%s"', $field, $value));
$this->collector->metaYearAfter($value, $field);
- $this->operators->push(['type' => sprintf('%s_after_year', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_after_year', $field), 'value' => $value]);
}
break;
@@ -1056,7 +1087,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set %s_is_after MONTH value "%s"', $field, $value));
$this->collector->metaMonthAfter($value, $field);
- $this->operators->push(['type' => sprintf('%s_after_month', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_after_month', $field), 'value' => $value]);
}
break;
@@ -1065,7 +1096,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set %s_is_after DAY value "%s"', $field, $value));
$this->collector->metaDayAfter($value, $field);
- $this->operators->push(['type' => sprintf('%s_after_day', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_after_day', $field), 'value' => $value]);
}
break;
@@ -1094,7 +1125,7 @@ class OperatorQuerySearch implements SearchInterface
case 'exact':
if ($value instanceof Carbon) {
$this->collector->setMetaBefore($value, $field);
- $this->operators->push(['type' => sprintf('%s_before', $field), 'value' => $value->format('Y-m-d')]);
+ $this->operators->push(['type' => sprintf('%s_before', $field), 'value' => $value->format('Y-m-d')]);
}
break;
@@ -1103,7 +1134,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set %s_is_before YEAR value "%s"', $field, $value));
$this->collector->metaYearBefore($value, $field);
- $this->operators->push(['type' => sprintf('%s_before_year', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_before_year', $field), 'value' => $value]);
}
break;
@@ -1112,7 +1143,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set %s_is_before MONTH value "%s"', $field, $value));
$this->collector->metaMonthBefore($value, $field);
- $this->operators->push(['type' => sprintf('%s_before_month', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_before_month', $field), 'value' => $value]);
}
break;
@@ -1121,7 +1152,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set %s_is_before DAY value "%s"', $field, $value));
$this->collector->metaDayBefore($value, $field);
- $this->operators->push(['type' => sprintf('%s_before_day', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_before_day', $field), 'value' => $value]);
}
break;
@@ -1150,7 +1181,7 @@ class OperatorQuerySearch implements SearchInterface
case 'exact':
if ($value instanceof Carbon) {
$this->collector->setObjectAfter($value, $field);
- $this->operators->push(['type' => sprintf('%s_after', $field), 'value' => $value->format('Y-m-d')]);
+ $this->operators->push(['type' => sprintf('%s_after', $field), 'value' => $value->format('Y-m-d')]);
}
break;
@@ -1159,7 +1190,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set date_is_after YEAR value "%s"', $value));
$this->collector->objectYearAfter($value, $field);
- $this->operators->push(['type' => sprintf('%s_after_year', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_after_year', $field), 'value' => $value]);
}
break;
@@ -1168,7 +1199,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set date_is_after MONTH value "%s"', $value));
$this->collector->objectMonthAfter($value, $field);
- $this->operators->push(['type' => sprintf('%s_after_month', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_after_month', $field), 'value' => $value]);
}
break;
@@ -1177,7 +1208,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set date_is_after DAY value "%s"', $value));
$this->collector->objectDayAfter($value, $field);
- $this->operators->push(['type' => sprintf('%s_after_day', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_after_day', $field), 'value' => $value]);
}
break;
@@ -1206,7 +1237,7 @@ class OperatorQuerySearch implements SearchInterface
case 'exact':
if ($value instanceof Carbon) {
$this->collector->setObjectBefore($value, $field);
- $this->operators->push(['type' => sprintf('%s_before', $field), 'value' => $value->format('Y-m-d')]);
+ $this->operators->push(['type' => sprintf('%s_before', $field), 'value' => $value->format('Y-m-d')]);
}
break;
@@ -1215,7 +1246,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set date_is_before YEAR value "%s"', $value));
$this->collector->objectYearBefore($value, $field);
- $this->operators->push(['type' => sprintf('%s_before_year', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_before_year', $field), 'value' => $value]);
}
break;
@@ -1224,7 +1255,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set date_is_before MONTH value "%s"', $value));
$this->collector->objectMonthBefore($value, $field);
- $this->operators->push(['type' => sprintf('%s_before_month', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_before_month', $field), 'value' => $value]);
}
break;
@@ -1233,7 +1264,7 @@ class OperatorQuerySearch implements SearchInterface
if (is_string($value)) {
Log::debug(sprintf('Set date_is_before DAY value "%s"', $value));
$this->collector->objectDayBefore($value, $field);
- $this->operators->push(['type' => sprintf('%s_before_day', $field), 'value' => $value]);
+ $this->operators->push(['type' => sprintf('%s_before_day', $field), 'value' => $value]);
}
break;
@@ -1265,13 +1296,13 @@ class OperatorQuerySearch implements SearchInterface
throw new FireflyException(sprintf('Unsupported search operator: "%s"', $operator));
- // some search operators are ignored, basically:
+ // some search operators are ignored, basically:
case 'user_action':
Log::info(sprintf('Ignore search operator "%s"', $operator));
return false;
- // all account related searches:
+ // all account related searches:
case 'account_is':
$this->searchAccount($value, SearchDirection::BOTH, StringPosition::IS);
@@ -1434,7 +1465,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'source_account_id':
- $account = $this->accountRepository->find((int) $value);
+ $account = $this->accountRepository->find((int)$value);
if (null !== $account) {
$this->collector->setSourceAccounts(new Collection()->push($account));
}
@@ -1447,7 +1478,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-source_account_id':
- $account = $this->accountRepository->find((int) $value);
+ $account = $this->accountRepository->find((int)$value);
if (null !== $account) {
$this->collector->excludeSourceAccounts(new Collection()->push($account));
}
@@ -1460,25 +1491,25 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'journal_id':
- $parts = explode(',', $value);
+ $parts = explode(',', $value);
$this->collector->setJournalIds($parts);
break;
case '-journal_id':
- $parts = explode(',', $value);
+ $parts = explode(',', $value);
$this->collector->excludeJournalIds($parts);
break;
case 'id':
- $parts = explode(',', $value);
+ $parts = explode(',', $value);
$this->collector->setIds($parts);
break;
case '-id':
- $parts = explode(',', $value);
+ $parts = explode(',', $value);
$this->collector->excludeIds($parts);
break;
@@ -1564,7 +1595,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'destination_account_id':
- $account = $this->accountRepository->find((int) $value);
+ $account = $this->accountRepository->find((int)$value);
if (null !== $account) {
$this->collector->setDestinationAccounts(new Collection()->push($account));
}
@@ -1576,7 +1607,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-destination_account_id':
- $account = $this->accountRepository->find((int) $value);
+ $account = $this->accountRepository->find((int)$value);
if (null !== $account) {
$this->collector->excludeDestinationAccounts(new Collection()->push($account));
}
@@ -1589,12 +1620,12 @@ class OperatorQuerySearch implements SearchInterface
case 'account_id':
Log::debug(sprintf('Now in "account_id" with value "%s"', $value));
- $parts = explode(',', $value);
- $collection = new Collection();
+ $parts = explode(',', $value);
+ $collection = new Collection();
foreach ($parts as $accountId) {
- $accountId = (int) $accountId;
+ $accountId = (int)$accountId;
Log::debug(sprintf('Searching for account with ID #%d', $accountId));
- $account = $this->accountRepository->find($accountId);
+ $account = $this->accountRepository->find($accountId);
if (null !== $account) {
Log::debug(sprintf('Found account with ID #%d ("%s")', $accountId, $account->name));
$collection->push($account);
@@ -1615,10 +1646,10 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-account_id':
- $parts = explode(',', $value);
- $collection = new Collection();
+ $parts = explode(',', $value);
+ $collection = new Collection();
foreach ($parts as $accountId) {
- $account = $this->accountRepository->find((int) $accountId);
+ $account = $this->accountRepository->find((int)$accountId);
if (null !== $account) {
$collection->push($account);
}
@@ -1633,45 +1664,45 @@ class OperatorQuerySearch implements SearchInterface
break;
- // cash account
+ // cash account
case 'source_is_cash':
- $account = $this->getCashAccount();
+ $account = $this->getCashAccount();
$this->collector->setSourceAccounts(new Collection()->push($account));
break;
case '-source_is_cash':
- $account = $this->getCashAccount();
+ $account = $this->getCashAccount();
$this->collector->excludeSourceAccounts(new Collection()->push($account));
break;
case 'destination_is_cash':
- $account = $this->getCashAccount();
+ $account = $this->getCashAccount();
$this->collector->setDestinationAccounts(new Collection()->push($account));
break;
case '-destination_is_cash':
- $account = $this->getCashAccount();
+ $account = $this->getCashAccount();
$this->collector->excludeDestinationAccounts(new Collection()->push($account));
break;
case 'account_is_cash':
- $account = $this->getCashAccount();
+ $account = $this->getCashAccount();
$this->collector->setAccounts(new Collection()->push($account));
break;
case '-account_is_cash':
- $account = $this->getCashAccount();
+ $account = $this->getCashAccount();
$this->collector->excludeAccounts(new Collection()->push($account));
break;
- // description
+ // description
case 'description_starts':
$this->collector->descriptionStarts([$value]);
@@ -1694,7 +1725,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'description_contains':
- $this->words[] = $value;
+ $this->words[] = $value;
return false;
@@ -1713,10 +1744,10 @@ class OperatorQuerySearch implements SearchInterface
break;
- // currency
+ // currency
case 'currency_is':
- $currency = $this->findCurrency($value);
+ $currency = $this->findCurrency($value);
if ($currency instanceof TransactionCurrency) {
$this->collector->setCurrency($currency);
}
@@ -1728,7 +1759,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-currency_is':
- $currency = $this->findCurrency($value);
+ $currency = $this->findCurrency($value);
if ($currency instanceof TransactionCurrency) {
$this->collector->excludeCurrency($currency);
}
@@ -1740,7 +1771,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'foreign_currency_is':
- $currency = $this->findCurrency($value);
+ $currency = $this->findCurrency($value);
if ($currency instanceof TransactionCurrency) {
$this->collector->setForeignCurrency($currency);
}
@@ -1752,7 +1783,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-foreign_currency_is':
- $currency = $this->findCurrency($value);
+ $currency = $this->findCurrency($value);
if ($currency instanceof TransactionCurrency) {
$this->collector->excludeForeignCurrency($currency);
}
@@ -1763,7 +1794,7 @@ class OperatorQuerySearch implements SearchInterface
break;
- // attachments
+ // attachments
case 'has_attachments':
case '-has_no_attachments':
@@ -1779,7 +1810,7 @@ class OperatorQuerySearch implements SearchInterface
break;
- // categories
+ // categories
case '-has_any_category':
case 'has_no_category':
$this->collector->withoutCategory();
@@ -1793,7 +1824,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'category_is':
- $category = $this->categoryRepository->findByName($value);
+ $category = $this->categoryRepository->findByName($value);
if (null !== $category) {
$this->collector->setCategory($category);
@@ -1805,7 +1836,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-category_is':
- $category = $this->categoryRepository->findByName($value);
+ $category = $this->categoryRepository->findByName($value);
if (null !== $category) {
$this->collector->excludeCategory($category);
@@ -1815,7 +1846,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'category_ends':
- $result = $this->categoryRepository->categoryEndsWith($value, 1337);
+ $result = $this->categoryRepository->categoryEndsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->setCategories($result);
}
@@ -1827,7 +1858,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-category_ends':
- $result = $this->categoryRepository->categoryEndsWith($value, 1337);
+ $result = $this->categoryRepository->categoryEndsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeCategories($result);
}
@@ -1839,7 +1870,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'category_starts':
- $result = $this->categoryRepository->categoryStartsWith($value, 1337);
+ $result = $this->categoryRepository->categoryStartsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->setCategories($result);
}
@@ -1851,7 +1882,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-category_starts':
- $result = $this->categoryRepository->categoryStartsWith($value, 1337);
+ $result = $this->categoryRepository->categoryStartsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeCategories($result);
}
@@ -1863,7 +1894,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'category_contains':
- $result = $this->categoryRepository->searchCategory($value, 1337);
+ $result = $this->categoryRepository->searchCategory($value, 1337);
if ($result->count() > 0) {
$this->collector->setCategories($result);
}
@@ -1875,7 +1906,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-category_contains':
- $result = $this->categoryRepository->searchCategory($value, 1337);
+ $result = $this->categoryRepository->searchCategory($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeCategories($result);
}
@@ -1886,7 +1917,7 @@ class OperatorQuerySearch implements SearchInterface
break;
- // budgets
+ // budgets
case '-has_any_budget':
case 'has_no_budget':
@@ -1901,7 +1932,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'budget_contains':
- $result = $this->budgetRepository->searchBudget($value, 1337);
+ $result = $this->budgetRepository->searchBudget($value, 1337);
if ($result->count() > 0) {
$this->collector->setBudgets($result);
}
@@ -1913,7 +1944,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-budget_contains':
- $result = $this->budgetRepository->searchBudget($value, 1337);
+ $result = $this->budgetRepository->searchBudget($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeBudgets($result);
}
@@ -1925,7 +1956,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'budget_is':
- $budget = $this->budgetRepository->findByName($value);
+ $budget = $this->budgetRepository->findByName($value);
if (null !== $budget) {
$this->collector->setBudget($budget);
@@ -1937,7 +1968,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-budget_is':
- $budget = $this->budgetRepository->findByName($value);
+ $budget = $this->budgetRepository->findByName($value);
if (null !== $budget) {
$this->collector->excludeBudget($budget);
@@ -1949,7 +1980,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'budget_ends':
- $result = $this->budgetRepository->budgetEndsWith($value, 1337);
+ $result = $this->budgetRepository->budgetEndsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->setBudgets($result);
}
@@ -1961,7 +1992,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-budget_ends':
- $result = $this->budgetRepository->budgetEndsWith($value, 1337);
+ $result = $this->budgetRepository->budgetEndsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeBudgets($result);
}
@@ -1973,7 +2004,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'budget_starts':
- $result = $this->budgetRepository->budgetStartsWith($value, 1337);
+ $result = $this->budgetRepository->budgetStartsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->setBudgets($result);
}
@@ -1985,7 +2016,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-budget_starts':
- $result = $this->budgetRepository->budgetStartsWith($value, 1337);
+ $result = $this->budgetRepository->budgetStartsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeBudgets($result);
}
@@ -1996,7 +2027,7 @@ class OperatorQuerySearch implements SearchInterface
break;
- // bill
+ // bill
case '-has_any_bill':
case 'has_no_bill':
@@ -2011,7 +2042,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'bill_contains':
- $result = $this->billRepository->searchBill($value, 1337);
+ $result = $this->billRepository->searchBill($value, 1337);
if ($result->count() > 0) {
$this->collector->setBills($result);
@@ -2023,7 +2054,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-bill_contains':
- $result = $this->billRepository->searchBill($value, 1337);
+ $result = $this->billRepository->searchBill($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeBills($result);
@@ -2035,7 +2066,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'bill_is':
- $bill = $this->billRepository->findByName($value);
+ $bill = $this->billRepository->findByName($value);
if (null !== $bill) {
$this->collector->setBill($bill);
@@ -2047,7 +2078,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-bill_is':
- $bill = $this->billRepository->findByName($value);
+ $bill = $this->billRepository->findByName($value);
if (null !== $bill) {
$this->collector->excludeBills(new Collection()->push($bill));
@@ -2059,7 +2090,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'bill_ends':
- $result = $this->billRepository->billEndsWith($value, 1337);
+ $result = $this->billRepository->billEndsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->setBills($result);
}
@@ -2071,7 +2102,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-bill_ends':
- $result = $this->billRepository->billEndsWith($value, 1337);
+ $result = $this->billRepository->billEndsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeBills($result);
}
@@ -2083,7 +2114,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'bill_starts':
- $result = $this->billRepository->billStartsWith($value, 1337);
+ $result = $this->billRepository->billStartsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->setBills($result);
}
@@ -2095,7 +2126,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-bill_starts':
- $result = $this->billRepository->billStartsWith($value, 1337);
+ $result = $this->billRepository->billStartsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeBills($result);
}
@@ -2106,7 +2137,7 @@ class OperatorQuerySearch implements SearchInterface
break;
- // tags
+ // tags
case '-has_any_tag':
case 'has_no_tag':
@@ -2122,10 +2153,11 @@ class OperatorQuerySearch implements SearchInterface
case '-tag_is_not':
case 'tag_is':
- $result = $this->tagRepository->findByTag($value);
+ $result = $this->tagRepository->findByTag($value);
if (null !== $result) {
- $this->includeTags[] = $result->id;
- $this->includeTags = array_unique($this->includeTags);
+ $index = count($this->includeAllTags);
+ $this->includeAllTags[$index][] = $result->id;
+ $this->includeAllTags[$index] = array_unique($this->includeAllTags[$index] ?? []);
}
// no tags found means search must result in nothing.
if (null === $result) {
@@ -2137,37 +2169,53 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'tag_contains':
- $tags = $this->tagRepository->searchTag($value);
+ $tags = $this->tagRepository->searchTag($value);
if (0 === $tags->count()) {
Log::info(sprintf('No valid tags in "%s"-operator, so search will not return ANY results.', $operator));
Log::warning(sprintf('Call to findNothing() from %s.', $operator));
$this->collector->findNothing();
}
- if ($tags->count() > 0) {
+ if (1 === $tags->count()) {
+ // single tag found, must be this one.
+ $ids = array_values($tags->pluck('id')->toArray());
+ Log::debug('tag_contains: Add tags to includeAllTags', $ids);
+ $index = count($this->includeAllTags);
+ $this->includeAllTags[$index] = array_unique(array_merge($this->includeAllTags[$index] ?? [], $ids));
+ }
+ if ($tags->count() > 1) {
// changed from includeTags to includeAnyTags for #8632
- $ids = array_values($tags->pluck('id')->toArray());
- $this->includeAnyTags = array_unique(array_merge($this->includeAnyTags, $ids));
+ $ids = array_values($tags->pluck('id')->toArray());
+ Log::debug('tag_contains: Add tags to includeAnyTags', $ids);
+ $index = count($this->includeAnyTags);
+ $this->includeAnyTags[$index] = array_unique(array_merge($this->includeAnyTags[$index] ?? [], $ids));
}
break;
case 'tag_starts':
- $tags = $this->tagRepository->tagStartsWith($value);
+ $tags = $this->tagRepository->tagStartsWith($value);
if (0 === $tags->count()) {
Log::info(sprintf('No valid tags in "%s"-operator, so search will not return ANY results.', $operator));
Log::warning(sprintf('Call to findNothing() from %s.', $operator));
$this->collector->findNothing();
}
- if ($tags->count() > 0) {
+ if (1 === $tags->count()) {
+ // single tag found, must be this one.
+ $ids = array_values($tags->pluck('id')->toArray());
+ $index = count($this->includeAllTags);
+ $this->includeAllTags[$index] = array_unique(array_merge($this->includeAllTags[$index] ?? [], $ids));
+ }
+ if ($tags->count() > 1) {
// changed from includeTags to includeAnyTags for #8632
$ids = array_values($tags->pluck('id')->toArray());
- $this->includeAnyTags = array_unique(array_merge($this->includeAnyTags, $ids));
+ $index = count($this->includeAnyTags);
+ $this->includeAnyTags[$index] = array_unique(array_merge($this->includeAnyTags[$index], $ids));
}
break;
case '-tag_starts':
- $tags = $this->tagRepository->tagStartsWith($value);
+ $tags = $this->tagRepository->tagStartsWith($value);
if (0 === $tags->count()) {
Log::info(sprintf('No valid tags in "%s"-operator, so search will not return ANY results.', $operator));
Log::warning(sprintf('Call to findNothing() from %s.', $operator));
@@ -2175,27 +2223,34 @@ class OperatorQuerySearch implements SearchInterface
}
if ($tags->count() > 0) {
$ids = array_values($tags->pluck('id')->toArray());
- $this->excludeTags = array_unique(array_merge($this->includeTags, $ids));
+ $this->excludeTags = array_unique(array_merge($this->excludeTags, $ids));
}
break;
case 'tag_ends':
- $tags = $this->tagRepository->tagEndsWith($value);
+ $tags = $this->tagRepository->tagEndsWith($value);
if (0 === $tags->count()) {
Log::info(sprintf('No valid tags in "%s"-operator, so search will not return ANY results.', $operator));
Log::warning(sprintf('Call to findNothing() from %s.', $operator));
$this->collector->findNothing();
}
+ if (1 === $tags->count()) {
+ // single tag found, must be this one.
+ $ids = array_values($tags->pluck('id')->toArray());
+ $index = count($this->includeAllTags);
+ $this->includeAllTags[$index] = array_unique(array_merge($this->includeAllTags[$index] ?? [], $ids));
+ }
if ($tags->count() > 0) {
- $ids = array_values($tags->pluck('id')->toArray());
- $this->includeTags = array_unique(array_merge($this->includeTags, $ids));
+ $ids = array_values($tags->pluck('id')->toArray());
+ $index = count($this->includeAnyTags);
+ $this->includeAnyTags[$index] = array_unique(array_merge($this->includeAnyTags[$index], $ids));
}
break;
case '-tag_ends':
- $tags = $this->tagRepository->tagEndsWith($value);
+ $tags = $this->tagRepository->tagEndsWith($value);
if (0 === $tags->count()) {
Log::info(sprintf('No valid tags in "%s"-operator, so search will not return ANY results.', $operator));
Log::warning(sprintf('Call to findNothing() from %s.', $operator));
@@ -2203,13 +2258,13 @@ class OperatorQuerySearch implements SearchInterface
}
if ($tags->count() > 0) {
$ids = array_values($tags->pluck('id')->toArray());
- $this->excludeTags = array_unique(array_merge($this->includeTags, $ids));
+ $this->excludeTags = array_unique(array_merge($this->excludeTags, $ids));
}
break;
case '-tag_contains':
- $tags = $this->tagRepository->searchTag($value)->keyBy('id');
+ $tags = $this->tagRepository->searchTag($value)->keyBy('id');
if (0 === $tags->count()) {
Log::info(sprintf('No valid tags in "%s"-operator, so search will not return ANY results.', $operator));
@@ -2225,7 +2280,7 @@ class OperatorQuerySearch implements SearchInterface
case '-tag_is':
case 'tag_is_not':
- $result = $this->tagRepository->findByTag($value);
+ $result = $this->tagRepository->findByTag($value);
if (null !== $result) {
$this->excludeTags[] = $result->id;
$this->excludeTags = array_unique($this->excludeTags);
@@ -2233,7 +2288,7 @@ class OperatorQuerySearch implements SearchInterface
break;
- // notes
+ // notes
case 'notes_contains':
$this->collector->notesContain($value);
@@ -2297,13 +2352,13 @@ class OperatorQuerySearch implements SearchInterface
break;
- // amount
+ // amount
case 'amount_is':
// strip comma's, make dots.
Log::debug(sprintf('Original value "%s"', $value));
- $value = str_replace(',', '.', $value);
- $amount = Steam::positive($value);
+ $value = str_replace(',', '.', $value);
+ $amount = Steam::positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountIs($amount);
@@ -2312,8 +2367,8 @@ class OperatorQuerySearch implements SearchInterface
case '-amount_is':
// strip comma's, make dots.
Log::debug(sprintf('Original value "%s"', $value));
- $value = str_replace(',', '.', $value);
- $amount = Steam::positive($value);
+ $value = str_replace(',', '.', $value);
+ $amount = Steam::positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountIsNot($amount);
@@ -2321,9 +2376,9 @@ class OperatorQuerySearch implements SearchInterface
case 'foreign_amount_is':
// strip comma's, make dots.
- $value = str_replace(',', '.', $value);
+ $value = str_replace(',', '.', $value);
- $amount = Steam::positive($value);
+ $amount = Steam::positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->foreignAmountIs($amount);
@@ -2331,9 +2386,9 @@ class OperatorQuerySearch implements SearchInterface
case '-foreign_amount_is':
// strip comma's, make dots.
- $value = str_replace(',', '.', $value);
+ $value = str_replace(',', '.', $value);
- $amount = Steam::positive($value);
+ $amount = Steam::positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->foreignAmountIsNot($amount);
@@ -2342,9 +2397,9 @@ class OperatorQuerySearch implements SearchInterface
case '-amount_more':
case 'amount_less':
// strip comma's, make dots.
- $value = str_replace(',', '.', $value);
+ $value = str_replace(',', '.', $value);
- $amount = Steam::positive($value);
+ $amount = Steam::positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountLess($amount);
@@ -2353,9 +2408,9 @@ class OperatorQuerySearch implements SearchInterface
case '-foreign_amount_more':
case 'foreign_amount_less':
// strip comma's, make dots.
- $value = str_replace(',', '.', $value);
+ $value = str_replace(',', '.', $value);
- $amount = Steam::positive($value);
+ $amount = Steam::positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->foreignAmountLess($amount);
@@ -2365,8 +2420,8 @@ class OperatorQuerySearch implements SearchInterface
case 'amount_more':
Log::debug(sprintf('Now handling operator "%s"', $operator));
// strip comma's, make dots.
- $value = str_replace(',', '.', $value);
- $amount = Steam::positive($value);
+ $value = str_replace(',', '.', $value);
+ $amount = Steam::positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountMore($amount);
@@ -2376,14 +2431,14 @@ class OperatorQuerySearch implements SearchInterface
case 'foreign_amount_more':
Log::debug(sprintf('Now handling operator "%s"', $operator));
// strip comma's, make dots.
- $value = str_replace(',', '.', $value);
- $amount = Steam::positive($value);
+ $value = str_replace(',', '.', $value);
+ $amount = Steam::positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->foreignAmountMore($amount);
break;
- // transaction type
+ // transaction type
case 'transaction_type':
$this->collector->setTypes([ucfirst($value)]);
@@ -2397,151 +2452,151 @@ class OperatorQuerySearch implements SearchInterface
break;
- // dates
+ // dates
case '-date_on':
case 'date_on':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactDateParams($range, $prohibited);
return false;
case 'date_before':
case '-date_after':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setDateBeforeParams($range);
return false;
case 'date_after':
case '-date_before':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setDateAfterParams($range);
return false;
case 'interest_date_on':
case '-interest_date_on':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactMetaDateParams('interest_date', $range, $prohibited);
return false;
case 'interest_date_before':
case '-interest_date_after':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateBeforeParams('interest_date', $range);
return false;
case 'interest_date_after':
case '-interest_date_before':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateAfterParams('interest_date', $range);
return false;
case 'book_date_on':
case '-book_date_on':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactMetaDateParams('book_date', $range, $prohibited);
return false;
case 'book_date_before':
case '-book_date_after':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateBeforeParams('book_date', $range);
return false;
case 'book_date_after':
case '-book_date_before':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateAfterParams('book_date', $range);
return false;
case 'process_date_on':
case '-process_date_on':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactMetaDateParams('process_date', $range, $prohibited);
return false;
case 'process_date_before':
case '-process_date_after':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateBeforeParams('process_date', $range);
return false;
case 'process_date_after':
case '-process_date_before':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateAfterParams('process_date', $range);
return false;
case 'due_date_on':
case '-due_date_on':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactMetaDateParams('due_date', $range, $prohibited);
return false;
case 'due_date_before':
case '-due_date_after':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateBeforeParams('due_date', $range);
return false;
case 'due_date_after':
case '-due_date_before':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateAfterParams('due_date', $range);
return false;
case 'payment_date_on':
case '-payment_date_on':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactMetaDateParams('payment_date', $range, $prohibited);
return false;
case 'payment_date_before':
case '-payment_date_after':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateBeforeParams('payment_date', $range);
return false;
case 'payment_date_after':
case '-payment_date_before':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateAfterParams('payment_date', $range);
return false;
case 'invoice_date_on':
case '-invoice_date_on':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactMetaDateParams('invoice_date', $range, $prohibited);
return false;
case 'invoice_date_before':
case '-invoice_date_after':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateBeforeParams('invoice_date', $range);
return false;
case 'invoice_date_after':
case '-invoice_date_before':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateAfterParams('invoice_date', $range);
return false;
@@ -2549,7 +2604,7 @@ class OperatorQuerySearch implements SearchInterface
case 'created_at_on':
case '-created_at_on':
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactObjectDateParams('created_at', $range, $prohibited);
return false;
@@ -2557,7 +2612,7 @@ class OperatorQuerySearch implements SearchInterface
case 'created_at_before':
case '-created_at_after':
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setObjectDateBeforeParams('created_at', $range);
return false;
@@ -2565,7 +2620,7 @@ class OperatorQuerySearch implements SearchInterface
case 'created_at_after':
case '-created_at_before':
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setObjectDateAfterParams('created_at', $range);
return false;
@@ -2573,7 +2628,7 @@ class OperatorQuerySearch implements SearchInterface
case 'updated_at_on':
case '-updated_at_on':
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactObjectDateParams('updated_at', $range, $prohibited);
return false;
@@ -2581,7 +2636,7 @@ class OperatorQuerySearch implements SearchInterface
case 'updated_at_before':
case '-updated_at_after':
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setObjectDateBeforeParams('updated_at', $range);
return false;
@@ -2589,12 +2644,12 @@ class OperatorQuerySearch implements SearchInterface
case 'updated_at_after':
case '-updated_at_before':
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setObjectDateAfterParams('updated_at', $range);
return false;
- // external URL
+ // external URL
case '-any_external_url':
case 'no_external_url':
@@ -2660,7 +2715,7 @@ class OperatorQuerySearch implements SearchInterface
break;
- // other fields
+ // other fields
case 'external_id_is':
$this->collector->setExternalId($value);