mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-17 07:08:19 +00:00
Clean up code.
This commit is contained in:
@@ -125,7 +125,7 @@ class AccountController extends Controller
|
||||
// grab the difference and find the currency.
|
||||
$startAmount = (string)($startBalances[$accountId][$currencyId] ?? '0');
|
||||
$diff = bcsub((string)$endAmount, $startAmount);
|
||||
$currencies[$currencyId] = $currencies[$currencyId] ?? $this->currencyRepository->find($currencyId);
|
||||
$currencies[$currencyId] ??= $this->currencyRepository->find($currencyId);
|
||||
if (0 !== bccomp($diff, '0')) {
|
||||
// store the values in a temporary array.
|
||||
$tempData[] = [
|
||||
@@ -585,7 +585,7 @@ class AccountController extends Controller
|
||||
// grab the difference and find the currency.
|
||||
$startAmount = (string)($startBalances[$accountId][$currencyId] ?? '0');
|
||||
$diff = bcsub((string)$endAmount, $startAmount);
|
||||
$currencies[$currencyId] = $currencies[$currencyId] ?? $this->currencyRepository->find($currencyId);
|
||||
$currencies[$currencyId] ??= $this->currencyRepository->find($currencyId);
|
||||
if (0 !== bccomp($diff, '0')) {
|
||||
// store the values in a temporary array.
|
||||
$tempData[] = [
|
||||
|
||||
@@ -117,7 +117,7 @@ class BudgetController extends Controller
|
||||
|
||||
foreach ($spent as $row) {
|
||||
$currencyId = $row['currency_id'];
|
||||
$currencies[$currencyId] = $currencies[$currencyId] ?? $row; // don't mind the field 'sum'
|
||||
$currencies[$currencyId] ??= $row; // don't mind the field 'sum'
|
||||
// also store this day's sum:
|
||||
$currencies[$currencyId]['spent'][$label] = $row['sum'];
|
||||
}
|
||||
@@ -237,7 +237,7 @@ class BudgetController extends Controller
|
||||
// group by asset account ID:
|
||||
foreach ($journals as $journal) {
|
||||
$key = sprintf('%d-%d', (int)$journal['source_account_id'], $journal['currency_id']);
|
||||
$result[$key] = $result[$key] ?? [
|
||||
$result[$key] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
@@ -302,7 +302,7 @@ class BudgetController extends Controller
|
||||
$chartData = [];
|
||||
foreach ($journals as $journal) {
|
||||
$key = sprintf('%d-%d', $journal['category_id'], $journal['currency_id']);
|
||||
$result[$key] = $result[$key] ?? [
|
||||
$result[$key] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
@@ -367,7 +367,7 @@ class BudgetController extends Controller
|
||||
/** @var array $journal */
|
||||
foreach ($journals as $journal) {
|
||||
$key = sprintf('%d-%d', $journal['destination_account_id'], $journal['currency_id']);
|
||||
$result[$key] = $result[$key] ?? [
|
||||
$result[$key] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
|
||||
@@ -87,7 +87,7 @@ class BudgetReportController extends Controller
|
||||
foreach ($spent as $currency) {
|
||||
foreach ($currency['budgets'] as $budget) {
|
||||
$title = sprintf('%s (%s)', $budget['name'], $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -124,7 +124,7 @@ class BudgetReportController extends Controller
|
||||
foreach ($budget['transaction_journals'] as $journal) {
|
||||
$categoryName = $journal['category_name'] ?? trans('firefly.no_category');
|
||||
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -161,7 +161,7 @@ class BudgetReportController extends Controller
|
||||
foreach ($currency['budgets'] as $budget) {
|
||||
foreach ($budget['transaction_journals'] as $journal) {
|
||||
$title = sprintf('%s (%s)', $journal['destination_account_name'], $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -198,7 +198,7 @@ class BudgetReportController extends Controller
|
||||
foreach ($spent as $currency) {
|
||||
// add things to chart Data for each currency:
|
||||
$spentKey = sprintf('%d-spent', $currency['currency_id']);
|
||||
$chartData[$spentKey] = $chartData[$spentKey] ?? [
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.spent_in_specific_budget', ['budget' => $budget->name]),
|
||||
@@ -215,7 +215,7 @@ class BudgetReportController extends Controller
|
||||
foreach ($currentBudget['transaction_journals'] as $journal) {
|
||||
$key = $journal['date']->isoFormat($format);
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
|
||||
$chartData[$spentKey]['entries'][$key] ??= '0';
|
||||
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
|
||||
}
|
||||
}
|
||||
@@ -269,7 +269,7 @@ class BudgetReportController extends Controller
|
||||
foreach ($currency['budgets'] as $budget) {
|
||||
foreach ($budget['transaction_journals'] as $journal) {
|
||||
$title = sprintf('%s (%s)', $journal['source_account_name'], $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
|
||||
@@ -235,7 +235,7 @@ class CategoryController extends Controller
|
||||
foreach ($outSet['transaction_journals'] as $journal) {
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$date = $journal['date']->isoFormat($format);
|
||||
$chartData[$outKey]['entries'][$date] = $chartData[$outKey]['entries'][$date] ?? '0';
|
||||
$chartData[$outKey]['entries'][$date] ??= '0';
|
||||
|
||||
$chartData[$outKey]['entries'][$date] = bcadd($amount, $chartData[$outKey]['entries'][$date]);
|
||||
}
|
||||
@@ -244,7 +244,7 @@ class CategoryController extends Controller
|
||||
foreach ($inSet['transaction_journals'] as $journal) {
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$date = $journal['date']->isoFormat($format);
|
||||
$chartData[$inKey]['entries'][$date] = $chartData[$inKey]['entries'][$date] ?? '0';
|
||||
$chartData[$inKey]['entries'][$date] ??= '0';
|
||||
$chartData[$inKey]['entries'][$date] = bcadd($amount, $chartData[$inKey]['entries'][$date]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['budget_name'] ?? trans('firefly.no_budget');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -120,7 +120,7 @@ class CategoryReportController extends Controller
|
||||
/** @var array $category */
|
||||
foreach ($currency['categories'] as $category) {
|
||||
$title = sprintf('%s (%s)', $category['name'], $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -155,7 +155,7 @@ class CategoryReportController extends Controller
|
||||
/** @var array $category */
|
||||
foreach ($currency['categories'] as $category) {
|
||||
$title = sprintf('%s (%s)', $category['name'], $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -192,7 +192,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -228,7 +228,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -264,7 +264,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($spent as $currency) {
|
||||
// add things to chart Data for each currency:
|
||||
$spentKey = sprintf('%d-spent', $currency['currency_id']);
|
||||
$chartData[$spentKey] = $chartData[$spentKey] ?? [
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.spent_in_specific_category', ['category' => $category->name]),
|
||||
@@ -281,7 +281,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($currentCategory['transaction_journals'] as $journal) {
|
||||
$key = $journal['date']->isoFormat($format);
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
|
||||
$chartData[$spentKey]['entries'][$key] ??= '0';
|
||||
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
|
||||
}
|
||||
}
|
||||
@@ -291,7 +291,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($earned as $currency) {
|
||||
// add things to chart Data for each currency:
|
||||
$spentKey = sprintf('%d-earned', $currency['currency_id']);
|
||||
$chartData[$spentKey] = $chartData[$spentKey] ?? [
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.earned_in_specific_category', ['category' => $category->name]),
|
||||
@@ -308,7 +308,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($currentCategory['transaction_journals'] as $journal) {
|
||||
$key = $journal['date']->isoFormat($format);
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
|
||||
$chartData[$spentKey]['entries'][$key] ??= '0';
|
||||
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
|
||||
}
|
||||
}
|
||||
@@ -364,7 +364,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -400,7 +400,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
|
||||
@@ -85,7 +85,7 @@ class DoubleReportController extends Controller
|
||||
foreach ($currency['transaction_journals'] as $journal) {
|
||||
$categoryName = $journal['budget_name'] ?? trans('firefly.no_budget');
|
||||
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -120,7 +120,7 @@ class DoubleReportController extends Controller
|
||||
foreach ($currency['transaction_journals'] as $journal) {
|
||||
$categoryName = $journal['category_name'] ?? trans('firefly.no_category');
|
||||
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -155,7 +155,7 @@ class DoubleReportController extends Controller
|
||||
foreach ($currency['transaction_journals'] as $journal) {
|
||||
$categoryName = $journal['category_name'] ?? trans('firefly.no_category');
|
||||
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -195,7 +195,7 @@ class DoubleReportController extends Controller
|
||||
$spentKey = sprintf('%d-spent', $currency['currency_id']);
|
||||
$name = $this->getCounterpartName($accounts, $account->id, $account->name, $account->iban);
|
||||
|
||||
$chartData[$spentKey] = $chartData[$spentKey] ?? [
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.spent_in_specific_double', ['account' => $name]),
|
||||
@@ -211,7 +211,7 @@ class DoubleReportController extends Controller
|
||||
foreach ($currency['transaction_journals'] as $journal) {
|
||||
$key = $journal['date']->isoFormat($format);
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
|
||||
$chartData[$spentKey]['entries'][$key] ??= '0';
|
||||
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
|
||||
}
|
||||
}
|
||||
@@ -221,7 +221,7 @@ class DoubleReportController extends Controller
|
||||
$earnedKey = sprintf('%d-earned', $currency['currency_id']);
|
||||
$name = $this->getCounterpartName($accounts, $account->id, $account->name, $account->iban);
|
||||
|
||||
$chartData[$earnedKey] = $chartData[$earnedKey] ?? [
|
||||
$chartData[$earnedKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.earned_in_specific_double', ['account' => $name]),
|
||||
@@ -237,7 +237,7 @@ class DoubleReportController extends Controller
|
||||
foreach ($currency['transaction_journals'] as $journal) {
|
||||
$key = $journal['date']->isoFormat($format);
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$chartData[$earnedKey]['entries'][$key] = $chartData[$earnedKey]['entries'][$key] ?? '0';
|
||||
$chartData[$earnedKey]['entries'][$key] ??= '0';
|
||||
$chartData[$earnedKey]['entries'][$key] = bcadd($chartData[$earnedKey]['entries'][$key], $amount);
|
||||
}
|
||||
}
|
||||
@@ -323,7 +323,7 @@ class DoubleReportController extends Controller
|
||||
// do something
|
||||
$tagName = trans('firefly.no_tags');
|
||||
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -341,7 +341,7 @@ class DoubleReportController extends Controller
|
||||
// do something
|
||||
$tagName = $tag['name'];
|
||||
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -383,7 +383,7 @@ class DoubleReportController extends Controller
|
||||
// do something
|
||||
$tagName = trans('firefly.no_tags');
|
||||
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -401,7 +401,7 @@ class DoubleReportController extends Controller
|
||||
// do something
|
||||
$tagName = $tag['name'];
|
||||
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
|
||||
@@ -166,8 +166,8 @@ class ExpenseReportController extends Controller
|
||||
$currentExpense = $expenses[$name] ?? '0';
|
||||
|
||||
// add to sum:
|
||||
$sumOfIncome[$exp->id] = $sumOfIncome[$exp->id] ?? '0';
|
||||
$sumOfExpense[$exp->id] = $sumOfExpense[$exp->id] ?? '0';
|
||||
$sumOfIncome[$exp->id] ??= '0';
|
||||
$sumOfExpense[$exp->id] ??= '0';
|
||||
$sumOfIncome[$exp->id] = bcadd($sumOfIncome[$exp->id], $currentIncome);
|
||||
$sumOfExpense[$exp->id] = bcadd($sumOfExpense[$exp->id], $currentExpense);
|
||||
|
||||
|
||||
@@ -182,14 +182,14 @@ class ReportController extends Controller
|
||||
foreach ($journals as $journal) {
|
||||
$period = $journal['date']->format($format);
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$data[$currencyId] = $data[$currencyId] ?? [
|
||||
$data[$currencyId] ??= [
|
||||
'currency_id' => $currencyId,
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
'currency_name' => $journal['currency_name'],
|
||||
'currency_decimal_places' => (int)$journal['currency_decimal_places'],
|
||||
];
|
||||
$data[$currencyId][$period] = $data[$currencyId][$period] ?? [
|
||||
$data[$currencyId][$period] ??= [
|
||||
'period' => $period,
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
|
||||
@@ -87,7 +87,7 @@ class TagReportController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['budget_name'] ?? trans('firefly.no_budget');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -123,7 +123,7 @@ class TagReportController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['category_name'] ?? trans('firefly.no_category');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -159,7 +159,7 @@ class TagReportController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['category_name'] ?? trans('firefly.no_category');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -195,7 +195,7 @@ class TagReportController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -231,7 +231,7 @@ class TagReportController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -269,7 +269,7 @@ class TagReportController extends Controller
|
||||
foreach ($spent as $currency) {
|
||||
// add things to chart Data for each currency:
|
||||
$spentKey = sprintf('%d-spent', $currency['currency_id']);
|
||||
$chartData[$spentKey] = $chartData[$spentKey] ?? [
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.spent_in_specific_tag', ['tag' => $tag->tag]),
|
||||
@@ -286,7 +286,7 @@ class TagReportController extends Controller
|
||||
foreach ($currentTag['transaction_journals'] as $journal) {
|
||||
$key = $journal['date']->isoFormat($format);
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
|
||||
$chartData[$spentKey]['entries'][$key] ??= '0';
|
||||
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
|
||||
}
|
||||
}
|
||||
@@ -296,7 +296,7 @@ class TagReportController extends Controller
|
||||
foreach ($earned as $currency) {
|
||||
// add things to chart Data for each currency:
|
||||
$spentKey = sprintf('%d-earned', $currency['currency_id']);
|
||||
$chartData[$spentKey] = $chartData[$spentKey] ?? [
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.earned_in_specific_tag', ['tag' => $tag->tag]),
|
||||
@@ -313,7 +313,7 @@ class TagReportController extends Controller
|
||||
foreach ($currentTag['transaction_journals'] as $journal) {
|
||||
$key = $journal['date']->isoFormat($format);
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
|
||||
$chartData[$spentKey]['entries'][$key] ??= '0';
|
||||
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
|
||||
}
|
||||
}
|
||||
@@ -369,7 +369,7 @@ class TagReportController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -405,7 +405,7 @@ class TagReportController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -439,7 +439,7 @@ class TagReportController extends Controller
|
||||
/** @var array $tag */
|
||||
foreach ($currency['tags'] as $tag) {
|
||||
$title = sprintf('%s (%s)', $tag['name'], $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -473,7 +473,7 @@ class TagReportController extends Controller
|
||||
/** @var array $tag */
|
||||
foreach ($currency['tags'] as $tag) {
|
||||
$title = sprintf('%s (%s)', $tag['name'], $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
|
||||
@@ -78,7 +78,7 @@ class TransactionController extends Controller
|
||||
foreach ($result as $journal) {
|
||||
$budget = $journal['budget_name'] ?? (string)trans('firefly.no_budget');
|
||||
$title = sprintf('%s (%s)', $budget, $journal['currency_symbol']);
|
||||
$data[$title] = $data[$title] ?? [
|
||||
$data[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
@@ -131,7 +131,7 @@ class TransactionController extends Controller
|
||||
foreach ($result as $journal) {
|
||||
$category = $journal['category_name'] ?? (string)trans('firefly.no_category');
|
||||
$title = sprintf('%s (%s)', $category, $journal['currency_symbol']);
|
||||
$data[$title] = $data[$title] ?? [
|
||||
$data[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
@@ -184,7 +184,7 @@ class TransactionController extends Controller
|
||||
foreach ($result as $journal) {
|
||||
$name = $journal['destination_account_name'];
|
||||
$title = sprintf('%s (%s)', $name, $journal['currency_symbol']);
|
||||
$data[$title] = $data[$title] ?? [
|
||||
$data[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
@@ -237,7 +237,7 @@ class TransactionController extends Controller
|
||||
foreach ($result as $journal) {
|
||||
$name = $journal['source_account_name'];
|
||||
$title = sprintf('%s (%s)', $name, $journal['currency_symbol']);
|
||||
$data[$title] = $data[$title] ?? [
|
||||
$data[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
|
||||
Reference in New Issue
Block a user