mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-29 22:47:42 +00:00
Add budget keyword.
This commit is contained in:
@@ -67,6 +67,10 @@ class Modifier
|
|||||||
$res = Modifier::category($transaction, $modifier['value']);
|
$res = Modifier::category($transaction, $modifier['value']);
|
||||||
Log::debug(sprintf('Category is %s? %s', $modifier['value'], var_export($res, true)));
|
Log::debug(sprintf('Category is %s? %s', $modifier['value'], var_export($res, true)));
|
||||||
break;
|
break;
|
||||||
|
case 'budget':
|
||||||
|
$res = Modifier::budget($transaction, $modifier['value']);
|
||||||
|
Log::debug(sprintf('Budget is %s? %s', $modifier['value'], var_export($res, true)));
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,6 +92,26 @@ class Modifier
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Transaction $transaction
|
||||||
|
* @param string $search
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private static function budget(Transaction $transaction, string $search): bool
|
||||||
|
{
|
||||||
|
$journalBudget = '';
|
||||||
|
if (!is_null($transaction->transaction_journal_budget_name)) {
|
||||||
|
$journalBudget = Steam::decrypt(intval($transaction->transaction_journal_budget_encrypted), $transaction->transaction_journal_budget_name);
|
||||||
|
}
|
||||||
|
$transactionBudget = '';
|
||||||
|
if (!is_null($transaction->transaction_budget_name)) {
|
||||||
|
$journalBudget = Steam::decrypt(intval($transaction->transaction_budget_encrypted), $transaction->transaction_budget_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::stringCompare($journalBudget, $search) || self::stringCompare($transactionBudget, $search);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Transaction $transaction
|
* @param Transaction $transaction
|
||||||
* @param string $search
|
* @param string $search
|
||||||
|
|||||||
@@ -193,8 +193,10 @@ class Search implements SearchInterface
|
|||||||
/** @var JournalCollectorInterface $collector */
|
/** @var JournalCollectorInterface $collector */
|
||||||
$collector = app(JournalCollectorInterface::class);
|
$collector = app(JournalCollectorInterface::class);
|
||||||
$collector->setUser($this->user);
|
$collector->setUser($this->user);
|
||||||
$collector->setAllAssetAccounts()->setLimit($pageSize)->setPage($page)
|
$collector->setAllAssetAccounts()->setLimit($pageSize)->setPage($page);
|
||||||
->withOpposingAccount()->withCategoryInformation();
|
if($this->hasModifiers()) {
|
||||||
|
$collector->withOpposingAccount()->withCategoryInformation()->withBudgetInformation();
|
||||||
|
}
|
||||||
$set = $collector->getPaginatedJournals()->getCollection();
|
$set = $collector->getPaginatedJournals()->getCollection();
|
||||||
$words = $this->words;
|
$words = $this->words;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user