Move search operators to dedicated file and add lots of new ones.

This commit is contained in:
James Cole
2022-03-20 07:42:39 +01:00
parent c000e090fe
commit ba10aa5ca5
12 changed files with 355 additions and 218 deletions

View File

@@ -50,6 +50,6 @@ class Domain
*/
public static function getRuleTriggers(): array
{
return array_keys(config('firefly.search.operators'));
return array_keys(config('search.operators'));
}
}

View File

@@ -116,7 +116,7 @@ trait ModelInformation
protected function getTriggersForBill(Bill $bill): array // get info and augument
{
// See reference nr. 39
$operators = config('firefly.search.operators');
$operators = config('search.operators');
$triggers = [];
foreach ($operators as $key => $operator) {
if ('user_action' !== $key && false === $operator['alias']) {
@@ -168,7 +168,7 @@ trait ModelInformation
private function getTriggersForJournal(TransactionJournal $journal): array
{
// See reference nr. 40
$operators = config('firefly.search.operators');
$operators = config('search.operators');
$triggers = [];
foreach ($operators as $key => $operator) {
if ('user_action' !== $key && false === $operator['alias']) {

View File

@@ -299,7 +299,7 @@ trait RenderPartialViews
protected function getCurrentTriggers(Rule $rule): array // get info from object and present.
{
// See reference nr. 38
$operators = config('firefly.search.operators');
$operators = config('search.operators');
$triggers = [];
foreach ($operators as $key => $operator) {
if ('user_action' !== $key && false === $operator['alias']) {

View File

@@ -79,7 +79,7 @@ trait RuleManagement
protected function getPreviousTriggers(Request $request): array
{
// See reference nr. 34
$operators = config('firefly.search.operators');
$operators = config('search.operators');
$triggers = [];
foreach ($operators as $key => $operator) {
if ('user_action' !== $key && false === $operator['alias']) {
@@ -124,7 +124,7 @@ trait RuleManagement
protected function parseFromOperators(array $submittedOperators): array
{
// See reference nr. 35
$operators = config('firefly.search.operators');
$operators = config('search.operators');
$renderedEntries = [];
$triggers = [];
foreach ($operators as $key => $operator) {

View File

@@ -34,7 +34,7 @@ trait GetRuleConfiguration
*/
protected function getTriggers(): array
{
return array_keys(config('firefly.search.operators'));
return array_keys(config('search.operators'));
}
/**
@@ -42,7 +42,7 @@ trait GetRuleConfiguration
*/
protected function getTriggersWithContext(): array
{
$list = config('firefly.search.operators');
$list = config('search.operators');
$return = [];
foreach ($list as $key => $info) {
if (true === $info['needs_context']) {

View File

@@ -92,7 +92,7 @@ class OperatorQuerySearch implements SearchInterface
$this->invalidOperators = [];
$this->limit = 25;
$this->date = today(config('app.timezone'));
$this->validOperators = array_keys(config('firefly.search.operators'));
$this->validOperators = array_keys(config('search.operators'));
$this->startTime = microtime(true);
$this->accountRepository = app(AccountRepositoryInterface::class);
$this->categoryRepository = app(CategoryRepositoryInterface::class);

View File

@@ -67,7 +67,7 @@ class Rule extends AbstractExtension
return new TwigFunction(
'allRuleTriggers',
static function () {
$ruleTriggers = array_keys(config('firefly.search.operators'));
$ruleTriggers = array_keys(config('search.operators'));
$possibleTriggers = [];
foreach ($ruleTriggers as $key) {
if ('user_action' !== $key) {