Expand search with negated search options

This commit is contained in:
James Cole
2022-09-25 15:31:07 +02:00
parent 80a732b32b
commit 3c33ea959e
8 changed files with 1570 additions and 108 deletions

View File

@@ -72,6 +72,26 @@ trait AccountCollection
return $this;
}
/**
* These accounts must not be included.
*
* @param Collection $accounts
*
* @return GroupCollectorInterface
*/
public function excludeAccounts(Collection $accounts): GroupCollectorInterface
{
if ($accounts->count() > 0) {
$accountIds = $accounts->pluck('id')->toArray();
$this->query->whereNotIn('source.account_id', $accountIds);
$this->query->whereNotIn('destination.account_id', $accountIds);
app('log')->debug(sprintf('GroupCollector: excludeAccounts: %s', implode(', ', $accountIds)));
}
return $this;
}
/**
* Define which accounts can be part of the source and destination transactions.
*
@@ -95,6 +115,29 @@ trait AccountCollection
return $this;
}
/**
* Define which accounts can NOT be part of the source and destination transactions.
*
* @param Collection $accounts
*
* @return GroupCollectorInterface
*/
public function setNotAccounts(Collection $accounts): GroupCollectorInterface
{
if ($accounts->count() > 0) {
$accountIds = $accounts->pluck('id')->toArray();
$this->query->where(
static function (EloquentBuilder $query) use ($accountIds) {
$query->whereNotIn('source.account_id', $accountIds);
$query->whereNotIn('destination.account_id', $accountIds);
}
);
//app('log')->debug(sprintf('GroupCollector: setAccounts: %s', implode(', ', $accountIds)));
}
return $this;
}
/**
* Both source AND destination must be in this list of accounts.
*

View File

@@ -51,6 +51,20 @@ trait AmountCollection
return $this;
}
/**
* @inheritDoc
*/
public function amountIsNot(string $amount): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($amount) {
$q->where('source.amount','!=', app('steam')->negative($amount));
}
);
return $this;
}
/**
* Get transactions where the amount is less than.
*
@@ -106,6 +120,25 @@ trait AmountCollection
return $this;
}
/**
* Get transactions with a specific foreign amount.
*
* @param string $amount
*
* @return GroupCollectorInterface
*/
public function foreignAmountIsNot(string $amount): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($amount) {
$q->whereNull('source.foreign_amount');
$q->orWhere('source.foreign_amount','!=', app('steam')->negative($amount));
}
);
return $this;
}
/**
* Get transactions where the amount is less than.
*

View File

@@ -30,6 +30,7 @@ use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Models\Tag;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Query\JoinClause;
use Illuminate\Support\Collection;
@@ -226,6 +227,53 @@ trait MetaCollection
return $this;
}
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function notesDoNotContain(string $value): GroupCollectorInterface
{
$this->withNotes();
$this->query->where(static function (Builder $q) use ($value) {
$q->whereNull('notes.text');
$q->orWhere('notes.text', 'NOT LIKE', sprintf('%%%s%%', $value));
});
return $this;
}
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function notesDontStartWith(string $value): GroupCollectorInterface
{
$this->withNotes();
$this->query->where(static function (Builder $q) use ($value) {
$q->whereNull('notes.text');
$q->orWhere('notes.text', 'NOT LIKE', sprintf('%s%%', $value));
});
return $this;
}
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function notesDontEndWith(string $value): GroupCollectorInterface
{
$this->withNotes();
$this->query->where(static function (Builder $q) use ($value) {
$q->whereNull('notes.text');
$q->orWhere('notes.text', 'NOT LIKE', sprintf('%%%s', $value));
});
return $this;
}
/**
* @inheritDoc
@@ -276,6 +324,22 @@ trait MetaCollection
return $this;
}
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function notesExactlyNot(string $value): GroupCollectorInterface
{
$this->withNotes();
$this->query->where(static function (Builder $q) use ($value) {
$q->whereNull('notes.text');
$q->orWhere('notes.text', '!=', sprintf('%s', $value));
});
return $this;
}
/**
* @param string $value
*
@@ -338,6 +402,20 @@ trait MetaCollection
return $this;
}
/**
* @inheritDoc
*/
public function excludeBills(Collection $bills): GroupCollectorInterface
{
$this->withBillInformation();
$this->query->where(static function(EloquentBuilder $q1) use ($bills) {
$q1->whereNotIn('transaction_journals.bill_id', $bills->pluck('id')->toArray());
$q1->orWhereNull('transaction_journals.bill_id');
});
return $this;
}
/**
* Limit the search to a specific budget.
*
@@ -391,6 +469,22 @@ trait MetaCollection
return $this;
}
/**
* @inheritDoc
*/
public function excludeBudgets(Collection $budgets): GroupCollectorInterface
{
if ($budgets->count() > 0) {
$this->withBudgetInformation();
$this->query->where(static function (EloquentBuilder $q1) use ($budgets) {
$q1->whereNotIn('budgets.id', $budgets->pluck('id')->toArray());
$q1->orWhereNull('budgets.id');
});
}
return $this;
}
/**
* Limit the search to a specific bunch of categories.
*
@@ -409,17 +503,16 @@ trait MetaCollection
}
/**
* Limit the search to a specific bunch of categories.
*
* @param Collection $categories
*
* @return GroupCollectorInterface
* @inheritDoc
*/
public function setNotCategories(Collection $categories): GroupCollectorInterface
public function excludeCategories(Collection $categories): GroupCollectorInterface
{
if ($categories->count() > 0) {
$this->withCategoryInformation();
$this->query->whereNotIn('categories.id', $categories->pluck('id')->toArray());
$this->query->where(static function (EloquentBuilder $q1) use ($categories) {
$q1->whereNotIn('categories.id', $categories->pluck('id')->toArray());
$q1->orWhereNull('categories.id');
});
}
return $this;
@@ -461,6 +554,44 @@ trait MetaCollection
return $this;
}
/**
* Exclude a specific category.
*
* @param Category $category
*
* @return GroupCollectorInterface
*/
public function excludeCategory(Category $category): GroupCollectorInterface
{
$this->withCategoryInformation();
$this->query->where(static function(EloquentBuilder $q2) use ($category) {
$q2->where('categories.id','!=', $category->id);
$q2->orWhereNull('categories.id');
});
return $this;
}
/**
* Exclude a specific budget.
*
* @param Budget $budget
*
* @return GroupCollectorInterface
*/
public function excludeBudget(Budget $budget): GroupCollectorInterface
{
$this->withBudgetInformation();
$this->query->where(static function(EloquentBuilder $q2) use ($budget) {
$q2->where('budgets.id','!=', $budget->id);
$q2->orWhereNull('budgets.id');
});
return $this;
}
/**
* @inheritDoc
*/

