mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-25 06:51:08 +00:00
🤖 Auto commit for release 'develop' on 2025-04-22
This commit is contained in:
@@ -45,9 +45,10 @@ class PiggyBankEventObserver
|
||||
|
||||
private function updateNativeAmount(PiggyBankEvent $event): void
|
||||
{
|
||||
$user = $event->piggyBank->accounts()->first()?->user;
|
||||
if(null === $user) {
|
||||
$user = $event->piggyBank->accounts()->first()?->user;
|
||||
if (null === $user) {
|
||||
Log::warning('Piggy bank seems to have no accounts. Break.');
|
||||
|
||||
return;
|
||||
}
|
||||
if (!Amount::convertToNative($user)) {
|
||||
|
@@ -176,9 +176,9 @@ class ShowController extends Controller
|
||||
}
|
||||
|
||||
$currencySymbol = $budgetLimit->transactionCurrency->symbol;
|
||||
$page = (int) $request->get('page');
|
||||
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
||||
$subTitle = trans(
|
||||
$page = (int) $request->get('page');
|
||||
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
||||
$subTitle = trans(
|
||||
'firefly.budget_in_period',
|
||||
[
|
||||
'name' => $budget->name,
|
||||
@@ -187,25 +187,25 @@ class ShowController extends Controller
|
||||
'currency' => $budgetLimit->transactionCurrency->name,
|
||||
]
|
||||
);
|
||||
if($this->convertToNative) {
|
||||
if ($this->convertToNative) {
|
||||
$currencySymbol = $this->defaultCurrency->symbol;
|
||||
}
|
||||
|
||||
// collector:
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
|
||||
$collector->setRange($budgetLimit->start_date, $budgetLimit->end_date)->withAccountInformation()
|
||||
->setBudget($budget)->setLimit($pageSize)->setPage($page)->withBudgetInformation()->withCategoryInformation()
|
||||
;
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath(route('budgets.show.limit', [$budget->id, $budgetLimit->id]));
|
||||
|
||||
/** @var Carbon $start */
|
||||
$start = session('first', today(config('app.timezone'))->startOfYear());
|
||||
$end = today(config('app.timezone'));
|
||||
$attachments = $this->repository->getAttachments($budget);
|
||||
$limits = $this->getLimits($budget, $start, $end);
|
||||
$start = session('first', today(config('app.timezone'))->startOfYear());
|
||||
$end = today(config('app.timezone'));
|
||||
$attachments = $this->repository->getAttachments($budget);
|
||||
$limits = $this->getLimits($budget, $start, $end);
|
||||
|
||||
return view('budgets.show', compact('limits', 'attachments', 'budget', 'budgetLimit', 'groups', 'subTitle', 'currencySymbol'));
|
||||
}
|
||||
|
@@ -164,7 +164,7 @@ class BudgetController extends Controller
|
||||
$cache->addProperty($budget->id);
|
||||
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get());
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
$locale = app('steam')->getLocale();
|
||||
$entries = [];
|
||||
@@ -191,7 +191,7 @@ class BudgetController extends Controller
|
||||
$data['datasets'][0]['currency_symbol'] = $currency->symbol;
|
||||
$data['datasets'][0]['currency_code'] = $currency->code;
|
||||
$cache->store($data);
|
||||
//var_dump($data);exit;
|
||||
// var_dump($data);exit;
|
||||
|
||||
return response()->json($data);
|
||||
}
|
||||
|
@@ -169,6 +169,7 @@ trait AugumentData
|
||||
protected function getLimits(Budget $budget, Carbon $start, Carbon $end): Collection // get data + augment with info
|
||||
{
|
||||
Log::debug('In getLimits');
|
||||
|
||||
/** @var OperationsRepositoryInterface $opsRepository */
|
||||
$opsRepository = app(OperationsRepositoryInterface::class);
|
||||
|
||||
@@ -185,7 +186,7 @@ trait AugumentData
|
||||
$cache->addProperty('get-limits');
|
||||
|
||||
if ($cache->has()) {
|
||||
return $cache->get();
|
||||
return $cache->get();
|
||||
}
|
||||
|
||||
$set = $blRepository->getBudgetLimits($budget, $start, $end);
|
||||
@@ -194,32 +195,33 @@ trait AugumentData
|
||||
|
||||
// merge sets based on a key, in case of convert to native
|
||||
$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->convertToNative) {
|
||||
// the sumExpenses method already handles this.
|
||||
$currency = $this->defaultCurrency;
|
||||
$currency = $this->defaultCurrency;
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
// native amount.
|
||||
$expenses = $opsRepository->sumExpenses($currentStart, $currentEnd, null, $budgetCollection, $entry->transactionCurrency, $this->convertToNative);
|
||||
$spent = $expenses[$currency->id]['sum'] ?? '0';
|
||||
$expenses = $opsRepository->sumExpenses($currentStart, $currentEnd, null, $budgetCollection, $entry->transactionCurrency, $this->convertToNative);
|
||||
$spent = $expenses[$currency->id]['sum'] ?? '0';
|
||||
$entry->native_spent = $spent;
|
||||
|
||||
// normal amount:
|
||||
$expenses = $opsRepository->sumExpenses($currentStart, $currentEnd, null, $budgetCollection, $entry->transactionCurrency, false);
|
||||
$spent = $expenses[$entry->transactionCurrency->id]['sum'] ?? '0';
|
||||
$entry->spent = $spent;
|
||||
$expenses = $opsRepository->sumExpenses($currentStart, $currentEnd, null, $budgetCollection, $entry->transactionCurrency, false);
|
||||
$spent = $expenses[$entry->transactionCurrency->id]['sum'] ?? '0';
|
||||
$entry->spent = $spent;
|
||||
|
||||
$limits->push($entry);
|
||||
}
|
||||
|
@@ -232,6 +232,4 @@ class TransactionSummarizer
|
||||
Log::debug(sprintf('Overrule convertToNative to become %s', var_export($convertToNative, true)));
|
||||
$this->convertToNative = $convertToNative;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -78,7 +78,7 @@ return [
|
||||
'running_balance_column' => env('USE_RUNNING_BALANCE', false),
|
||||
// see cer.php for exchange rates feature flag.
|
||||
],
|
||||
'version' => 'develop/2025-04-21',
|
||||
'version' => 'develop/2025-04-22',
|
||||
'api_version' => '2.1.0', // field is no longer used.
|
||||
'db_version' => 25,
|
||||
|
||||
|
20
package-lock.json
generated
20
package-lock.json
generated
@@ -5635,9 +5635,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/electron-to-chromium": {
|
||||
"version": "1.5.139",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.139.tgz",
|
||||
"integrity": "sha512-GGnRYOTdN5LYpwbIr0rwP/ZHOQSvAF6TG0LSzp28uCBb9JiXHJGmaaKw29qjNJc5bGnnp6kXJqRnGMQoELwi5w==",
|
||||
"version": "1.5.140",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.140.tgz",
|
||||
"integrity": "sha512-o82Rj+ONp4Ip7Cl1r7lrqx/pXhbp/lh9DpKcMNscFJdh8ebyRofnc7Sh01B4jx403RI0oqTBvlZ7OBIZLMr2+Q==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
@@ -7489,14 +7489,14 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/json-stable-stringify": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.2.1.tgz",
|
||||
"integrity": "sha512-Lp6HbbBgosLmJbjx0pBLbgvx68FaFU1sdkmBuckmhhJ88kL13OA51CDtR2yJB50eCNMH9wRqtQNNiAqQH4YXnA==",
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.3.0.tgz",
|
||||
"integrity": "sha512-qtYiSSFlwot9XHtF9bD9c7rwKjr+RecWT//ZnPvSmEjpV5mmPOCN4j8UjY5hbjNkOwZ/jQv3J6R1/pL7RwgMsg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.8",
|
||||
"call-bound": "^1.0.3",
|
||||
"call-bound": "^1.0.4",
|
||||
"isarray": "^2.0.5",
|
||||
"jsonify": "^0.0.1",
|
||||
"object-keys": "^1.1.1"
|
||||
@@ -10083,9 +10083,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/sass": {
|
||||
"version": "1.86.3",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.86.3.tgz",
|
||||
"integrity": "sha512-iGtg8kus4GrsGLRDLRBRHY9dNVA78ZaS7xr01cWnS7PEMQyFtTqBiyCrfpTYTZXRWM94akzckYjh8oADfFNTzw==",
|
||||
"version": "1.87.0",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.87.0.tgz",
|
||||
"integrity": "sha512-d0NoFH4v6SjEK7BoX810Jsrhj7IQSYHAHLi/iSpgqKc7LaIDshFRlSg5LOymf9FqQhxEHs2W5ZQXlvy0KD45Uw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
Reference in New Issue
Block a user