🤖 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

@@ -56,10 +56,10 @@ trait AugumentData
/** @var Account $expenseAccount */
foreach ($accounts as $expenseAccount) {
$collection = new Collection();
$collection = new Collection();
$collection->push($expenseAccount);
$revenue = $repository->findByName($expenseAccount->name, [AccountTypeEnum::REVENUE->value]);
$revenue = $repository->findByName($expenseAccount->name, [AccountTypeEnum::REVENUE->value]);
if (null !== $revenue) {
$collection->push($revenue);
}
@@ -113,7 +113,7 @@ trait AugumentData
AccountTypeEnum::ASSET->value,
AccountTypeEnum::DEFAULT->value,
AccountTypeEnum::EXPENSE->value,
AccountTypeEnum::CASH->value
AccountTypeEnum::CASH->value,
]);
$grouped = $accounts->groupBy('id')->toArray();
$return = [];
@@ -124,7 +124,7 @@ trait AugumentData
$return[$accountId] = $grouped[$accountId][0]['name'];
}
}
$return[0] = '(no name)';
$return[0] = '(no name)';
return $return;
}
@@ -144,7 +144,7 @@ trait AugumentData
$return[$budgetId] = $grouped[$budgetId][0]['name'];
}
}
$return[0] = (string) trans('firefly.no_budget');
$return[0] = (string) trans('firefly.no_budget');
return $return;
}
@@ -166,7 +166,7 @@ trait AugumentData
$return[$categoryId] = $grouped[$categoryId][0]['name'];
}
}
$return[0] = (string) trans('firefly.no_category');
$return[0] = (string) trans('firefly.no_category');
return $return;
}
@@ -179,14 +179,14 @@ trait AugumentData
Log::debug('In getLimits');
/** @var OperationsRepositoryInterface $opsRepository */
$opsRepository = app(OperationsRepositoryInterface::class);
$opsRepository = app(OperationsRepositoryInterface::class);
/** @var BudgetLimitRepositoryInterface $blRepository */
$blRepository = app(BudgetLimitRepositoryInterface::class);
$blRepository = app(BudgetLimitRepositoryInterface::class);
$end->endOfMonth();
// properties for cache
$cache = new CacheProperties();
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty($budget->id);
@@ -197,39 +197,39 @@ trait AugumentData
return $cache->get();
}
$set = $blRepository->getBudgetLimits($budget, $start, $end);
$set = $blRepository->getBudgetLimits($budget, $start, $end);
$budgetCollection = new Collection()->push($budget);
// merge sets based on a key, in case of convert to primary currency
$limits = new Collection();
$limits = new Collection();
/** @var BudgetLimit $entry */
foreach ($set as $entry) {
Log::debug(sprintf('Now at budget limit #%d', $entry->id));
$currency = $entry->transactionCurrency;
$currency = $entry->transactionCurrency;
if ($this->convertToPrimary) {
// the sumExpenses method already handles this.
$currency = $this->primaryCurrency;
}
// clone because these objects change each other.
$currentStart = clone $entry->start_date;
$currentEnd = null === $entry->end_date ? null : clone $entry->end_date;
$currentStart = clone $entry->start_date;
$currentEnd = null === $entry->end_date ? null : clone $entry->end_date;
if (null === $currentEnd) {
$currentEnd = clone $currentStart;
$currentEnd->addMonth();
}
// primary currency amount.
$expenses = $opsRepository->sumExpenses($currentStart, $currentEnd, null, $budgetCollection, $entry->transactionCurrency, $this->convertToPrimary);
$spent = $expenses[$currency->id]['sum'] ?? '0';
$expenses = $opsRepository->sumExpenses($currentStart, $currentEnd, null, $budgetCollection, $entry->transactionCurrency, $this->convertToPrimary);
$spent = $expenses[$currency->id]['sum'] ?? '0';
$entry->pc_spent = $spent;
// normal amount:
$expenses = $opsRepository->sumExpenses($currentStart, $currentEnd, null, $budgetCollection, $entry->transactionCurrency);
$spent = $expenses[$entry->transactionCurrency->id]['sum'] ?? '0';
$entry->spent = $spent;
$expenses = $opsRepository->sumExpenses($currentStart, $currentEnd, null, $budgetCollection, $entry->transactionCurrency);
$spent = $expenses[$entry->transactionCurrency->id]['sum'] ?? '0';
$entry->spent = $spent;
$limits->push($entry);
}
@@ -248,7 +248,7 @@ trait AugumentData
/** @var array $journal */
foreach ($array as $journal) {
$name = '(no name)';
$name = '(no name)';
if (TransactionTypeEnum::WITHDRAWAL->value === $journal['transaction_type_type']) {
$name = $journal['destination_account_name'];
}
@@ -271,13 +271,13 @@ trait AugumentData
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$total = $assets->merge($opposing);
$total = $assets->merge($opposing);
$collector->setRange($start, $end)->setTypes([TransactionTypeEnum::WITHDRAWAL->value])->setAccounts($total);
$journals = $collector->getExtractedJournals();
$sum = ['grand_sum' => '0', 'per_currency' => []];
$journals = $collector->getExtractedJournals();
$sum = ['grand_sum' => '0', 'per_currency' => []];
// loop to support multi currency
foreach ($journals as $journal) {
$currencyId = (int) $journal['currency_id'];
$currencyId = (int) $journal['currency_id'];
// if not set, set to zero:
if (!array_key_exists($currencyId, $sum['per_currency'])) {
@@ -286,14 +286,14 @@ trait AugumentData
'currency' => [
'name' => $journal['currency_name'],
'symbol' => $journal['currency_symbol'],
'decimal_places' => $journal['currency_decimal_places']
]
'decimal_places' => $journal['currency_decimal_places'],
],
];
}
// add amount
$sum['per_currency'][$currencyId]['sum'] = bcadd($sum['per_currency'][$currencyId]['sum'], (string) $journal['amount']);
$sum['grand_sum'] = bcadd($sum['grand_sum'], (string) $journal['amount']);
$sum['grand_sum'] = bcadd($sum['grand_sum'], (string) $journal['amount']);
}
return $sum;