View File

@@ -62,6 +62,16 @@ trait TimeCollection
return $this;
}
/**
* @param string $day
* @return GroupCollectorInterface
*/
public function dayIsNot(string $day): GroupCollectorInterface
{
$this->query->whereDay('transaction_journals.date', '!=', $day);
return $this;
}
/**
* @param string $day
* @param string $field
@@ -142,6 +152,28 @@ trait TimeCollection
return $this;
}
/**
* @param string $day
* @param string $field
* @return GroupCollectorInterface
*/
public function metaDayIsNot(string $day, string $field): GroupCollectorInterface
{
$this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $day): bool {
foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) {
return (int) $day !== $transaction[$field]->day;
}
}
return false;
};
$this->postFilters[] = $filter;
return $this;
}
/**
* @param string $month
* @param string $field
@@ -210,6 +242,28 @@ trait TimeCollection
return $this;
}
/**
* @param string $month
* @param string $field
* @return GroupCollectorInterface
*/
public function metaMonthIsNot(string $month, string $field): GroupCollectorInterface
{
$this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $month): bool {
foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) {
return (int) $month !== $transaction[$field]->month;
}
}
return false;
};
$this->postFilters[] = $filter;
return $this;
}
/**
* @param string $year
* @param string $field
@@ -279,6 +333,28 @@ trait TimeCollection
return $this;
}
/**
* @param string $year
* @param string $field
* @return GroupCollectorInterface
*/
public function metaYearIsNot(string $year, string $field): GroupCollectorInterface
{
$this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $year): bool {
foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) {
return $year !== (string) $transaction[$field]->year;
}
}
return true;
};
$this->postFilters[] = $filter;
return $this;
}
/**
* @param string $month
* @return GroupCollectorInterface
@@ -311,6 +387,16 @@ trait TimeCollection
return $this;
}
/**
* @param string $month
* @return GroupCollectorInterface
*/
public function monthIsNot(string $month): GroupCollectorInterface
{
$this->query->whereMonth('transaction_journals.date', '!=', $month);
return $this;
}
/**
* @param string $day
* @param string $field
@@ -344,6 +430,17 @@ trait TimeCollection
return $this;
}
/**
* @param string $day
* @param string $field
* @return GroupCollectorInterface
*/
public function objectDayIsNot(string $day, string $field): GroupCollectorInterface
{
$this->query->whereDay(sprintf('transaction_journals.%s', $field), '!=', $day);
return $this;
}
/**
* @param string $month
* @param string $field
@@ -377,6 +474,17 @@ trait TimeCollection
return $this;
}
/**
* @param string $month
* @param string $field
* @return GroupCollectorInterface
*/
public function objectMonthIsNot(string $month, string $field): GroupCollectorInterface
{
$this->query->whereMonth(sprintf('transaction_journals.%s', $field), '!=', $month);
return $this;
}
/**
* @param string $year
* @param string $field
@@ -410,6 +518,17 @@ trait TimeCollection
return $this;
}
/**
* @param string $year
* @param string $field
* @return GroupCollectorInterface
*/
public function objectYearIsNot(string $year, string $field): GroupCollectorInterface
{
$this->query->whereYear(sprintf('transaction_journals.%s', $field), '!=', $year);
return $this;
}
/**
* Collect transactions after a specific date.
*
@@ -535,6 +654,37 @@ trait TimeCollection
}
/**
* @param Carbon $start
* @param Carbon $end
* @param string $field
* @return GroupCollectorInterface
*/
public function excludeMetaDateRange(Carbon $start, Carbon $end, string $field): GroupCollectorInterface
{
if ($end < $start) {
[$start, $end] = [$end, $start];
}
$end = clone $end; // this is so weird, but it works if $end and $start secretly point to the same object.
$end->endOfDay();
$start->startOfDay();
$this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $start, $end): bool {
foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon) {
return $transaction[$field]->lt($start) || $transaction[$field]->gt($end);
}
}
return false;
};
$this->postFilters[] = $filter;
return $this;
}
/**
* @param Carbon $date
* @param string $field
@@ -576,6 +726,23 @@ trait TimeCollection
return $this;
}
/**
* @param Carbon $start
* @param Carbon $end
* @param string $field
* @return GroupCollectorInterface
*/
public function excludeObjectRange(Carbon $start, Carbon $end, string $field): GroupCollectorInterface
{
$after = $start->format('Y-m-d 00:00:00');
$before = $end->format('Y-m-d 23:59:59');
$this->query->where(sprintf('transaction_journals.%s', $field), '<', $after);
$this->query->orWhere(sprintf('transaction_journals.%s', $field), '>', $before);
return $this;
}
/**
* Set the start and end time of the results to return.
*
@@ -599,6 +766,27 @@ trait TimeCollection
return $this;
}
/**
* @param Carbon $start
* @param Carbon $end
* @return GroupCollectorInterface
*/
public function excludeRange(Carbon $start, Carbon $end): GroupCollectorInterface
{
if ($end < $start) {
[$start, $end] = [$end, $start];
}
$startStr = $start->format('Y-m-d 00:00:00');
$endStr = $end->format('Y-m-d 23:59:59');
$this->query->where('transaction_journals.date', '<', $startStr);
$this->query->orWhere('transaction_journals.date', '>', $endStr);
return $this;
}
/**
* Collect transactions updated on a specific date.
*
@@ -616,22 +804,44 @@ trait TimeCollection
return $this;
}
/**
* @param string $year
* @return GroupCollectorInterface
*/
public function yearAfter(string $year): GroupCollectorInterface
{
$this->query->whereYear('transaction_journals.date', '>=', $year);
return $this;
}
/**
* @param string $year
* @return GroupCollectorInterface
*/
public function yearBefore(string $year): GroupCollectorInterface
{
$this->query->whereYear('transaction_journals.date', '<=', $year);
return $this;
}
/**
* @param string $year
* @return GroupCollectorInterface
*/
public function yearIs(string $year): GroupCollectorInterface
{
$this->query->whereYear('transaction_journals.date', '=', $year);
return $this;
}
/**
* @param string $year
* @return GroupCollectorInterface
*/
public function yearIsNot(string $year): GroupCollectorInterface
{
$this->query->whereYear('transaction_journals.date', '!=', $year);
return $this;
}
}

