mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-25 08:21:08 -06:00
Fix #3391
This commit is contained in:
parent
7617fe3510
commit
963c3b2a68
@ -58,4 +58,6 @@ trait CollectorProperties
|
||||
private $total;
|
||||
/** @var User The user object. */
|
||||
private $user;
|
||||
|
||||
private bool $hasJoinedMetaTables;
|
||||
}
|
||||
|
@ -310,4 +310,36 @@ trait MetaCollection
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setExternalId(string $externalId): GroupCollectorInterface
|
||||
{
|
||||
if (false === $this->hasJoinedMetaTables) {
|
||||
$this->hasJoinedMetaTables = true;
|
||||
$this->query->leftJoin('journal_meta', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id');
|
||||
}
|
||||
$this->query->where('journal_meta.name', '=', 'external_id');
|
||||
$this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s%%', $externalId));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setInternalReference(string $internalReference): GroupCollectorInterface
|
||||
{
|
||||
if (false === $this->hasJoinedMetaTables) {
|
||||
$this->hasJoinedMetaTables = true;
|
||||
$this->query->leftJoin('journal_meta', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id');
|
||||
}
|
||||
|
||||
$this->query->where('journal_meta.name', '=', 'internal_reference');
|
||||
$this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s%%', $internalReference));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -65,6 +65,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
$this->hasNotesInformation = false;
|
||||
$this->hasJoinedTagTables = false;
|
||||
$this->hasJoinedAttTables = false;
|
||||
$this->hasJoinedMetaTables = false;
|
||||
$this->integerFields = [
|
||||
'transaction_group_id',
|
||||
'user_id',
|
||||
@ -687,5 +688,4 @@ class GroupCollector implements GroupCollectorInterface
|
||||
->orderBy('transaction_journals.description', 'DESC')
|
||||
->orderBy('source.amount', 'DESC');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -426,4 +426,22 @@ interface GroupCollectorInterface
|
||||
*/
|
||||
public function withoutCategory(): GroupCollectorInterface;
|
||||
|
||||
/**
|
||||
* Look for specific external ID's.
|
||||
*
|
||||
* @param string $externalId
|
||||
*
|
||||
* @return GroupCollectorInterface
|
||||
*/
|
||||
public function setExternalId(string $externalId): GroupCollectorInterface;
|
||||
|
||||
/**
|
||||
* Look for specific external ID's.
|
||||
*
|
||||
* @param string $externalId
|
||||
*
|
||||
* @return GroupCollectorInterface
|
||||
*/
|
||||
public function setInternalReference(string $externalId): GroupCollectorInterface;
|
||||
|
||||
}
|
||||
|
@ -298,6 +298,12 @@ class Search implements SearchInterface
|
||||
$updatedAt = new Carbon($modifier['value']);
|
||||
$collector->setUpdatedAt($updatedAt);
|
||||
break;
|
||||
case 'external_id':
|
||||
$collector->setExternalId($modifier['value']);
|
||||
break;
|
||||
case 'internal_reference':
|
||||
$collector->setInternalReference($modifier['value']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$collector->setAccounts($totalAccounts);
|
||||
|
@ -574,7 +574,8 @@ return [
|
||||
'default_locale' => envNonEmpty('DEFAULT_LOCALE', 'equal'),
|
||||
'search_modifiers' => ['amount_is', 'amount', 'amount_max', 'amount_min', 'amount_less', 'amount_more', 'source', 'destination', 'category',
|
||||
'budget', 'bill', 'type', 'date', 'date_before', 'date_after', 'on', 'before', 'after', 'from', 'to', 'tag', 'created_on',
|
||||
'updated_on',],
|
||||
'updated_on', 'external_id', 'internal_reference',],
|
||||
|
||||
// TODO notes has_attachments
|
||||
|
||||
'cer_providers' => [
|
||||
|
@ -278,6 +278,8 @@ return [
|
||||
'search_modifier_after' => 'Transaction date is after :value',
|
||||
'search_modifier_created_on' => 'Transaction was created on :value',
|
||||
'search_modifier_updated_on' => 'Transaction was last updated on :value',
|
||||
'search_modifier_external_id' => 'External ID is ":value"',
|
||||
'search_modifier_internal_reference' => 'Internal reference is ":value"',
|
||||
'modifiers_applies_are' => 'The following modifiers are applied to the search as well:',
|
||||
'general_search_error' => 'An error occurred while searching. Please check the log files for more information.',
|
||||
'search_box' => 'Search',
|
||||
|
Loading…
Reference in New Issue
Block a user