mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 18:54:58 +00:00 
			
		
		
		
	Add budget keyword.
This commit is contained in:
		| @@ -67,6 +67,10 @@ class Modifier | ||||
|                 $res = Modifier::category($transaction, $modifier['value']); | ||||
|                 Log::debug(sprintf('Category is %s? %s', $modifier['value'], var_export($res, true))); | ||||
|                 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 string      $search | ||||
|   | ||||
| @@ -193,8 +193,10 @@ class Search implements SearchInterface | ||||
|             /** @var JournalCollectorInterface $collector */ | ||||
|             $collector = app(JournalCollectorInterface::class); | ||||
|             $collector->setUser($this->user); | ||||
|             $collector->setAllAssetAccounts()->setLimit($pageSize)->setPage($page) | ||||
|                 ->withOpposingAccount()->withCategoryInformation(); | ||||
|             $collector->setAllAssetAccounts()->setLimit($pageSize)->setPage($page); | ||||
|             if($this->hasModifiers()) { | ||||
|                 $collector->withOpposingAccount()->withCategoryInformation()->withBudgetInformation(); | ||||
|             } | ||||
|             $set   = $collector->getPaginatedJournals()->getCollection(); | ||||
|             $words = $this->words; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user