View File

@@ -162,6 +162,36 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
/**
* @inheritDoc
*/
public function descriptionDoesNotEnd(array $array): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($array) {
$q->where(
static function (EloquentBuilder $q1) use ($array) {
foreach ($array as $word) {
$keyword = sprintf('%%%s', $word);
$q1->where('transaction_journals.description', 'NOT LIKE', $keyword);
}
}
);
$q->where(
static function (EloquentBuilder $q2) use ($array) {
foreach ($array as $word) {
$keyword = sprintf('%%%s', $word);
$q2->where('transaction_groups.title', 'NOT LIKE', $keyword);
$q2->orWhereNull('transaction_groups.title');
}
}
);
}
);
return $this;
}
/**
* @inheritDoc
*/
@@ -177,6 +207,26 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
/**
* @inheritDoc
*/
public function descriptionIsNot(string $value): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($value) {
$q->where('transaction_journals.description', '!=', $value);
$q->where(
static function (EloquentBuilder $q2) use ($value) {
$q2->where('transaction_groups.title', '!=', $value);
$q2->orWhereNull('transaction_groups.title');
}
);
}
);
return $this;
}
/**
* @inheritDoc
*/
@@ -206,6 +256,36 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
/**
* @inheritDoc
*/
public function descriptionDoesNotStart(array $array): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($array) {
$q->where(
static function (EloquentBuilder $q1) use ($array) {
foreach ($array as $word) {
$keyword = sprintf('%s%%', $word);
$q1->where('transaction_journals.description', 'NOT LIKE', $keyword);
}
}
);
$q->where(
static function (EloquentBuilder $q2) use ($array) {
foreach ($array as $word) {
$keyword = sprintf('%s%%', $word);
$q2->where('transaction_groups.title', 'NOT LIKE', $keyword);
$q2->orWhereNull('transaction_groups.title');
}
}
);
}
);
return $this;
}
/**
*
*/
@@ -546,7 +626,6 @@ class GroupCollector implements GroupCollectorInterface
* @var Closure $function
*/
foreach ($this->postFilters as $function) {
$nextCollection = new Collection;
// loop everything in the current collection
// and save it (or not) in the new collection.
@@ -618,6 +697,30 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
/**
* Limit results to NOT a specific currency, either foreign or normal one.
*
* @param TransactionCurrency $currency
*
* @return GroupCollectorInterface
*/
public function excludeCurrency(TransactionCurrency $currency): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($currency) {
$q->where('source.transaction_currency_id','!=', $currency->id);
$q->where(
static function (EloquentBuilder $q2) use ($currency) {
$q2->where('source.foreign_currency_id','!=', $currency->id);
$q2->orWhereNull('source.foreign_currency_id');
}
);
}
);
return $this;
}
/**
* @inheritDoc
*/
@@ -628,6 +731,19 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
/**
* @inheritDoc
*/
public function excludeForeignCurrency(TransactionCurrency $currency): GroupCollectorInterface
{
$this->query->where(static function(EloquentBuilder $q2) use ($currency) {
$q2->where('source.foreign_currency_id','!=', $currency->id);
$q2->orWhereNull('source.foreign_currency_id');
});
return $this;
}
/**
* Limit the result to a set of specific transaction groups.
*
@@ -643,6 +759,21 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
/**
* Limit the result to NOT a set of specific transaction groups.
*
* @param array $groupIds
*
* @return GroupCollectorInterface
*/
public function excludeIds(array $groupIds): GroupCollectorInterface
{
$this->query->whereNotIn('transaction_groups.id', $groupIds);
return $this;
}
/**
* Limit the result to a set of specific journals.
*
@@ -663,6 +794,26 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
/**
* Limit the result to NOT a set of specific journals.
*
* @param array $journalIds
*
* @return GroupCollectorInterface
*/
public function excludeJournalIds(array $journalIds): GroupCollectorInterface
{
if (!empty($journalIds)) {
// make all integers.
$integerIDs = array_map('intval', $journalIds);
$this->query->whereNotIn('transaction_journals.id', $integerIDs);
}
return $this;
}
/**
* Set the page to get.
*
@@ -688,6 +839,9 @@ class GroupCollector implements GroupCollectorInterface
*/
public function setSearchWords(array $array): GroupCollectorInterface
{
if (0 === count($array)) {
return $this;
}
$this->query->where(
static function (EloquentBuilder $q) use ($array) {
$q->where(
@@ -712,6 +866,43 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
/**
* Search for words in descriptions.
*
* @param array $array
*
* @return GroupCollectorInterface
*/
public function excludeSearchWords(array $array): GroupCollectorInterface
{
if (0 === count($array)) {
return $this;
}
$this->query->where(
static function (EloquentBuilder $q) use ($array) {
$q->where(
static function (EloquentBuilder $q1) use ($array) {
foreach ($array as $word) {
$keyword = sprintf('%%%s%%', $word);
$q1->where('transaction_journals.description', 'NOT LIKE', $keyword);
}
}
);
$q->where(
static function (EloquentBuilder $q2) use ($array) {
foreach ($array as $word) {
$keyword = sprintf('%%%s%%', $word);
$q2->where('transaction_groups.title', 'NOT LIKE', $keyword);
$q2->orWhereNull('transaction_groups.title');
}
}
);
}
);
return $this;
}
/**
* Limit the search to one specific transaction group.
*
@@ -740,6 +931,16 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
/**
* @inheritDoc
*/
public function excludeTypes(array $types): GroupCollectorInterface
{
$this->query->whereNotIn('transaction_types.type', $types);
return $this;
}
/**
* Set the user object and start the query.
*
@@ -842,6 +1043,15 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
/**
* @inheritDoc
*/
public function isNotReconciled(): GroupCollectorInterface
{
$this->query->where('source.reconciled', 0)->where('destination.reconciled', 0);
return $this;
}
/**
* @inheritDoc
*/

View File

@@ -48,6 +48,12 @@ interface GroupCollectorInterface
*/
public function amountIs(string $amount): GroupCollectorInterface;
/**
* @param string $amount
*
* @return GroupCollectorInterface
*/
public function amountIsNot(string $amount): GroupCollectorInterface;
/**
* Only journals that are reconciled.
@@ -56,6 +62,13 @@ interface GroupCollectorInterface
*/
public function isReconciled(): GroupCollectorInterface;
/**
* Only journals that are reconciled.
*
* @return GroupCollectorInterface
*/
public function isNotReconciled(): GroupCollectorInterface;
/**
* @return GroupCollectorInterface
*/
@@ -145,6 +158,12 @@ interface GroupCollectorInterface
*/
public function dayIs(string $day): GroupCollectorInterface;
/**
* @param string $day
* @return GroupCollectorInterface
*/
public function dayIsNot(string $day): GroupCollectorInterface;
/**
* End of the description must match:
*
@@ -154,6 +173,15 @@ interface GroupCollectorInterface
*/
public function descriptionEnds(array $array): GroupCollectorInterface;
/**
* End of the description must not match:
*
* @param array $array
*
* @return GroupCollectorInterface
*/
public function descriptionDoesNotEnd(array $array): GroupCollectorInterface;
/**
* Description must be:
*
@@ -163,6 +191,15 @@ interface GroupCollectorInterface
*/
public function descriptionIs(string $value): GroupCollectorInterface;
/**
* Description must not be:
*
* @param string $value
*
* @return GroupCollectorInterface
*/
public function descriptionIsNot(string $value): GroupCollectorInterface;
/**
* Beginning of the description must match:
*
@@ -172,6 +209,16 @@ interface GroupCollectorInterface
*/
public function descriptionStarts(array $array): GroupCollectorInterface;
/**
* Beginning of the description must not start with:
*
* @param array $array
*
* @return GroupCollectorInterface
*/
public function descriptionDoesNotStart(array $array): GroupCollectorInterface;
/**
* Exclude destination accounts.
*
@@ -190,6 +237,15 @@ interface GroupCollectorInterface
*/
public function excludeSourceAccounts(Collection $accounts): GroupCollectorInterface;
/**
* These accounts must not be accounts.
*
* @param Collection $accounts
*
* @return GroupCollectorInterface
*/
public function excludeAccounts(Collection $accounts): GroupCollectorInterface;
/**
* @param string $externalId
* @return GroupCollectorInterface
@@ -242,6 +298,15 @@ interface GroupCollectorInterface
*/
public function foreignAmountIs(string $amount): GroupCollectorInterface;
/**
* Get transactions with a specific foreign amount.
*
* @param string $amount
*
* @return GroupCollectorInterface
*/
public function foreignAmountIsNot(string $amount): GroupCollectorInterface;
/**
* Get transactions where the amount is less than.
*
@@ -339,6 +404,13 @@ interface GroupCollectorInterface
*/
public function metaDayIs(string $day, string $field): GroupCollectorInterface;
/**
* @param string $day
* @param string $field
* @return GroupCollectorInterface
*/
public function metaDayIsNot(string $day, string $field): GroupCollectorInterface;
/**
* @param string $month
* @param string $field
@@ -360,6 +432,13 @@ interface GroupCollectorInterface
*/
public function metaMonthIs(string $month, string $field): GroupCollectorInterface;
/**
* @param string $month
* @param string $field
* @return GroupCollectorInterface
*/
public function metaMonthIsNot(string $month, string $field): GroupCollectorInterface;
/**
* @param string $year
* @param string $field
@@ -381,6 +460,14 @@ interface GroupCollectorInterface
*/
public function metaYearIs(string $year, string $field): GroupCollectorInterface;
/**
* @param string $year
* @param string $field
* @return GroupCollectorInterface
*/
public function metaYearIsNot(string $year, string $field): GroupCollectorInterface;
/**
* @param string $month
* @return GroupCollectorInterface
@@ -399,6 +486,12 @@ interface GroupCollectorInterface
*/
public function monthIs(string $month): GroupCollectorInterface;
/**
* @param string $month
* @return GroupCollectorInterface
*/
public function monthIsNot(string $month): GroupCollectorInterface;
/**
* @param string $value
*
@@ -406,6 +499,13 @@ interface GroupCollectorInterface
*/
public function notesContain(string $value): GroupCollectorInterface;
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function notesDoNotContain(string $value): GroupCollectorInterface;
/**
* @param string $value
*
@@ -413,6 +513,13 @@ interface GroupCollectorInterface
*/
public function notesEndWith(string $value): GroupCollectorInterface;
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function notesDontEndWith(string $value): GroupCollectorInterface;
/**
* @param string $value
*
@@ -420,6 +527,13 @@ interface GroupCollectorInterface
*/
public function notesExactly(string $value): GroupCollectorInterface;
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function notesExactlyNot(string $value): GroupCollectorInterface;
/**
* @param string $value
*
@@ -427,6 +541,12 @@ interface GroupCollectorInterface
*/
public function notesStartWith(string $value): GroupCollectorInterface;
/**
* @param string $value
* @return GroupCollectorInterface
*/
public function notesDontStartWith(string $value): GroupCollectorInterface;
/**
* @param string $day
* @param string $field
@@ -448,6 +568,13 @@ interface GroupCollectorInterface
*/
public function objectDayIs(string $day, string $field): GroupCollectorInterface;
/**
* @param string $day
* @param string $field
* @return GroupCollectorInterface
*/
public function objectDayIsNot(string $day, string $field): GroupCollectorInterface;
/**
* @param string $month
* @param string $field
@@ -469,6 +596,13 @@ interface GroupCollectorInterface
*/
public function objectMonthIs(string $month, string $field): GroupCollectorInterface;
/**
* @param string $month
* @param string $field
* @return GroupCollectorInterface
*/
public function objectMonthIsNot(string $month, string $field): GroupCollectorInterface;
/**
* @param string $year
* @param string $field
@@ -490,6 +624,13 @@ interface GroupCollectorInterface
*/
public function objectYearIs(string $year, string $field): GroupCollectorInterface;
/**
* @param string $year
* @param string $field
* @return GroupCollectorInterface
*/
public function objectYearIsNot(string $year, string $field): GroupCollectorInterface;
/**
* Define which accounts can be part of the source and destination transactions.
*
@@ -499,6 +640,18 @@ interface GroupCollectorInterface
*/
public function setAccounts(Collection $accounts): GroupCollectorInterface;
/**
* Define which accounts can NOT be part of the source and destination transactions.
*
* @param Collection $accounts
*
* @return GroupCollectorInterface
*/
public function setNotAccounts(Collection $accounts): GroupCollectorInterface;
/**
* Collect transactions after a specific date.
*
@@ -535,6 +688,15 @@ interface GroupCollectorInterface
*/
public function setBills(Collection $bills): GroupCollectorInterface;
/**
* Exclude a specific set of bills
*
* @param Collection $bills
*
* @return GroupCollectorInterface
*/
public function excludeBills(Collection $bills): GroupCollectorInterface;
/**
* Both source AND destination must be in this list of accounts.
*
@@ -553,6 +715,15 @@ interface GroupCollectorInterface
*/
public function setBudget(Budget $budget): GroupCollectorInterface;
/**
* Exclude a budget
*
* @param Budget $budget
*
* @return GroupCollectorInterface
*/
public function excludeBudget(Budget $budget): GroupCollectorInterface;
/**
* Limit the search to a specific set of budgets.
*
@@ -562,6 +733,15 @@ interface GroupCollectorInterface
*/
public function setBudgets(Collection $budgets): GroupCollectorInterface;
/**
* Exclude a budget.
*
* @param Collection $budgets
*
* @return GroupCollectorInterface
*/
public function excludeBudgets(Collection $budgets): GroupCollectorInterface;
/**
* Limit the search to a specific bunch of categories.
*
@@ -572,13 +752,12 @@ interface GroupCollectorInterface
public function setCategories(Collection $categories): GroupCollectorInterface;
/**
* Limit the search not to have a specific bunch of categories.
* Exclude a set of categories.
*
* @param Collection $categories
*
* @return GroupCollectorInterface
*/
public function setNotCategories(Collection $categories): GroupCollectorInterface;
public function excludeCategories(Collection $categories): GroupCollectorInterface;
/**
* Limit the search to a specific category.
@@ -589,6 +768,15 @@ interface GroupCollectorInterface
*/
public function setCategory(Category $category): GroupCollectorInterface;
/**
* Exclude a specific category
*
* @param Category $category
*
* @return GroupCollectorInterface
*/
public function excludeCategory(Category $category): GroupCollectorInterface;
/**
* Collect transactions created on a specific date.
*
@@ -607,6 +795,15 @@ interface GroupCollectorInterface
*/
public function setCurrency(TransactionCurrency $currency): GroupCollectorInterface;
/**
* Limit results to NOT a specific currency, either foreign or normal one.
*
* @param TransactionCurrency $currency
*
* @return GroupCollectorInterface
*/
public function excludeCurrency(TransactionCurrency $currency): GroupCollectorInterface;
/**
* Set destination accounts.
*
@@ -640,6 +837,15 @@ interface GroupCollectorInterface
*/
public function setForeignCurrency(TransactionCurrency $currency): GroupCollectorInterface;
/**
* Limit results to exclude a specific foreign currency.
*
* @param TransactionCurrency $currency
*
* @return GroupCollectorInterface
*/
public function excludeForeignCurrency(TransactionCurrency $currency): GroupCollectorInterface;
/**
* Limit the result to a set of specific transaction groups.
*
@@ -649,6 +855,15 @@ interface GroupCollectorInterface
*/
public function setIds(array $groupIds): GroupCollectorInterface;
/**
* Limit the result to NOT a set of specific transaction groups.
*
* @param array $groupIds
*
* @return GroupCollectorInterface
*/
public function excludeIds(array $groupIds): GroupCollectorInterface;
/**
* Look for specific external ID's.
*
@@ -667,6 +882,15 @@ interface GroupCollectorInterface
*/
public function setJournalIds(array $journalIds): GroupCollectorInterface;
/**
* Limit the result to NOT a set of specific transaction journals.
*
* @param array $journalIds
*
* @return GroupCollectorInterface
*/
public function excludeJournalIds(array $journalIds): GroupCollectorInterface;
/**
* Limit the number of returned entries.
*
@@ -705,6 +929,16 @@ interface GroupCollectorInterface
*/
public function setMetaDateRange(Carbon $start, Carbon $end, string $field): GroupCollectorInterface;
/**
* @param Carbon $start
* @param Carbon $end
* @param string $field
* @return GroupCollectorInterface
*/
public function excludeMetaDateRange(Carbon $start, Carbon $end, string $field): GroupCollectorInterface;
/**
* @param Carbon $date
* @param string $field
@@ -727,6 +961,14 @@ interface GroupCollectorInterface
*/
public function setObjectRange(Carbon $start, Carbon $end, string $field): GroupCollectorInterface;
/**
* @param Carbon $start
* @param Carbon $end
* @param string $field
* @return GroupCollectorInterface
*/
public function excludeObjectRange(Carbon $start, Carbon $end, string $field): GroupCollectorInterface;
/**
* Set the page to get.
*
@@ -746,6 +988,13 @@ interface GroupCollectorInterface
*/
public function setRange(Carbon $start, Carbon $end): GroupCollectorInterface;
/**
* @param Carbon $start
* @param Carbon $end
* @return GroupCollectorInterface
*/
public function excludeRange(Carbon $start, Carbon $end): GroupCollectorInterface;
/**
* Look for specific recurring ID's.
*
@@ -764,6 +1013,15 @@ interface GroupCollectorInterface
*/
public function setSearchWords(array $array): GroupCollectorInterface;
/**
* Exclude words in descriptions.
*
* @param array $array
*
* @return GroupCollectorInterface
*/
public function excludeSearchWords(array $array): GroupCollectorInterface;
/**
* Set source accounts.
*
@@ -809,6 +1067,15 @@ interface GroupCollectorInterface
*/
public function setTypes(array $types): GroupCollectorInterface;
/**
* Limit the included transaction types.
*
* @param array $types
*
* @return GroupCollectorInterface
*/
public function excludeTypes(array $types): GroupCollectorInterface;
/**
* Collect transactions updated on a specific date.
*
@@ -1000,5 +1267,11 @@ interface GroupCollectorInterface
*/
public function yearIs(string $year): GroupCollectorInterface;
/**
* @param string $year
* @return GroupCollectorInterface
*/
public function yearIsNot(string $year): GroupCollectorInterface;
}