mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-18 07:38:29 +00:00
Clean up code.
This commit is contained in:
@@ -152,7 +152,7 @@ class CreateController extends Controller
|
||||
|
||||
// update preferences if necessary:
|
||||
$frontPage = app('preferences')->get('frontPageAccounts', [])->data;
|
||||
if(!is_array($frontPage)) {
|
||||
if (!is_array($frontPage)) {
|
||||
$frontPage = [];
|
||||
}
|
||||
if (AccountType::ASSET === $account->accountType->type) {
|
||||
|
||||
@@ -94,7 +94,7 @@ class EditController extends Controller
|
||||
$hasLocation = null !== $location;
|
||||
$locations = [
|
||||
'location' => [
|
||||
'latitude' => null !== old('location_latitude') ? old('location_latitude'): $latitude,
|
||||
'latitude' => null !== old('location_latitude') ? old('location_latitude') : $latitude,
|
||||
'longitude' => null !== old('location_longitude') ? old('location_longitude') : $longitude,
|
||||
'zoom_level' => null !== old('location_zoom_level') ? old('location_zoom_level') : $zoomLevel,
|
||||
'has_location' => $hasLocation || 'true' === old('location_has_location'),
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace FireflyIII\Http\Controllers\Admin;
|
||||
use FireflyIII\Events\AdminRequestedTestMessage;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Http\Middleware\IsDemoUser;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
use FireflyIII\Support\Notifications\UrlValidator;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
|
||||
@@ -170,7 +170,7 @@ class UserController extends Controller
|
||||
$subTitle = (string)trans('firefly.user_administration');
|
||||
$subTitleIcon = 'fa-users';
|
||||
$users = $this->repository->all();
|
||||
$singleUserMode = (bool) app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$singleUserMode = (bool)app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$allowInvites = false;
|
||||
if (!$this->externalIdentity && $singleUserMode) {
|
||||
// also registration enabled.
|
||||
|
||||
@@ -127,7 +127,7 @@ class AttachmentController extends Controller
|
||||
->header('Expires', '0')
|
||||
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
||||
->header('Pragma', 'public')
|
||||
->header('Content-Length', (string) strlen($content));
|
||||
->header('Content-Length', (string)strlen($content));
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ class TwoFactorController extends Controller
|
||||
private function isBackupCode(string $mfaCode): bool
|
||||
{
|
||||
$list = app('preferences')->get('mfa_recovery', [])->data;
|
||||
if(!is_array($list)) {
|
||||
if (!is_array($list)) {
|
||||
$list = [];
|
||||
}
|
||||
if (in_array($mfaCode, $list, true)) {
|
||||
@@ -187,8 +187,8 @@ class TwoFactorController extends Controller
|
||||
*/
|
||||
private function removeFromBackupCodes(string $mfaCode): void
|
||||
{
|
||||
$list = app('preferences')->get('mfa_recovery', [])->data;
|
||||
if(!is_array($list)) {
|
||||
$list = app('preferences')->get('mfa_recovery', [])->data;
|
||||
if (!is_array($list)) {
|
||||
$list = [];
|
||||
}
|
||||
$newList = array_values(array_diff($list, [$mfaCode]));
|
||||
|
||||
@@ -249,7 +249,7 @@ class IndexController extends Controller
|
||||
* @var array $entry
|
||||
*/
|
||||
foreach ($array as $currencyId => $entry) {
|
||||
$totals[$currencyId] ??= [
|
||||
$totals[$currencyId] ??= [
|
||||
'currency_id' => $currencyId,
|
||||
'currency_code' => $entry['currency_code'],
|
||||
'currency_name' => $entry['currency_name'],
|
||||
|
||||
@@ -135,8 +135,8 @@ class BudgetLimitController extends Controller
|
||||
if (null === $currency || null === $budget) {
|
||||
throw new FireflyException('No valid currency or budget.');
|
||||
}
|
||||
$start = Carbon::createFromFormat('Y-m-d', $request->get('start'));
|
||||
$end = Carbon::createFromFormat('Y-m-d', $request->get('end'));
|
||||
$start = Carbon::createFromFormat('Y-m-d', $request->get('start'));
|
||||
$end = Carbon::createFromFormat('Y-m-d', $request->get('end'));
|
||||
|
||||
if (false === $start || false === $end) {
|
||||
return response()->json([]);
|
||||
|
||||
@@ -106,13 +106,13 @@ class IndexController extends Controller
|
||||
$isCustomRange = session('is_custom_range', false);
|
||||
if (false === $isCustomRange) {
|
||||
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
|
||||
$end ??= app('navigation')->endOfPeriod($start, $range);
|
||||
$end ??= app('navigation')->endOfPeriod($start, $range);
|
||||
}
|
||||
|
||||
// overrule start and end if necessary:
|
||||
if (true === $isCustomRange) {
|
||||
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
|
||||
$end ??= session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$end ??= session('end', today(config('app.timezone'))->endOfMonth());
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ class IndexController extends Controller
|
||||
|
||||
// get budgeted for default currency:
|
||||
if (0 === count($availableBudgets)) {
|
||||
$budgeted = $this->blRepository->budgeted($start, $end, $defaultCurrency, );
|
||||
$budgeted = $this->blRepository->budgeted($start, $end, $defaultCurrency,);
|
||||
$spentArr = $this->opsRepository->sumExpenses($start, $end, null, null, $defaultCurrency);
|
||||
$spent = $spentArr[$defaultCurrency->id]['sum'] ?? '0';
|
||||
unset($spentArr);
|
||||
@@ -194,7 +194,7 @@ class IndexController extends Controller
|
||||
$array['spent'] = $spentArr[$entry->transaction_currency_id]['sum'] ?? '0';
|
||||
|
||||
// budgeted in period:
|
||||
$budgeted = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency, );
|
||||
$budgeted = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency,);
|
||||
$array['budgeted'] = $budgeted;
|
||||
$availableBudgets[] = $array;
|
||||
unset($spentArr);
|
||||
@@ -283,13 +283,12 @@ class IndexController extends Controller
|
||||
foreach ($budget['spent'] as $spent) {
|
||||
$currencyId = $spent['currency_id'];
|
||||
$sums['spent'][$currencyId]
|
||||
??=
|
||||
[
|
||||
'amount' => '0',
|
||||
'currency_id' => $spent['currency_id'],
|
||||
'currency_symbol' => $spent['currency_symbol'],
|
||||
'currency_decimal_places' => $spent['currency_decimal_places'],
|
||||
];
|
||||
??= [
|
||||
'amount' => '0',
|
||||
'currency_id' => $spent['currency_id'],
|
||||
'currency_symbol' => $spent['currency_symbol'],
|
||||
'currency_decimal_places' => $spent['currency_decimal_places'],
|
||||
];
|
||||
$sums['spent'][$currencyId]['amount'] = bcadd($sums['spent'][$currencyId]['amount'], $spent['spent']);
|
||||
}
|
||||
|
||||
@@ -297,23 +296,22 @@ class IndexController extends Controller
|
||||
foreach ($budget['budgeted'] as $budgeted) {
|
||||
$currencyId = $budgeted['currency_id'];
|
||||
$sums['budgeted'][$currencyId]
|
||||
??=
|
||||
[
|
||||
'amount' => '0',
|
||||
'currency_id' => $budgeted['currency_id'],
|
||||
'currency_symbol' => $budgeted['currency_symbol'],
|
||||
'currency_decimal_places' => $budgeted['currency_decimal_places'],
|
||||
];
|
||||
??= [
|
||||
'amount' => '0',
|
||||
'currency_id' => $budgeted['currency_id'],
|
||||
'currency_symbol' => $budgeted['currency_symbol'],
|
||||
'currency_decimal_places' => $budgeted['currency_decimal_places'],
|
||||
];
|
||||
$sums['budgeted'][$currencyId]['amount'] = bcadd($sums['budgeted'][$currencyId]['amount'], $budgeted['amount']);
|
||||
|
||||
// also calculate how much left from budgeted:
|
||||
$sums['left'][$currencyId] ??=
|
||||
[
|
||||
'amount' => '0',
|
||||
'currency_id' => $budgeted['currency_id'],
|
||||
'currency_symbol' => $budgeted['currency_symbol'],
|
||||
'currency_decimal_places' => $budgeted['currency_decimal_places'],
|
||||
];
|
||||
$sums['left'][$currencyId]
|
||||
??= [
|
||||
'amount' => '0',
|
||||
'currency_id' => $budgeted['currency_id'],
|
||||
'currency_symbol' => $budgeted['currency_symbol'],
|
||||
'currency_decimal_places' => $budgeted['currency_decimal_places'],
|
||||
];
|
||||
}
|
||||
}
|
||||
// final calculation for 'left':
|
||||
|
||||
@@ -90,7 +90,7 @@ class ShowController extends Controller
|
||||
/** @var Carbon $start */
|
||||
$start ??= session('start');
|
||||
/** @var Carbon $end */
|
||||
$end ??= session('end');
|
||||
$end ??= session('end');
|
||||
$subTitle = trans(
|
||||
'firefly.without_budget_between',
|
||||
['start' => $start->isoFormat($this->monthAndDayFormat), 'end' => $end->isoFormat($this->monthAndDayFormat)]
|
||||
|
||||
@@ -86,7 +86,7 @@ class NoCategoryController extends Controller
|
||||
/** @var Carbon $start */
|
||||
$start ??= session('start');
|
||||
/** @var Carbon $end */
|
||||
$end ??= session('end');
|
||||
$end ??= session('end');
|
||||
$page = (int)$request->get('page');
|
||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||
$subTitle = trans(
|
||||
|
||||
@@ -88,7 +88,7 @@ class ShowController extends Controller
|
||||
/** @var Carbon $start */
|
||||
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
$end ??= session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$end ??= session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$subTitleIcon = 'fa-bookmark';
|
||||
$page = (int)$request->get('page');
|
||||
$attachments = $this->repository->getAttachments($category);
|
||||
|
||||
@@ -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] ??= [
|
||||
'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] ??= [
|
||||
'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] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
|
||||
@@ -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] ??= [
|
||||
'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] ??= [
|
||||
'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] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -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] ??= [
|
||||
'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] ??= [
|
||||
'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] ??= [
|
||||
'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] ??= [
|
||||
'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] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -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] ??= [
|
||||
'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] ??= [
|
||||
'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] ??= [
|
||||
'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] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
|
||||
@@ -147,7 +147,7 @@ class ExpenseReportController extends Controller
|
||||
|
||||
while ($currentStart < $end) {
|
||||
$currentEnd = clone $currentStart;
|
||||
$currentEnd = $currentEnd->$function(); /** @phpstan-ignore-line */
|
||||
$currentEnd = $currentEnd->$function(); // @phpstan-ignore-line
|
||||
|
||||
// get expenses grouped by opposing name:
|
||||
$expenses = $this->groupByName($this->getExpensesForOpposing($accounts, $all, $currentStart, $currentEnd));
|
||||
@@ -166,7 +166,7 @@ class ExpenseReportController extends Controller
|
||||
$currentExpense = $expenses[$name] ?? '0';
|
||||
|
||||
// add to sum:
|
||||
$sumOfIncome[$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,7 +182,7 @@ class ReportController extends Controller
|
||||
foreach ($journals as $journal) {
|
||||
$period = $journal['date']->format($format);
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$data[$currencyId] ??= [
|
||||
$data[$currencyId] ??= [
|
||||
'currency_id' => $currencyId,
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
|
||||
@@ -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] ??= [
|
||||
'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] ??= [
|
||||
'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] ??= [
|
||||
'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] ??= [
|
||||
'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] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -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] ??= [
|
||||
'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] ??= [
|
||||
'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] ??= [
|
||||
'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] ??= [
|
||||
'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] ??= [
|
||||
'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] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
|
||||
@@ -57,7 +57,7 @@ abstract class Controller extends BaseController
|
||||
{
|
||||
// is site a demo site?
|
||||
$isDemoSiteConfig = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site', false));
|
||||
$isDemoSite = (bool) $isDemoSiteConfig->data;
|
||||
$isDemoSite = (bool)$isDemoSiteConfig->data;
|
||||
app('view')->share('IS_DEMO_SITE', $isDemoSite);
|
||||
app('view')->share('DEMO_USERNAME', config('firefly.demo_username'));
|
||||
app('view')->share('DEMO_PASSWORD', config('firefly.demo_password'));
|
||||
|
||||
@@ -42,6 +42,7 @@ use Illuminate\View\View;
|
||||
use Monolog\Handler\RotatingFileHandler;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use const PHP_SAPI;
|
||||
|
||||
/**
|
||||
* Class DebugController
|
||||
@@ -127,7 +128,7 @@ class DebugController extends Controller
|
||||
// get latest log file:
|
||||
$logger = Log::driver();
|
||||
// PHPstan doesn't recognize the method because of its polymorphic nature.
|
||||
$handlers = $logger->getHandlers(); /** @phpstan-ignore-line */
|
||||
$handlers = $logger->getHandlers(); // @phpstan-ignore-line
|
||||
$logContent = '';
|
||||
foreach ($handlers as $handler) {
|
||||
if ($handler instanceof RotatingFileHandler) {
|
||||
@@ -172,7 +173,7 @@ class DebugController extends Controller
|
||||
'db_version' => app('fireflyconfig')->get('db_version', 1)->data,
|
||||
'php_version' => PHP_VERSION,
|
||||
'php_os' => PHP_OS,
|
||||
'interface' => \PHP_SAPI,
|
||||
'interface' => PHP_SAPI,
|
||||
'bcscale' => bcscale(),
|
||||
'display_errors' => ini_get('display_errors'),
|
||||
'error_reporting' => $this->errorReporting((int)ini_get('error_reporting')),
|
||||
@@ -277,7 +278,7 @@ class DebugController extends Controller
|
||||
$result = setlocale(LC_ALL, $code);
|
||||
$localeAttempts[$code] = $result === $code;
|
||||
}
|
||||
setlocale(LC_ALL, (string) $original);
|
||||
setlocale(LC_ALL, (string)$original);
|
||||
|
||||
return [
|
||||
'user_id' => auth()->user()->id,
|
||||
|
||||
@@ -102,7 +102,7 @@ class IndexController extends Controller
|
||||
->header('Expires', '0')
|
||||
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
||||
->header('Pragma', 'public')
|
||||
->header('Content-Length', (string) strlen($result['transactions']));
|
||||
->header('Content-Length', (string)strlen($result['transactions']));
|
||||
|
||||
// return CSV file made from 'transactions' array.
|
||||
return $response;
|
||||
|
||||
@@ -47,7 +47,7 @@ class JavascriptController extends Controller
|
||||
/**
|
||||
* Show info about accounts.
|
||||
*
|
||||
* @param AccountRepositoryInterface $repository
|
||||
* @param AccountRepositoryInterface $repository
|
||||
*
|
||||
* @return Response
|
||||
* @throws ContainerExceptionInterface
|
||||
@@ -101,8 +101,8 @@ class JavascriptController extends Controller
|
||||
/**
|
||||
* Show some common variables to be used in scripts.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param AccountRepositoryInterface $repository
|
||||
* @param Request $request
|
||||
* @param AccountRepositoryInterface $repository
|
||||
*
|
||||
* @return Response
|
||||
* @throws FireflyException
|
||||
|
||||
@@ -86,12 +86,12 @@ class BoxController extends Controller
|
||||
static function (AvailableBudget $availableBudget) use ($currency) { // @phpstan-ignore-line
|
||||
if ($availableBudget->transaction_currency_id === $currency->id) {
|
||||
app('log')->debug(sprintf(
|
||||
'Will include AB #%d: from %s-%s amount %s',
|
||||
$availableBudget->id,
|
||||
$availableBudget->start_date->format('Y-m-d'),
|
||||
$availableBudget->end_date->format('Y-m-d'),
|
||||
$availableBudget->amount
|
||||
));
|
||||
'Will include AB #%d: from %s-%s amount %s',
|
||||
$availableBudget->id,
|
||||
$availableBudget->start_date->format('Y-m-d'),
|
||||
$availableBudget->end_date->format('Y-m-d'),
|
||||
$availableBudget->amount
|
||||
));
|
||||
return $availableBudget;
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ class BoxController extends Controller
|
||||
$amount = $journal['amount'] ?? '0';
|
||||
$incomes[$currencyId] ??= '0';
|
||||
$incomes[$currencyId] = bcadd($incomes[$currencyId], app('steam')->positive($amount));
|
||||
$sums[$currencyId] ??= '0';
|
||||
$sums[$currencyId] ??= '0';
|
||||
$sums[$currencyId] = bcadd($sums[$currencyId], app('steam')->positive($amount));
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ class BoxController extends Controller
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$expenses[$currencyId] ??= '0';
|
||||
$expenses[$currencyId] = bcadd($expenses[$currencyId], $journal['amount'] ?? '0');
|
||||
$sums[$currencyId] ??= '0';
|
||||
$sums[$currencyId] ??= '0';
|
||||
$sums[$currencyId] = bcadd($sums[$currencyId], $journal['amount']);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class IntroController extends Controller
|
||||
public function getIntroSteps(string $route, string $specificPage = null): JsonResponse
|
||||
{
|
||||
app('log')->debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
|
||||
$specificPage ??= '';
|
||||
$specificPage ??= '';
|
||||
$steps = $this->getBasicSteps($route);
|
||||
$specificSteps = $this->getSpecificSteps($route, $specificPage);
|
||||
if (0 === count($specificSteps)) {
|
||||
|
||||
@@ -80,7 +80,7 @@ class RecurrenceController extends Controller
|
||||
$repetitions = (int)$request->get('reps');
|
||||
$repetitionMoment = '';
|
||||
|
||||
if(false === $start || false === $end || false === $firstDate || false === $endDate) {
|
||||
if (false === $start || false === $end || false === $firstDate || false === $endDate) {
|
||||
return response()->json();
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ class RecurrenceController extends Controller
|
||||
} catch (InvalidFormatException $e) {
|
||||
$date = Carbon::today(config('app.timezone'));
|
||||
}
|
||||
if(false === $date) {
|
||||
if (false === $date) {
|
||||
return response()->json();
|
||||
}
|
||||
$date->startOfDay();
|
||||
|
||||
@@ -98,8 +98,8 @@ class PreferencesController extends Controller
|
||||
/** @var array<int, int> $accountIds */
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$viewRange = app('navigation')->getViewRange(false);
|
||||
$frontPageAccountsPref = app('preferences')->get('frontPageAccounts', $accountIds);
|
||||
$frontPageAccounts = $frontPageAccountsPref->data;
|
||||
$frontPageAccountsPref = app('preferences')->get('frontPageAccounts', $accountIds);
|
||||
$frontPageAccounts = $frontPageAccountsPref->data;
|
||||
if (!is_array($frontPageAccounts)) {
|
||||
$frontPageAccounts = $accountIds;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ class BalanceController extends Controller
|
||||
foreach ($journals as $journal) {
|
||||
$sourceAccount = $journal['source_account_id'];
|
||||
$currencyId = $journal['currency_id'];
|
||||
$spent[$sourceAccount] ??= [
|
||||
$spent[$sourceAccount] ??= [
|
||||
'source_account_id' => $sourceAccount,
|
||||
'currency_id' => $journal['currency_id'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
@@ -116,7 +116,7 @@ class BalanceController extends Controller
|
||||
$spent[$sourceAccount]['spent'] = bcadd($spent[$sourceAccount]['spent'], $journal['amount']);
|
||||
|
||||
// also fix sum:
|
||||
$report['sums'][$budgetId][$currencyId] ??= [
|
||||
$report['sums'][$budgetId][$currencyId] ??= [
|
||||
'sum' => '0',
|
||||
'currency_id' => $journal['currency_id'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
|
||||
@@ -130,7 +130,7 @@ class BudgetController extends Controller
|
||||
foreach ($currency['budgets'] as $budget) {
|
||||
foreach ($budget['transaction_journals'] as $journal) {
|
||||
$sourceAccountId = $journal['source_account_id'];
|
||||
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
|
||||
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -167,7 +167,7 @@ class BudgetController extends Controller
|
||||
foreach ($budget['transaction_journals'] as $journal) {
|
||||
$destinationId = $journal['destination_account_id'];
|
||||
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
|
||||
$result[$key] ??= [
|
||||
$result[$key] ??= [
|
||||
'transactions' => 0,
|
||||
'sum' => '0',
|
||||
'avg' => '0',
|
||||
@@ -240,7 +240,7 @@ class BudgetController extends Controller
|
||||
|
||||
foreach ($budget['transaction_journals'] as $journal) {
|
||||
// add currency info to report array:
|
||||
$report[$budgetId]['currencies'][$currencyId] ??= [
|
||||
$report[$budgetId]['currencies'][$currencyId] ??= [
|
||||
'sum' => '0',
|
||||
'sum_pct' => '0',
|
||||
'currency_id' => $currency['currency_id'],
|
||||
@@ -332,7 +332,7 @@ class BudgetController extends Controller
|
||||
$count++;
|
||||
$key = sprintf('%d-%d', $budget['id'], $currency['currency_id']);
|
||||
$dateKey = $journal['date']->format($keyFormat);
|
||||
$report[$key] ??= [
|
||||
$report[$key] ??= [
|
||||
'id' => $budget['id'],
|
||||
'name' => sprintf('%s (%s)', $budget['name'], $currency['currency_name']),
|
||||
'sum' => '0',
|
||||
|
||||
@@ -107,13 +107,11 @@ class CategoryController extends Controller
|
||||
];
|
||||
|
||||
$report[$sourceAccountId]['currencies'][$currencyId]['categories'][$category['id']]
|
||||
??=
|
||||
|
||||
[
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
];
|
||||
??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
];
|
||||
$report[$sourceAccountId]['currencies'][$currencyId]['categories'][$category['id']]['spent'] = bcadd(
|
||||
$report[$sourceAccountId]['currencies'][$currencyId]['categories'][$category['id']]['spent'],
|
||||
$journal['amount']
|
||||
@@ -134,22 +132,19 @@ class CategoryController extends Controller
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$destinationId = $journal['destination_account_id'];
|
||||
$report[$destinationId]['currencies'][$currencyId]
|
||||
??=
|
||||
[
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
'currency_decimal_places' => $currency['currency_decimal_places'],
|
||||
'categories' => [],
|
||||
];
|
||||
??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
'currency_decimal_places' => $currency['currency_decimal_places'],
|
||||
'categories' => [],
|
||||
];
|
||||
$report[$destinationId]['currencies'][$currencyId]['categories'][$category['id']]
|
||||
??=
|
||||
|
||||
[
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
];
|
||||
??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
];
|
||||
$report[$destinationId]['currencies'][$currencyId]['categories'][$category['id']]['earned'] = bcadd(
|
||||
$report[$destinationId]['currencies'][$currencyId]['categories'][$category['id']]['earned'],
|
||||
$journal['amount']
|
||||
@@ -205,7 +200,7 @@ class CategoryController extends Controller
|
||||
foreach ($currency['categories'] as $category) {
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$sourceAccountId = $journal['source_account_id'];
|
||||
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
|
||||
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -243,7 +238,7 @@ class CategoryController extends Controller
|
||||
foreach ($currency['categories'] as $category) {
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$destinationAccountId = $journal['destination_account_id'];
|
||||
$report[$destinationAccountId]['currencies'][$currencyId] ??= [
|
||||
$report[$destinationAccountId]['currencies'][$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -287,7 +282,7 @@ class CategoryController extends Controller
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$destinationId = $journal['destination_account_id'];
|
||||
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
|
||||
$result[$key] ??= [
|
||||
$result[$key] ??= [
|
||||
'transactions' => 0,
|
||||
'sum' => '0',
|
||||
'avg' => '0',
|
||||
@@ -415,7 +410,7 @@ class CategoryController extends Controller
|
||||
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
// add currency info to report array:
|
||||
$report[$categoryId]['currencies'][$currencyId] ??= [
|
||||
$report[$categoryId]['currencies'][$currencyId] ??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
@@ -456,7 +451,7 @@ class CategoryController extends Controller
|
||||
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
// add currency info to report array:
|
||||
$report[$categoryId]['currencies'][$currencyId] ??= [
|
||||
$report[$categoryId]['currencies'][$currencyId] ??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
|
||||
@@ -141,7 +141,7 @@ class DoubleController extends Controller
|
||||
foreach ($currency['transaction_journals'] as $journal) {
|
||||
$destinationId = $journal['destination_account_id'];
|
||||
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
|
||||
$result[$key] ??= [
|
||||
$result[$key] ??= [
|
||||
'transactions' => 0,
|
||||
'sum' => '0',
|
||||
'avg' => '0',
|
||||
|
||||
@@ -162,7 +162,7 @@ class OperationsController extends Controller
|
||||
/** @var int $currencyId */
|
||||
foreach ($keys as $currencyId) {
|
||||
$currencyInfo = $incomes['sums'][$currencyId] ?? $expenses['sums'][$currencyId];
|
||||
$sums[$currencyId] ??= [
|
||||
$sums[$currencyId] ??= [
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $currencyInfo['currency_name'],
|
||||
'currency_code' => $currencyInfo['currency_code'],
|
||||
|
||||
@@ -100,13 +100,11 @@ class TagController extends Controller
|
||||
];
|
||||
|
||||
$report[$sourceAccountId]['currencies'][$currencyId]['tags'][$tag['id']]
|
||||
??=
|
||||
|
||||
[
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
];
|
||||
??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
];
|
||||
$report[$sourceAccountId]['currencies'][$currencyId]['tags'][$tag['id']]['spent'] = bcadd(
|
||||
$report[$sourceAccountId]['currencies'][$currencyId]['tags'][$tag['id']]['spent'],
|
||||
$journal['amount']
|
||||
@@ -127,22 +125,19 @@ class TagController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$destinationId = $journal['destination_account_id'];
|
||||
$report[$destinationId]['currencies'][$currencyId]
|
||||
??=
|
||||
[
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
'currency_decimal_places' => $currency['currency_decimal_places'],
|
||||
'tags' => [],
|
||||
];
|
||||
??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
'currency_decimal_places' => $currency['currency_decimal_places'],
|
||||
'tags' => [],
|
||||
];
|
||||
$report[$destinationId]['currencies'][$currencyId]['tags'][$tag['id']]
|
||||
??=
|
||||
|
||||
[
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
];
|
||||
??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
];
|
||||
$report[$destinationId]['currencies'][$currencyId]['tags'][$tag['id']]['earned'] = bcadd(
|
||||
$report[$destinationId]['currencies'][$currencyId]['tags'][$tag['id']]['earned'],
|
||||
$journal['amount']
|
||||
@@ -198,7 +193,7 @@ class TagController extends Controller
|
||||
foreach ($currency['tags'] as $tag) {
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$sourceAccountId = $journal['source_account_id'];
|
||||
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
|
||||
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -236,7 +231,7 @@ class TagController extends Controller
|
||||
foreach ($currency['tags'] as $tag) {
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$destinationAccountId = $journal['destination_account_id'];
|
||||
$report[$destinationAccountId]['currencies'][$currencyId] ??= [
|
||||
$report[$destinationAccountId]['currencies'][$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -280,7 +275,7 @@ class TagController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$destinationId = $journal['destination_account_id'];
|
||||
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
|
||||
$result[$key] ??= [
|
||||
$result[$key] ??= [
|
||||
'transactions' => 0,
|
||||
'sum' => '0',
|
||||
'avg' => '0',
|
||||
@@ -408,7 +403,7 @@ class TagController extends Controller
|
||||
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
// add currency info to report array:
|
||||
$report[$tagId]['currencies'][$currencyId] ??= [
|
||||
$report[$tagId]['currencies'][$currencyId] ??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
@@ -449,7 +444,7 @@ class TagController extends Controller
|
||||
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
// add currency info to report array:
|
||||
$report[$tagId]['currencies'][$currencyId] ??= [
|
||||
$report[$tagId]['currencies'][$currencyId] ??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
|
||||
@@ -49,7 +49,8 @@ use Psr\Container\NotFoundExceptionInterface;
|
||||
class ReportController extends Controller
|
||||
{
|
||||
use RenderPartialViews;
|
||||
protected ReportHelperInterface $helper;
|
||||
|
||||
protected ReportHelperInterface $helper;
|
||||
private BudgetRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
@@ -328,7 +329,7 @@ class ReportController extends Controller
|
||||
* @throws FireflyException
|
||||
*
|
||||
*/
|
||||
public function postIndex(ReportFormRequest $request): RedirectResponse|Redirector|View
|
||||
public function postIndex(ReportFormRequest $request): RedirectResponse | Redirector | View
|
||||
{
|
||||
// report type:
|
||||
$reportType = $request->get('report_type');
|
||||
|
||||
@@ -109,7 +109,7 @@ class SelectController extends Controller
|
||||
*
|
||||
* @return Factory|View|RedirectResponse
|
||||
*/
|
||||
public function selectTransactions(Rule $rule): Factory|View|RedirectResponse
|
||||
public function selectTransactions(Rule $rule): Factory | View | RedirectResponse
|
||||
{
|
||||
if (false === $rule->active) {
|
||||
session()->flash('warning', trans('firefly.cannot_fire_inactive_rules'));
|
||||
@@ -136,7 +136,7 @@ class SelectController extends Controller
|
||||
public function testTriggers(TestRuleFormRequest $request): JsonResponse
|
||||
{
|
||||
// build fake rule
|
||||
$rule = new Rule();
|
||||
$rule = new Rule();
|
||||
/** @var \Illuminate\Database\Eloquent\Collection<int, RuleTrigger> $triggers */
|
||||
$triggers = new Collection();
|
||||
$rule->strict = '1' === $request->get('strict');
|
||||
|
||||
@@ -179,7 +179,7 @@ class InstallController extends Controller
|
||||
return;
|
||||
}
|
||||
|
||||
file_put_contents($publicKey, (string) $key->getPublicKey());
|
||||
file_put_contents($publicKey, (string)$key->getPublicKey());
|
||||
file_put_contents($privateKey, $key->toString('PKCS1'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,8 +243,8 @@ class TagController extends Controller
|
||||
$subTitleIcon = 'fa-tag';
|
||||
$page = (int)$request->get('page');
|
||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||
$start ??= session('start');
|
||||
$end ??= session('end');
|
||||
$start ??= session('start');
|
||||
$end ??= session('end');
|
||||
$location = $this->repository->getLocation($tag);
|
||||
$attachments = $this->repository->getAttachments($tag);
|
||||
$subTitle = trans(
|
||||
|
||||
@@ -101,7 +101,7 @@ class DeleteController extends Controller
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
*/
|
||||
public function destroy(TransactionGroup $group): RedirectResponse|Redirector
|
||||
public function destroy(TransactionGroup $group): RedirectResponse | Redirector
|
||||
{
|
||||
app('log')->debug(sprintf('Now in %s(#%d).', __METHOD__, $group->id));
|
||||
if (!$this->isEditableGroup($group)) {
|
||||
|
||||
@@ -32,7 +32,6 @@ use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface
|
||||
use FireflyIII\Transformers\TransactionGroupTransformer;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
|
||||
@@ -81,7 +80,7 @@ class ShowController extends Controller
|
||||
* @return Factory|View
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function show( TransactionGroup $transactionGroup)
|
||||
public function show(TransactionGroup $transactionGroup)
|
||||
{
|
||||
/** @var TransactionJournal|null $first */
|
||||
$first = $transactionGroup->transactionJournals()->first(['transaction_journals.*']);
|
||||
@@ -162,9 +161,9 @@ class ShowController extends Controller
|
||||
$amounts[$symbol]['amount'] = bcadd($amounts[$symbol]['amount'], $transaction['amount']);
|
||||
if (null !== $transaction['foreign_amount'] && '' !== $transaction['foreign_amount']
|
||||
&& bccomp(
|
||||
'0',
|
||||
$transaction['foreign_amount']
|
||||
) !== 0) {
|
||||
'0',
|
||||
$transaction['foreign_amount']
|
||||
) !== 0) {
|
||||
// same for foreign currency:
|
||||
$foreignSymbol = $transaction['foreign_currency_symbol'];
|
||||
if (!array_key_exists($foreignSymbol, $amounts)) {
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace FireflyIII\Http\Controllers\Webhooks;
|
||||
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user