🤖 Auto commit for release 'develop' on 2026-01-23

This commit is contained in:
JC5
2026-01-23 15:14:29 +01:00
parent 8f15a32bd6
commit eeeba86d38
888 changed files with 10732 additions and 10387 deletions

View File

@@ -52,7 +52,7 @@ trait ModelInformation
'oldAction' => 'link_to_bill',
'oldValue' => $bill->name,
'oldChecked' => false,
'count' => 1
'count' => 1,
])->render();
} catch (Throwable $e) {
Log::error(sprintf('Throwable was thrown in getActionsForBill(): %s', $e->getMessage()));
@@ -73,21 +73,21 @@ trait ModelInformation
protected function getLiabilityTypes(): array
{
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class);
$repository = app(AccountRepositoryInterface::class);
// types of liability:
/** @var AccountType $debt */
$debt = $repository->getAccountTypeByType(AccountTypeEnum::DEBT->value);
$debt = $repository->getAccountTypeByType(AccountTypeEnum::DEBT->value);
/** @var AccountType $loan */
$loan = $repository->getAccountTypeByType(AccountTypeEnum::LOAN->value);
$loan = $repository->getAccountTypeByType(AccountTypeEnum::LOAN->value);
/** @var AccountType $mortgage */
$mortgage = $repository->getAccountTypeByType(AccountTypeEnum::MORTGAGE->value);
$liabilityTypes = [
$debt->id => (string) trans(sprintf('firefly.account_type_%s', AccountTypeEnum::DEBT->value)),
$loan->id => (string) trans(sprintf('firefly.account_type_%s', AccountTypeEnum::LOAN->value)),
$mortgage->id => (string) trans(sprintf('firefly.account_type_%s', AccountTypeEnum::MORTGAGE->value))
$mortgage->id => (string) trans(sprintf('firefly.account_type_%s', AccountTypeEnum::MORTGAGE->value)),
];
asort($liabilityTypes);
@@ -112,8 +112,8 @@ trait ModelInformation
protected function getTriggersForBill(Bill $bill): array // get info and argument
{
// TODO duplicate code
$operators = config('search.operators');
$triggers = [];
$operators = config('search.operators');
$triggers = [];
foreach ($operators as $key => $operator) {
if ('user_action' !== $key && false === $operator['alias']) {
$triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key));
@@ -131,7 +131,7 @@ trait ModelInformation
'oldValue' => $values[$index],
'oldChecked' => false,
'count' => $index + 1,
'triggers' => $triggers
'triggers' => $triggers,
])->render();
} catch (Throwable $e) {
Log::debug(sprintf('Throwable was thrown in getTriggersForBill(): %s', $e->getMessage()));
@@ -155,8 +155,8 @@ trait ModelInformation
private function getTriggersForJournal(TransactionJournal $journal): array
{
// TODO duplicated code.
$operators = config('search.operators');
$triggers = [];
$operators = config('search.operators');
$triggers = [];
foreach ($operators as $key => $operator) {
if ('user_action' !== $key && false === $operator['alias']) {
$triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key));
@@ -164,79 +164,79 @@ trait ModelInformation
}
asort($triggers);
$result = [];
$journalTriggers = [];
$values = [];
$index = 0;
$result = [];
$journalTriggers = [];
$values = [];
$index = 0;
// amount, description, category, budget, tags, source, destination, notes, currency type
// ,type
/** @var null|Transaction $source */
$source = $journal->transactions()->where('amount', '<', 0)->first();
$source = $journal->transactions()->where('amount', '<', 0)->first();
/** @var null|Transaction $destination */
$destination = $journal->transactions()->where('amount', '>', 0)->first();
$destination = $journal->transactions()->where('amount', '>', 0)->first();
if (null === $destination || null === $source) {
return $result;
}
// type
$journalTriggers[$index] = 'transaction_type';
$values[$index] = $journal->transactionType->type;
$values[$index] = $journal->transactionType->type;
++$index;
// currency
$journalTriggers[$index] = 'currency_is';
$values[$index] = sprintf('%s (%s)', $journal->transactionCurrency?->name, $journal->transactionCurrency?->code);
$values[$index] = sprintf('%s (%s)', $journal->transactionCurrency?->name, $journal->transactionCurrency?->code);
++$index;
// amount_exactly:
$journalTriggers[$index] = 'amount_is';
$values[$index] = $destination->amount;
$values[$index] = $destination->amount;
++$index;
// description_is:
$journalTriggers[$index] = 'description_is';
$values[$index] = $journal->description;
$values[$index] = $journal->description;
++$index;
// from_account_is
$journalTriggers[$index] = 'source_account_is';
$values[$index] = $source->account->name;
$values[$index] = $source->account->name;
++$index;
// to_account_is
$journalTriggers[$index] = 'destination_account_is';
$values[$index] = $destination->account->name;
$values[$index] = $destination->account->name;
++$index;
// category (if)
$category = $journal->categories()->first();
$category = $journal->categories()->first();
if (null !== $category) {
$journalTriggers[$index] = 'category_is';
$values[$index] = $category->name;
$values[$index] = $category->name;
++$index;
}
// budget (if)
$budget = $journal->budgets()->first();
$budget = $journal->budgets()->first();
if (null !== $budget) {
$journalTriggers[$index] = 'budget_is';
$values[$index] = $budget->name;
$values[$index] = $budget->name;
++$index;
}
// tags (if)
$tags = $journal->tags()->get();
$tags = $journal->tags()->get();
/** @var Tag $tag */
foreach ($tags as $tag) {
$journalTriggers[$index] = 'tag_is';
$values[$index] = $tag->tag;
$values[$index] = $tag->tag;
++$index;
}
// notes (if)
$notes = $journal->notes()->first();
$notes = $journal->notes()->first();
if (null !== $notes) {
$journalTriggers[$index] = 'notes_is';
$values[$index] = $notes->text;
$values[$index] = $notes->text;
}
foreach ($journalTriggers as $ii => $trigger) {
@@ -246,7 +246,7 @@ trait ModelInformation
'oldValue' => $values[$ii],
'oldChecked' => false,
'count' => $ii + 1,
'triggers' => $triggers
'triggers' => $triggers,
];
$string = view('rules.partials.trigger', $renderInfo)->render();
} catch (Throwable $e) {