mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
New search opts
This commit is contained in:
parent
aca008c911
commit
2f50fb38b0
@ -128,6 +128,78 @@ trait MetaCollection
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setExternalUrl(string $url): 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_url');
|
||||||
|
$this->query->where('journal_meta.data', '=', json_encode($url));
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $url
|
||||||
|
* @return GroupCollectorInterface
|
||||||
|
*/
|
||||||
|
public function externalUrlContains(string $url): GroupCollectorInterface
|
||||||
|
{
|
||||||
|
if (false === $this->hasJoinedMetaTables) {
|
||||||
|
$this->hasJoinedMetaTables = true;
|
||||||
|
$this->query->leftJoin('journal_meta', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id');
|
||||||
|
}
|
||||||
|
$url = json_encode($url);
|
||||||
|
$url = str_replace('\\', '\\\\', trim($url, '"'));
|
||||||
|
$this->query->where('journal_meta.name', '=', 'external_url');
|
||||||
|
$this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s%%', $url));
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $url
|
||||||
|
* @return GroupCollectorInterface
|
||||||
|
*/
|
||||||
|
public function externalUrlEnds(string $url): GroupCollectorInterface
|
||||||
|
{
|
||||||
|
if (false === $this->hasJoinedMetaTables) {
|
||||||
|
$this->hasJoinedMetaTables = true;
|
||||||
|
$this->query->leftJoin('journal_meta', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id');
|
||||||
|
}
|
||||||
|
$url = json_encode($url);
|
||||||
|
$url = str_replace('\\', '\\\\', ltrim($url, '"'));
|
||||||
|
$this->query->where('journal_meta.name', '=', 'external_url');
|
||||||
|
$this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s', $url));
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $url
|
||||||
|
* @return GroupCollectorInterface
|
||||||
|
*/
|
||||||
|
public function externalUrlStarts(string $url): GroupCollectorInterface
|
||||||
|
{
|
||||||
|
if (false === $this->hasJoinedMetaTables) {
|
||||||
|
$this->hasJoinedMetaTables = true;
|
||||||
|
$this->query->leftJoin('journal_meta', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id');
|
||||||
|
}
|
||||||
|
$url = json_encode($url);
|
||||||
|
$url = str_replace('\\', '\\\\', rtrim($url, '"'));
|
||||||
|
//var_dump($url);
|
||||||
|
|
||||||
|
$this->query->where('journal_meta.name', '=', 'external_url');
|
||||||
|
$this->query->where('journal_meta.data', 'LIKE', sprintf('%s%%', $url));
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
@ -147,6 +147,24 @@ interface GroupCollectorInterface
|
|||||||
*/
|
*/
|
||||||
public function externalIdStarts(string $externalId): GroupCollectorInterface;
|
public function externalIdStarts(string $externalId): GroupCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $url
|
||||||
|
* @return GroupCollectorInterface
|
||||||
|
*/
|
||||||
|
public function externalUrlContains(string $url): GroupCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $url
|
||||||
|
* @return GroupCollectorInterface
|
||||||
|
*/
|
||||||
|
public function externalUrlEnds(string $url): GroupCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $url
|
||||||
|
* @return GroupCollectorInterface
|
||||||
|
*/
|
||||||
|
public function externalUrlStarts(string $url): GroupCollectorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure the search will find nothing at all, zero results.
|
* Ensure the search will find nothing at all, zero results.
|
||||||
*
|
*
|
||||||
@ -608,6 +626,12 @@ interface GroupCollectorInterface
|
|||||||
*/
|
*/
|
||||||
public function withExternalUrl(): GroupCollectorInterface;
|
public function withExternalUrl(): GroupCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $url
|
||||||
|
* @return GroupCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setExternalUrl(string $url): GroupCollectorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will include notes.
|
* Will include notes.
|
||||||
*
|
*
|
||||||
|
@ -742,6 +742,18 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
case 'any_external_url':
|
case 'any_external_url':
|
||||||
$this->collector->withExternalUrl();
|
$this->collector->withExternalUrl();
|
||||||
break;
|
break;
|
||||||
|
case 'external_url_is':
|
||||||
|
$this->collector->setExternalUrl($value);
|
||||||
|
break;
|
||||||
|
case 'external_url_contains':
|
||||||
|
$this->collector->externalUrlContains($value);
|
||||||
|
break;
|
||||||
|
case 'external_url_starts':
|
||||||
|
$this->collector->externalUrlStarts($value);
|
||||||
|
break;
|
||||||
|
case 'external_url_ends':
|
||||||
|
$this->collector->externalUrlEnds($value);
|
||||||
|
break;
|
||||||
//
|
//
|
||||||
// other fields
|
// other fields
|
||||||
//
|
//
|
||||||
|
@ -92,7 +92,6 @@ return [
|
|||||||
'internal_reference_ends' => ['alias' => false, 'needs_context' => true,],
|
'internal_reference_ends' => ['alias' => false, 'needs_context' => true,],
|
||||||
'internal_reference_starts' => ['alias' => false, 'needs_context' => true,],
|
'internal_reference_starts' => ['alias' => false, 'needs_context' => true,],
|
||||||
|
|
||||||
// TODO here we are.
|
|
||||||
'external_url_is' => ['alias' => false, 'needs_context' => true,],
|
'external_url_is' => ['alias' => false, 'needs_context' => true,],
|
||||||
'external_url_contains' => ['alias' => false, 'needs_context' => true,],
|
'external_url_contains' => ['alias' => false, 'needs_context' => true,],
|
||||||
'external_url' => ['alias' => true, 'alias_for' => 'external_url_contains', 'needs_context' => true,],
|
'external_url' => ['alias' => true, 'alias_for' => 'external_url_contains', 'needs_context' => true,],
|
||||||
@ -100,6 +99,7 @@ return [
|
|||||||
'external_url_starts' => ['alias' => false, 'needs_context' => true,],
|
'external_url_starts' => ['alias' => false, 'needs_context' => true,],
|
||||||
'has_attachments' => ['alias' => false, 'needs_context' => false,],
|
'has_attachments' => ['alias' => false, 'needs_context' => false,],
|
||||||
'has_any_category' => ['alias' => false, 'needs_context' => false,],
|
'has_any_category' => ['alias' => false, 'needs_context' => false,],
|
||||||
|
// TODO here we are
|
||||||
'has_any_budget' => ['alias' => false, 'needs_context' => false,],
|
'has_any_budget' => ['alias' => false, 'needs_context' => false,],
|
||||||
'has_any_bill' => ['alias' => false, 'needs_context' => false,],
|
'has_any_bill' => ['alias' => false, 'needs_context' => false,],
|
||||||
'has_any_tag' => ['alias' => false, 'needs_context' => false,],
|
'has_any_tag' => ['alias' => false, 'needs_context' => false,],
|
||||||
|
Loading…
Reference in New Issue
Block a user