mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-06 12:45:30 +00:00
Handle excludedWords on Rule management pages as well
This commit is contained in:
@@ -89,16 +89,28 @@ class CreateController extends Controller
|
|||||||
// build triggers from query, if present.
|
// build triggers from query, if present.
|
||||||
$query = (string) $request->get('from_query');
|
$query = (string) $request->get('from_query');
|
||||||
if ('' !== $query) {
|
if ('' !== $query) {
|
||||||
$search = app(SearchInterface::class);
|
$search = app(SearchInterface::class);
|
||||||
$search->parseQuery($query);
|
$search->parseQuery($query);
|
||||||
$words = $search->getWordsAsString();
|
$words = $search->getWords();
|
||||||
$operators = $search->getOperators()->toArray();
|
$excludedWords = $search->getExcludedWords();
|
||||||
if ('' !== $words) {
|
$operators = $search->getOperators()->toArray();
|
||||||
session()->flash('warning', trans('firefly.rule_from_search_words', ['string' => $words]));
|
if (count($words) > 0) {
|
||||||
$operators[] = [
|
session()->flash('warning', trans('firefly.rule_from_search_words', ['string' => implode('', $words)]));
|
||||||
'type' => 'description_contains',
|
foreach($words as $word) {
|
||||||
'value' => $words,
|
$operators[] = [
|
||||||
];
|
'type' => 'description_contains',
|
||||||
|
'value' => $word,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count($excludedWords) > 0) {
|
||||||
|
session()->flash('warning', trans('firefly.rule_from_search_words', ['string' => implode('', $excludedWords)]));
|
||||||
|
foreach($excludedWords as $excludedWord) {
|
||||||
|
$operators[] = [
|
||||||
|
'type' => '-description_contains',
|
||||||
|
'value' => $excludedWord,
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$oldTriggers = $this->parseFromOperators($operators);
|
$oldTriggers = $this->parseFromOperators($operators);
|
||||||
}
|
}
|
||||||
|
@@ -87,11 +87,26 @@ class EditController extends Controller
|
|||||||
if ('' !== $query) {
|
if ('' !== $query) {
|
||||||
$search = app(SearchInterface::class);
|
$search = app(SearchInterface::class);
|
||||||
$search->parseQuery($query);
|
$search->parseQuery($query);
|
||||||
$words = $search->getWordsAsString();
|
$words = $search->getWords();
|
||||||
|
$excludedWords = $search->getExcludedWords();
|
||||||
$operators = $search->getOperators()->toArray();
|
$operators = $search->getOperators()->toArray();
|
||||||
if ('' !== $words) {
|
if (count($words) > 0) {
|
||||||
session()->flash('warning', trans('firefly.rule_from_search_words', ['string' => $words]));
|
session()->flash('warning', trans('firefly.rule_from_search_words', ['string' => implode('', $words)]));
|
||||||
$operators[] = ['type' => 'description_contains', 'value' => $words];
|
foreach($words as $word) {
|
||||||
|
$operators[] = [
|
||||||
|
'type' => 'description_contains',
|
||||||
|
'value' => $word,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count($excludedWords) > 0) {
|
||||||
|
session()->flash('warning', trans('firefly.rule_from_search_words', ['string' => implode('', $excludedWords)]));
|
||||||
|
foreach($excludedWords as $excludedWord) {
|
||||||
|
$operators[] = [
|
||||||
|
'type' => '-description_contains',
|
||||||
|
'value' => $excludedWord,
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$oldTriggers = $this->parseFromOperators($operators);
|
$oldTriggers = $this->parseFromOperators($operators);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user