mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Continue work on search
This commit is contained in:
parent
02687dfe53
commit
be1d5591c4
@ -214,6 +214,51 @@ trait MetaCollection
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function externalIdContains(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 externalIdEnds(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 externalIdStarts(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
|
||||
*/
|
||||
|
@ -305,6 +305,24 @@ interface GroupCollectorInterface
|
||||
*/
|
||||
public function setExternalId(string $externalId): GroupCollectorInterface;
|
||||
|
||||
/**
|
||||
* @param string $externalId
|
||||
* @return GroupCollectorInterface
|
||||
*/
|
||||
public function externalIdContains(string $externalId): GroupCollectorInterface;
|
||||
|
||||
/**
|
||||
* @param string $externalId
|
||||
* @return GroupCollectorInterface
|
||||
*/
|
||||
public function externalIdStarts(string $externalId): GroupCollectorInterface;
|
||||
|
||||
/**
|
||||
* @param string $externalId
|
||||
* @return GroupCollectorInterface
|
||||
*/
|
||||
public function externalIdEnds(string $externalId): GroupCollectorInterface;
|
||||
|
||||
/**
|
||||
* Transactions without an external URL
|
||||
*
|
||||
|
@ -745,9 +745,18 @@ class OperatorQuerySearch implements SearchInterface
|
||||
//
|
||||
// other fields
|
||||
//
|
||||
case 'external_id':
|
||||
case 'external_id_is':
|
||||
$this->collector->setExternalId($value);
|
||||
break;
|
||||
case 'external_id_contains':
|
||||
$this->collector->externalIdContains($value);
|
||||
break;
|
||||
case 'external_id_starts':
|
||||
$this->collector->externalIdStarts($value);
|
||||
break;
|
||||
case 'external_id_ends':
|
||||
$this->collector->externalIdEnds($value);
|
||||
break;
|
||||
case 'internal_reference':
|
||||
$this->collector->setInternalReference($value);
|
||||
break;
|
||||
|
@ -86,12 +86,14 @@ return [
|
||||
'bill' => ['alias' => true, 'alias_for' => 'bill_contains', 'needs_context' => true,],
|
||||
'bill_ends' => ['alias' => false, 'needs_context' => true,],
|
||||
'bill_starts' => ['alias' => false, 'needs_context' => true,],
|
||||
// TODO here we are
|
||||
|
||||
'external_id_is' => ['alias' => false, 'needs_context' => true,],
|
||||
'external_id_contains' => ['alias' => false, 'needs_context' => true,],
|
||||
'external_id' => ['alias' => true, 'alias_for' => 'external_id_contains', 'needs_context' => true,],
|
||||
'external_id_ends' => ['alias' => false, 'needs_context' => true,],
|
||||
'external_id_starts' => ['alias' => false, 'needs_context' => true,],
|
||||
|
||||
// TODO here we are!
|
||||
'internal_reference_is' => ['alias' => false, 'needs_context' => true,],
|
||||
'internal_reference_contains' => ['alias' => false, 'needs_context' => true,],
|
||||
'internal_reference' => ['alias' => true, 'alias_for' => 'internal_reference_contains', 'needs_context' => true,],
|
||||
|
Loading…
Reference in New Issue
Block a user