mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-26 05:26:17 +00:00
🤖 Auto commit for release 'develop' on 2025-08-23
This commit is contained in:
@@ -83,7 +83,7 @@ class CategoryController extends Controller
|
||||
public function overview(SameDateRequest $request): JsonResponse
|
||||
{
|
||||
/** @var Carbon $start */
|
||||
$start = $this->parameters->get('start');
|
||||
$start = $this->parameters->get('start');
|
||||
|
||||
/** @var Carbon $end */
|
||||
$end = $this->parameters->get('end');
|
||||
@@ -94,11 +94,11 @@ class CategoryController extends Controller
|
||||
|
||||
// get journals for entire period:
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector->setRange($start, $end)->withAccountInformation();
|
||||
$collector->setXorAccounts($accounts)->withCategoryInformation();
|
||||
$collector->setTypes([TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::DEPOSIT->value]);
|
||||
$journals = $collector->getExtractedJournals();
|
||||
$journals = $collector->getExtractedJournals();
|
||||
|
||||
/** @var array $journal */
|
||||
foreach ($journals as $journal) {
|
||||
@@ -130,8 +130,8 @@ class CategoryController extends Controller
|
||||
}
|
||||
|
||||
|
||||
$categoryName = $journal['category_name'] ?? (string)trans('firefly.no_category');
|
||||
$key = sprintf('%s-%s', $categoryName, $currencyCode);
|
||||
$categoryName = $journal['category_name'] ?? (string)trans('firefly.no_category');
|
||||
$key = sprintf('%s-%s', $categoryName, $currencyCode);
|
||||
// create arrays
|
||||
$return[$key] ??= [
|
||||
'label' => $categoryName,
|
||||
@@ -167,6 +167,7 @@ class CategoryController extends Controller
|
||||
if (null !== $pcAmount) {
|
||||
$return[$key]['pc_entries']['spent'] = bcadd($return[$key]['pc_entries']['spent'], $pcAmount);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
// positive amount = earned
|
||||
@@ -177,10 +178,10 @@ class CategoryController extends Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
$return = array_values($return);
|
||||
$return = array_values($return);
|
||||
|
||||
// order by amount
|
||||
usort($return, static fn(array $a, array $b) => ((float)$a['entries']['spent'] + (float)$a['entries']['earned']) < ((float)$b['entries']['spent'] + (float)$b['entries']['earned']) ? 1 : -1);
|
||||
usort($return, static fn (array $a, array $b) => ((float)$a['entries']['spent'] + (float)$a['entries']['earned']) < ((float)$b['entries']['spent'] + (float)$b['entries']['earned']) ? 1 : -1);
|
||||
|
||||
return response()->json($this->clean($return));
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class ChartRequest extends FormRequest
|
||||
'end' => 'required|date|after:1970-01-02|before:2038-01-17|after_or_equal:start',
|
||||
'preselected' => sprintf('nullable|in:%s', implode(',', config('firefly.preselected_accounts'))),
|
||||
'period' => sprintf('nullable|in:%s', implode(',', config('firefly.valid_view_ranges'))),
|
||||
'accounts' => 'nullable|array',
|
||||
'accounts' => 'nullable|array',
|
||||
'accounts.*' => 'exists:accounts,id',
|
||||
];
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ class BillEventHandler
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
|
||||
$bill = $event->bill;
|
||||
$bill = $event->bill;
|
||||
|
||||
/** @var bool $preference */
|
||||
$preference = Preferences::getForUser($bill->user, 'notification_bill_reminder', true)->data;
|
||||
|
||||
@@ -505,7 +505,7 @@ class AccountController extends Controller
|
||||
Log::debug(sprintf('Step is %s', $step));
|
||||
$locale = Steam::getLocale();
|
||||
$return = [];
|
||||
$converter = new ExchangeRateConverter();
|
||||
$converter = new ExchangeRateConverter();
|
||||
|
||||
// fix for issue https://github.com/firefly-iii/firefly-iii/issues/8041
|
||||
// have to make sure this chart is always based on the balance at the END of the period.
|
||||
@@ -557,8 +557,8 @@ class AccountController extends Controller
|
||||
Log::debug(sprintf('momentBalance[%s] is now %s', $current->format('Y-m-d H:i:s'), json_encode($momentBalance)));
|
||||
|
||||
// check, perhaps recalculate the amount in currency X if the
|
||||
if($accountCurrency->id !== $this->primaryCurrency->id && $this->convertToPrimary && array_key_exists($accountCurrency->code, $momentBalance)){
|
||||
$converted = $converter->convert($accountCurrency, $this->primaryCurrency, $current, $momentBalance[$accountCurrency->code]);
|
||||
if ($accountCurrency->id !== $this->primaryCurrency->id && $this->convertToPrimary && array_key_exists($accountCurrency->code, $momentBalance)) {
|
||||
$converted = $converter->convert($accountCurrency, $this->primaryCurrency, $current, $momentBalance[$accountCurrency->code]);
|
||||
$momentBalance['pc_balance'] = $converted;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ class BudgetLimitEnrichment implements EnrichmentInterface
|
||||
/** @var BudgetLimit $budgetLimit */
|
||||
foreach ($this->collection as $budgetLimit) {
|
||||
$id = (int)$budgetLimit->id;
|
||||
$filteredExpenses = $this->filterToBudget($expenses, $budgetLimit->budget_id);
|
||||
$filteredExpenses = $this->filterToBudget($expenses, $budgetLimit->budget_id);
|
||||
$filteredExpenses = $repository->sumCollectedExpenses($expenses, $budgetLimit->start_date, $budgetLimit->end_date, $budgetLimit->transactionCurrency, false);
|
||||
$this->expenses[$id] = array_values($filteredExpenses);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user