Fix various phpstan issues.

This commit is contained in:
James Cole 2025-01-03 14:56:06 +01:00
parent a8ae496fda
commit 394d0eabef
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
42 changed files with 133 additions and 181 deletions

View File

@ -126,7 +126,7 @@ class ApplyRules extends Command
$ruleEngine->addOperator(['type' => 'account_id', 'value' => $list]); $ruleEngine->addOperator(['type' => 'account_id', 'value' => $list]);
// add the date as a filter: // add the date as a filter:
$ruleEngine->addOperator(['type' => 'date_after', 'value' => $this->start_date->format('Y-m-d')]); $ruleEngine->addOperator(['type' => 'date_after', 'value' => $this->startDate->format('Y-m-d')]);
$ruleEngine->addOperator(['type' => 'date_before', 'value' => $this->endDate->format('Y-m-d')]); $ruleEngine->addOperator(['type' => 'date_before', 'value' => $this->endDate->format('Y-m-d')]);
// start running rules. // start running rules.
@ -227,7 +227,7 @@ class ApplyRules extends Command
foreach ($ruleGroupList as $ruleGroupId) { foreach ($ruleGroupList as $ruleGroupId) {
$ruleGroup = $this->ruleGroupRepository->find((int) $ruleGroupId); $ruleGroup = $this->ruleGroupRepository->find((int) $ruleGroupId);
if ($ruleGroup->active) { if (true === $ruleGroup->active) {
$this->ruleGroupSelection[] = $ruleGroup->id; $this->ruleGroupSelection[] = $ruleGroup->id;
} }
if (false === $ruleGroup->active) { if (false === $ruleGroup->active) {
@ -249,7 +249,7 @@ class ApplyRules extends Command
foreach ($ruleList as $ruleId) { foreach ($ruleList as $ruleId) {
$rule = $this->ruleRepository->find((int) $ruleId); $rule = $this->ruleRepository->find((int) $ruleId);
if (null !== $rule && $rule->active) { if (null !== $rule && true === $rule->active) {
$this->ruleSelection[] = $rule->id; $this->ruleSelection[] = $rule->id;
} }
} }
@ -294,7 +294,7 @@ class ApplyRules extends Command
[$inputEnd, $inputStart] = [$inputStart, $inputEnd]; [$inputEnd, $inputStart] = [$inputStart, $inputEnd];
} }
$this->start_date = $inputStart; $this->startDate = $inputStart;
$this->endDate = $inputEnd; $this->endDate = $inputEnd;
} }

View File

@ -43,7 +43,7 @@ class RepairsAccountBalances extends Command
return 0; return 0;
} }
if (config('firefly.feature_flags.running_balance_column')) { if (true === config('firefly.feature_flags.running_balance_column')) {
$this->friendlyInfo('Will recalculate account balances. This may take a LONG time. Please be patient.'); $this->friendlyInfo('Will recalculate account balances. This may take a LONG time. Please be patient.');
$this->markAsExecuted(); $this->markAsExecuted();
$this->correctBalanceAmounts(); $this->correctBalanceAmounts();

View File

@ -95,7 +95,7 @@ class UpgradesCurrencyPreferences extends Command
/** @var TransactionCurrency $currency */ /** @var TransactionCurrency $currency */
foreach ($currencies as $currency) { foreach ($currencies as $currency) {
if ($currency->enabled) { if (true === $currency->enabled) {
$enabled->push($currency); $enabled->push($currency);
} }
} }
@ -109,7 +109,7 @@ class UpgradesCurrencyPreferences extends Command
/** @var TransactionCurrency $currency */ /** @var TransactionCurrency $currency */
foreach ($currencies as $currency) { foreach ($currencies as $currency) {
if ($currency->enabled) { if (true === $currency->enabled) {
$enabled->push($currency); $enabled->push($currency);
} }
} }

View File

@ -87,17 +87,6 @@ class Handler extends ExceptionHandler
app('log')->debug('Now in Handler::render()'); app('log')->debug('Now in Handler::render()');
if ($e instanceof JsonApiException) {
// ignore it: controller will handle it.
app('log')->debug(sprintf(
'Return to parent to handle JsonApiException(%d)',
$e->getCode()
));
return parent::render($request, $e);
}
if ($e instanceof LaravelValidationException && $expectsJson) { if ($e instanceof LaravelValidationException && $expectsJson) {
// ignore it: controller will handle it. // ignore it: controller will handle it.

View File

@ -174,7 +174,7 @@ class TransactionJournalFactory
// 2024-11-19, overrule timezone with UTC and store it as UTC. // 2024-11-19, overrule timezone with UTC and store it as UTC.
if (FireflyConfig::get('utc', false)->data) { if (true === FireflyConfig::get('utc', false)->data) {
$carbon->setTimezone('UTC'); $carbon->setTimezone('UTC');
} }
// $carbon->setTimezone('UTC'); // $carbon->setTimezone('UTC');

View File

@ -40,7 +40,7 @@ class TransactionObserver
{ {
Log::debug('Observe "created" of a transaction.'); Log::debug('Observe "created" of a transaction.');
if (config('firefly.feature_flags.running_balance_column')) { if (config('firefly.feature_flags.running_balance_column')) {
if (1 === bccomp($transaction->amount, '0') && self::$recalculate) { if (1 === bccomp($transaction->amount, '0') && true === self::$recalculate) {
Log::debug('Trigger recalculateForJournal'); Log::debug('Trigger recalculateForJournal');
AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal); AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal);
} }
@ -57,7 +57,7 @@ class TransactionObserver
public function updated(Transaction $transaction): void public function updated(Transaction $transaction): void
{ {
// Log::debug('Observe "updated" of a transaction.'); // Log::debug('Observe "updated" of a transaction.');
if (config('firefly.feature_flags.running_balance_column') && self::$recalculate) { if (config('firefly.feature_flags.running_balance_column') && true === self::$recalculate) {
if (1 === bccomp($transaction->amount, '0')) { if (1 === bccomp($transaction->amount, '0')) {
Log::debug('Trigger recalculateForJournal'); Log::debug('Trigger recalculateForJournal');
AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal); AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal);

View File

@ -88,7 +88,7 @@ class LinkController extends Controller
*/ */
public function delete(Request $request, LinkType $linkType) public function delete(Request $request, LinkType $linkType)
{ {
if (!$linkType->editable) { if (false === $linkType->editable) {
$request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)])); $request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)]));
return redirect(route('admin.links.index')); return redirect(route('admin.links.index'));
@ -139,7 +139,7 @@ class LinkController extends Controller
*/ */
public function edit(Request $request, LinkType $linkType) public function edit(Request $request, LinkType $linkType)
{ {
if (!$linkType->editable) { if (false === $linkType->editable) {
$request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)])); $request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)]));
return redirect(route('admin.links.index')); return redirect(route('admin.links.index'));
@ -231,7 +231,7 @@ class LinkController extends Controller
*/ */
public function update(LinkTypeFormRequest $request, LinkType $linkType) public function update(LinkTypeFormRequest $request, LinkType $linkType)
{ {
if (!$linkType->editable) { if (false === $linkType->editable) {
$request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)])); $request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)]));
return redirect(route('admin.links.index')); return redirect(route('admin.links.index'));

View File

@ -57,7 +57,7 @@ class NotificationController extends Controller
// admin notification settings: // admin notification settings:
$notifications = []; $notifications = [];
foreach (config('notifications.notifications.owner') as $key => $info) { foreach (config('notifications.notifications.owner') as $key => $info) {
if ($info['enabled']) { if (true === $info['enabled']) {
$notifications[$key] = app('fireflyconfig')->get(sprintf('notification_%s', $key), true)->data; $notifications[$key] = app('fireflyconfig')->get(sprintf('notification_%s', $key), true)->data;
} }
} }

View File

@ -85,7 +85,7 @@ class UserController extends Controller
public function deleteInvite(InvitedUser $invitedUser): JsonResponse public function deleteInvite(InvitedUser $invitedUser): JsonResponse
{ {
app('log')->debug('Will now delete invitation'); app('log')->debug('Will now delete invitation');
if ($invitedUser->redeemed) { if (true === $invitedUser->redeemed) {
app('log')->debug('Is already redeemed.'); app('log')->debug('Is already redeemed.');
session()->flash('error', trans('firefly.invite_is_already_redeemed', ['address' => $invitedUser->email])); session()->flash('error', trans('firefly.invite_is_already_redeemed', ['address' => $invitedUser->email]));

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Budget; namespace FireflyIII\Http\Controllers\Budget;
use FireflyIII\Enums\AutoBudgetType;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Controllers\Controller;
@ -74,9 +75,9 @@ class CreateController extends Controller
// auto budget types // auto budget types
$autoBudgetTypes = [ $autoBudgetTypes = [
0 => (string) trans('firefly.auto_budget_none'), 0 => (string) trans('firefly.auto_budget_none'),
AutoBudget::AUTO_BUDGET_RESET => (string) trans('firefly.auto_budget_reset'), AutoBudgetType::AUTO_BUDGET_RESET->value => (string) trans('firefly.auto_budget_reset'),
AutoBudget::AUTO_BUDGET_ROLLOVER => (string) trans('firefly.auto_budget_rollover'), AutoBudgetType::AUTO_BUDGET_ROLLOVER->value => (string) trans('firefly.auto_budget_rollover'),
AutoBudget::AUTO_BUDGET_ADJUSTED => (string) trans('firefly.auto_budget_adjusted'), AutoBudgetType::AUTO_BUDGET_ADJUSTED->value => (string) trans('firefly.auto_budget_adjusted'),
]; ];
$autoBudgetPeriods = [ $autoBudgetPeriods = [
'daily' => (string) trans('firefly.auto_budget_period_daily'), 'daily' => (string) trans('firefly.auto_budget_period_daily'),

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Budget; namespace FireflyIII\Http\Controllers\Budget;
use FireflyIII\Enums\AutoBudgetType;
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\BudgetFormUpdateRequest; use FireflyIII\Http\Requests\BudgetFormUpdateRequest;
@ -76,9 +77,9 @@ class EditController extends Controller
// auto budget types // auto budget types
$autoBudgetTypes = [ $autoBudgetTypes = [
0 => (string) trans('firefly.auto_budget_none'), 0 => (string) trans('firefly.auto_budget_none'),
AutoBudget::AUTO_BUDGET_RESET => (string) trans('firefly.auto_budget_reset'), AutoBudgetType::AUTO_BUDGET_RESET->value => (string) trans('firefly.auto_budget_reset'),
AutoBudget::AUTO_BUDGET_ROLLOVER => (string) trans('firefly.auto_budget_rollover'), AutoBudgetType::AUTO_BUDGET_ROLLOVER->value => (string) trans('firefly.auto_budget_rollover'),
AutoBudget::AUTO_BUDGET_ADJUSTED => (string) trans('firefly.auto_budget_adjusted'), AutoBudgetType::AUTO_BUDGET_ADJUSTED->value => (string) trans('firefly.auto_budget_adjusted'),
]; ];
$autoBudgetPeriods = [ $autoBudgetPeriods = [
'daily' => (string) trans('firefly.auto_budget_period_daily'), 'daily' => (string) trans('firefly.auto_budget_period_daily'),

View File

@ -247,7 +247,7 @@ class DebugController extends Controller
private function getBuildInfo(): array private function getBuildInfo(): array
{ {
$return = [ $return = [
'is_docker' => env('IS_DOCKER', false), 'is_docker' => env('IS_DOCKER', false), // @phpstan-ignore-line
'build' => '(unknown)', 'build' => '(unknown)',
'build_date' => '(unknown)', 'build_date' => '(unknown)',
'base_build' => '(unknown)', 'base_build' => '(unknown)',
@ -272,11 +272,11 @@ class DebugController extends Controller
app('log')->debug('Could not check build date, but thats ok.'); app('log')->debug('Could not check build date, but thats ok.');
app('log')->warning($e->getMessage()); app('log')->warning($e->getMessage());
} }
if ('' !== (string) env('BASE_IMAGE_BUILD')) { if ('' !== (string) env('BASE_IMAGE_BUILD')) { // @phpstan-ignore-line
$return['base_build'] = env('BASE_IMAGE_BUILD'); $return['base_build'] = env('BASE_IMAGE_BUILD'); // @phpstan-ignore-line
} }
if ('' !== (string) env('BASE_IMAGE_DATE')) { if ('' !== (string) env('BASE_IMAGE_DATE')) { // @phpstan-ignore-line
$return['base_build_date'] = env('BASE_IMAGE_DATE'); $return['base_build_date'] = env('BASE_IMAGE_DATE'); // @phpstan-ignore-line
} }
return $return; return $return;

View File

@ -47,7 +47,7 @@ class IndexController extends Controller
return $next($request); return $next($request);
} }
); );
if (!config('cer.enabled')) { if (false === config('cer.enabled')) {
throw new NotFoundHttpException(); throw new NotFoundHttpException();
} }
} }

View File

@ -124,10 +124,10 @@ class ReconcileController extends Controller
Log::debug(sprintf('End balance: "%s"', $endBalance)); Log::debug(sprintf('End balance: "%s"', $endBalance));
Log::debug(sprintf('Cleared amount: "%s"', $clearedAmount)); Log::debug(sprintf('Cleared amount: "%s"', $clearedAmount));
Log::debug(sprintf('Amount: "%s"', $amount)); Log::debug(sprintf('Amount: "%s"', $amount));
$difference = bcadd(bcadd(bcsub($startBalance ?? '0', $endBalance ?? '0'), $clearedAmount ?? '0'), $amount); $difference = bcadd(bcadd(bcsub($startBalance ?? '0', $endBalance ?? '0'), $clearedAmount), $amount);
$diffCompare = bccomp($difference, '0'); $diffCompare = bccomp($difference, '0');
$countCleared = count($clearedJournals); $countCleared = count($clearedJournals);
$reconSum = bcadd(bcadd($startBalance ?? '0', $amount ?? '0'), $clearedAmount ?? '0'); $reconSum = bcadd(bcadd($startBalance ?? '0', $amount), $clearedAmount);
try { try {
$view = view('accounts.reconcile.overview', compact('account', 'start', 'diffCompare', 'difference', 'end', 'clearedAmount', 'startBalance', 'endBalance', 'amount', 'route', 'countCleared', 'reconSum', 'selectedIds'))->render(); $view = view('accounts.reconcile.overview', compact('account', 'start', 'diffCompare', 'difference', 'end', 'clearedAmount', 'startBalance', 'endBalance', 'amount', 'route', 'countCleared', 'reconSum', 'selectedIds'))->render();

View File

@ -72,7 +72,7 @@ class PreferencesController extends Controller
public function index(AccountRepositoryInterface $repository) public function index(AccountRepositoryInterface $repository)
{ {
$accounts = $repository->getAccountsByType([AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value]); $accounts = $repository->getAccountsByType([AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value]);
$isDocker = env('IS_DOCKER', false); $isDocker = env('IS_DOCKER', false); // @phpstan-ignore-line
$groupedAccounts = []; $groupedAccounts = [];
/** @var Account $account */ /** @var Account $account */
@ -129,10 +129,10 @@ class PreferencesController extends Controller
// notification preferences // notification preferences
$notifications = []; $notifications = [];
foreach (config('notifications.notifications.user') as $key => $info) { foreach (config('notifications.notifications.user') as $key => $info) {
if ($info['enabled']) { if (true === $info['enabled']) {
$notifications[$key] $notifications[$key]
= [ = [
'enabled' => app('preferences')->get(sprintf('notification_%s', $key), true)->data, 'enabled' => true === app('preferences')->get(sprintf('notification_%s', $key), true)->data,
'configurable' => $info['configurable'], 'configurable' => $info['configurable'],
]; ];
} }

View File

@ -215,7 +215,7 @@ class MfaController extends Controller
$domain = $this->getDomain(); $domain = $this->getDomain();
$secret = \Google2FA::generateSecretKey(); $secret = \Google2FA::generateSecretKey();
$image = \Google2FA::getQRCodeInline($domain, auth()->user()->email, (string) $secret); $image = \Google2FA::getQRCodeInline($domain, auth()->user()->email, $secret);
app('preferences')->set('temp-mfa-secret', $secret); app('preferences')->set('temp-mfa-secret', $secret);

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Recurring; namespace FireflyIII\Http\Controllers\Recurring;
use FireflyIII\Enums\RecurrenceRepetitionWeekend;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Controllers\Controller;
@ -100,10 +101,10 @@ class CreateController extends Controller
'times' => (string) trans('firefly.repeat_times'), 'times' => (string) trans('firefly.repeat_times'),
]; ];
$weekendResponses = [ $weekendResponses = [
RecurrenceRepetition::WEEKEND_DO_NOTHING => (string) trans('firefly.do_nothing'), RecurrenceRepetitionWeekend::WEEKEND_DO_NOTHING->value => (string) trans('firefly.do_nothing'),
RecurrenceRepetition::WEEKEND_SKIP_CREATION => (string) trans('firefly.skip_transaction'), RecurrenceRepetitionWeekend::WEEKEND_SKIP_CREATION->value => (string) trans('firefly.skip_transaction'),
RecurrenceRepetition::WEEKEND_TO_FRIDAY => (string) trans('firefly.jump_to_friday'), RecurrenceRepetitionWeekend::WEEKEND_TO_FRIDAY->value => (string) trans('firefly.jump_to_friday'),
RecurrenceRepetition::WEEKEND_TO_MONDAY => (string) trans('firefly.jump_to_monday'), RecurrenceRepetitionWeekend::WEEKEND_TO_MONDAY->value => (string) trans('firefly.jump_to_monday'),
]; ];
$hasOldInput = null !== $request->old('_token'); // flash some data $hasOldInput = null !== $request->old('_token'); // flash some data
$preFilled = [ $preFilled = [
@ -145,10 +146,10 @@ class CreateController extends Controller
'times' => (string) trans('firefly.repeat_times'), 'times' => (string) trans('firefly.repeat_times'),
]; ];
$weekendResponses = [ $weekendResponses = [
RecurrenceRepetition::WEEKEND_DO_NOTHING => (string) trans('firefly.do_nothing'), RecurrenceRepetitionWeekend::WEEKEND_DO_NOTHING->value => (string) trans('firefly.do_nothing'),
RecurrenceRepetition::WEEKEND_SKIP_CREATION => (string) trans('firefly.skip_transaction'), RecurrenceRepetitionWeekend::WEEKEND_SKIP_CREATION->value => (string) trans('firefly.skip_transaction'),
RecurrenceRepetition::WEEKEND_TO_FRIDAY => (string) trans('firefly.jump_to_friday'), RecurrenceRepetitionWeekend::WEEKEND_TO_FRIDAY->value => (string) trans('firefly.jump_to_friday'),
RecurrenceRepetition::WEEKEND_TO_MONDAY => (string) trans('firefly.jump_to_monday'), RecurrenceRepetitionWeekend::WEEKEND_TO_MONDAY->value => (string) trans('firefly.jump_to_monday'),
]; ];
// fill prefilled with journal info // fill prefilled with journal info

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Recurring; namespace FireflyIII\Http\Controllers\Recurring;
use FireflyIII\Enums\RecurrenceRepetitionWeekend;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Controllers\Controller;
@ -126,10 +127,10 @@ class EditController extends Controller
} }
$weekendResponses = [ $weekendResponses = [
RecurrenceRepetition::WEEKEND_DO_NOTHING => (string) trans('firefly.do_nothing'), RecurrenceRepetitionWeekend::WEEKEND_DO_NOTHING->value => (string) trans('firefly.do_nothing'),
RecurrenceRepetition::WEEKEND_SKIP_CREATION => (string) trans('firefly.skip_transaction'), RecurrenceRepetitionWeekend::WEEKEND_SKIP_CREATION->value => (string) trans('firefly.skip_transaction'),
RecurrenceRepetition::WEEKEND_TO_FRIDAY => (string) trans('firefly.jump_to_friday'), RecurrenceRepetitionWeekend::WEEKEND_TO_FRIDAY->value => (string) trans('firefly.jump_to_friday'),
RecurrenceRepetition::WEEKEND_TO_MONDAY => (string) trans('firefly.jump_to_monday'), RecurrenceRepetitionWeekend::WEEKEND_TO_MONDAY->value => (string) trans('firefly.jump_to_monday'),
]; ];
$hasOldInput = null !== $request->old('_token'); $hasOldInput = null !== $request->old('_token');

View File

@ -65,7 +65,7 @@ class SecureHeaders
]; ];
// overrule in development mode // overrule in development mode
if (true === env('IS_LOCAL_DEV')) { if (true === env('IS_LOCAL_DEV')) { // @phpstan-ignore-line
$csp = [ $csp = [
"default-src 'none'", "default-src 'none'",
"object-src 'none'", "object-src 'none'",

View File

@ -25,6 +25,7 @@ declare(strict_types=1);
namespace FireflyIII\Jobs; namespace FireflyIII\Jobs;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Enums\AutoBudgetType;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\AutoBudget; use FireflyIII\Models\AutoBudget;
use FireflyIII\Models\Budget; use FireflyIII\Models\Budget;
@ -126,7 +127,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
// find budget limit: // find budget limit:
$budgetLimit = $this->findBudgetLimit($autoBudget->budget, $start, $end); $budgetLimit = $this->findBudgetLimit($autoBudget->budget, $start, $end);
if (null === $budgetLimit && AutoBudget::AUTO_BUDGET_RESET === (int) $autoBudget->auto_budget_type) { if (null === $budgetLimit && AutoBudgetType::AUTO_BUDGET_RESET->value === (int) $autoBudget->auto_budget_type) {
// that's easy: create one. // that's easy: create one.
// do nothing else. // do nothing else.
$this->createBudgetLimit($autoBudget, $start, $end); $this->createBudgetLimit($autoBudget, $start, $end);
@ -135,14 +136,14 @@ class CreateAutoBudgetLimits implements ShouldQueue
return; return;
} }
if (null === $budgetLimit && AutoBudget::AUTO_BUDGET_ROLLOVER === (int) $autoBudget->auto_budget_type) { if (null === $budgetLimit && AutoBudgetType::AUTO_BUDGET_ROLLOVER->value === (int) $autoBudget->auto_budget_type) {
// budget limit exists already, // budget limit exists already,
$this->createRollover($autoBudget); $this->createRollover($autoBudget);
app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id)); app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
return; return;
} }
if (null === $budgetLimit && AutoBudget::AUTO_BUDGET_ADJUSTED === (int) $autoBudget->auto_budget_type) { if (null === $budgetLimit && AutoBudgetType::AUTO_BUDGET_ADJUSTED->value === (int) $autoBudget->auto_budget_type) {
// budget limit exists already, // budget limit exists already,
$this->createAdjustedLimit($autoBudget); $this->createAdjustedLimit($autoBudget);
app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id)); app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));

View File

@ -42,7 +42,7 @@ class PiggyBankEvent extends Model
'updated_at' => 'datetime', 'updated_at' => 'datetime',
'date' => SeparateTimezoneCaster::class, 'date' => SeparateTimezoneCaster::class,
'amount' => 'string', 'amount' => 'string',
'amount' => 'native_string', 'native_amount' => 'string',
]; ];
protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'date_tz', 'amount', 'native_amount']; protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'date_tz', 'amount', 'native_amount'];
@ -73,14 +73,14 @@ class PiggyBankEvent extends Model
protected function amount(): Attribute protected function amount(): Attribute
{ {
return Attribute::make( return Attribute::make(
get: static fn ($value) => (string) $value, get: static fn($value) => (string) $value,
); );
} }
protected function piggyBankId(): Attribute protected function piggyBankId(): Attribute
{ {
return Attribute::make( return Attribute::make(
get: static fn ($value) => (int) $value, get: static fn($value) => (int) $value,
); );
} }
} }

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Models; namespace FireflyIII\Models;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait; use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
@ -86,22 +87,22 @@ class TransactionType extends Model
public function isDeposit(): bool public function isDeposit(): bool
{ {
return self::DEPOSIT === $this->type; return TransactionTypeEnum::DEPOSIT->value === $this->type;
} }
public function isOpeningBalance(): bool public function isOpeningBalance(): bool
{ {
return self::OPENING_BALANCE === $this->type; return TransactionTypeEnum::OPENING_BALANCE->value === $this->type;
} }
public function isTransfer(): bool public function isTransfer(): bool
{ {
return self::TRANSFER === $this->type; return TransactionTypeEnum::TRANSFER->value === $this->type;
} }
public function isWithdrawal(): bool public function isWithdrawal(): bool
{ {
return self::WITHDRAWAL === $this->type; return TransactionTypeEnum::WITHDRAWAL->value === $this->type;
} }
public function transactionJournals(): HasMany public function transactionJournals(): HasMany

View File

@ -69,7 +69,7 @@ class ReturnsSettings
config(['ntfy-notification-channel.server' => $settings['ntfy_server']]); config(['ntfy-notification-channel.server' => $settings['ntfy_server']]);
config(['ntfy-notification-channel.topic' => $settings['ntfy_topic']]); config(['ntfy-notification-channel.topic' => $settings['ntfy_topic']]);
if ($settings['ntfy_auth']) { if (true === $settings['ntfy_auth']) {
// overrule auth as well. // overrule auth as well.
config(['ntfy-notification-channel.authentication.enabled' => true]); config(['ntfy-notification-channel.authentication.enabled' => true]);
config(['ntfy-notification-channel.authentication.username' => $settings['ntfy_user']]); config(['ntfy-notification-channel.authentication.username' => $settings['ntfy_user']]);

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Repositories\Budget; namespace FireflyIII\Repositories\Budget;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Enums\AutoBudgetType;
use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Helpers\Collector\GroupCollectorInterface;
@ -760,13 +761,13 @@ class BudgetRepository implements BudgetRepositoryInterface
} }
if ('reset' === $type) { if ('reset' === $type) {
$type = AutoBudget::AUTO_BUDGET_RESET; $type = AutoBudgetType::AUTO_BUDGET_RESET->value;
} }
if ('rollover' === $type) { if ('rollover' === $type) {
$type = AutoBudget::AUTO_BUDGET_ROLLOVER; $type = AutoBudgetType::AUTO_BUDGET_ROLLOVER->value;
} }
if ('adjusted' === $type) { if ('adjusted' === $type) {
$type = AutoBudget::AUTO_BUDGET_ADJUSTED; $type = AutoBudgetType::AUTO_BUDGET_ADJUSTED->value;
} }
/** @var CurrencyRepositoryInterface $repos */ /** @var CurrencyRepositoryInterface $repos */

View File

@ -492,7 +492,7 @@ class JournalUpdateService
$value->setTimezone(config('app.timezone')); $value->setTimezone(config('app.timezone'));
// 2024-11-22, overrule timezone with UTC and store it as UTC. // 2024-11-22, overrule timezone with UTC and store it as UTC.
if (FireflyConfig::get('utc', false)->data) { if (true === FireflyConfig::get('utc', false)->data) {
$value->setTimezone('UTC'); $value->setTimezone('UTC');
} }
@ -770,6 +770,4 @@ class JournalUpdateService
$this->sourceTransaction->refresh(); $this->sourceTransaction->refresh();
$this->destinationTransaction->refresh(); $this->destinationTransaction->refresh();
} }
private function collectCurrency(): TransactionCurrency {}
} }

View File

@ -71,11 +71,11 @@ class Amount
public function convertToNative(?User $user = null): bool public function convertToNative(?User $user = null): bool
{ {
if (null === $user) { if (null === $user) {
return Preferences::get('convert_to_native', false)->data && config('cer.enabled'); return true === Preferences::get('convert_to_native', false)->data && true === config('cer.enabled');
// Log::debug(sprintf('convertToNative [a]: %s', var_export($result, true))); // Log::debug(sprintf('convertToNative [a]: %s', var_export($result, true)));
} }
return Preferences::getForUser($user, 'convert_to_native', false)->data && config('cer.enabled'); return true === Preferences::getForUser($user, 'convert_to_native', false)->data && true === config('cer.enabled');
// Log::debug(sprintf('convertToNative [b]: %s', var_export($result, true))); // Log::debug(sprintf('convertToNative [b]: %s', var_export($result, true)));
} }

View File

@ -27,6 +27,7 @@ namespace FireflyIII\Support\Chart\Category;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Enums\AccountTypeEnum; use FireflyIII\Enums\AccountTypeEnum;
use FireflyIII\Models\Category; use FireflyIII\Models\Category;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use FireflyIII\Repositories\Category\NoCategoryRepositoryInterface; use FireflyIII\Repositories\Category\NoCategoryRepositoryInterface;
@ -48,6 +49,8 @@ class FrontpageChartGenerator
private NoCategoryRepositoryInterface $noCatRepos; private NoCategoryRepositoryInterface $noCatRepos;
private OperationsRepositoryInterface $opsRepos; private OperationsRepositoryInterface $opsRepos;
private CategoryRepositoryInterface $repository; private CategoryRepositoryInterface $repository;
public bool $convertToNative = false;
public TransactionCurrency $defaultCurrency;
private Carbon $start; private Carbon $start;
/** /**

View File

@ -40,11 +40,10 @@ trait GetConfigurationData
{ {
$array = [ $array = [
-1 => 'ALL errors', -1 => 'ALL errors',
E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED => 'E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED', E_ALL & ~E_NOTICE & ~E_DEPRECATED => 'E_ALL & ~E_NOTICE & ~E_DEPRECATED',
E_ALL => 'E_ALL', E_ALL => 'E_ALL',
E_ALL & ~E_DEPRECATED & ~E_STRICT => 'E_ALL & ~E_DEPRECATED & ~E_STRICT', E_ALL & ~E_DEPRECATED => 'E_ALL & ~E_DEPRECATED ',
E_ALL & ~E_NOTICE => 'E_ALL & ~E_NOTICE', E_ALL & ~E_NOTICE => 'E_ALL & ~E_NOTICE',
E_ALL & ~E_NOTICE & ~E_STRICT => 'E_ALL & ~E_NOTICE & ~E_STRICT',
E_COMPILE_ERROR | E_RECOVERABLE_ERROR | E_ERROR | E_CORE_ERROR => 'E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR', E_COMPILE_ERROR | E_RECOVERABLE_ERROR | E_ERROR | E_CORE_ERROR => 'E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR',
]; ];

View File

@ -96,7 +96,13 @@ class TransactionSummarizer
'currency_code' => $currencyCode, 'currency_code' => $currencyCode,
'currency_decimal_places' => $currencyDecimalPlaces, 'currency_decimal_places' => $currencyDecimalPlaces,
]; ];
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->{$method}($amount)); if('positive' === $method) {
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->positive($amount));
}
if('negative' === $method) {
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->negative($amount));
}
// $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->{$method}($amount));
// Log::debug(sprintf('Journal #%d adds amount %s %s', $journal['transaction_journal_id'], $currencyCode, $amount)); // Log::debug(sprintf('Journal #%d adds amount %s %s', $journal['transaction_journal_id'], $currencyCode, $amount));
} }
Log::debug('End of sumExpenses.', $array); Log::debug('End of sumExpenses.', $array);

View File

@ -25,6 +25,7 @@ declare(strict_types=1);
namespace FireflyIII\Support\Repositories\Recurring; namespace FireflyIII\Support\Repositories\Recurring;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Enums\RecurrenceRepetitionWeekend;
use FireflyIII\Models\RecurrenceRepetition; use FireflyIII\Models\RecurrenceRepetition;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
@ -39,7 +40,7 @@ trait FiltersWeekends
protected function filterWeekends(RecurrenceRepetition $repetition, array $dates): array protected function filterWeekends(RecurrenceRepetition $repetition, array $dates): array
{ {
app('log')->debug(sprintf('Now in %s', __METHOD__)); app('log')->debug(sprintf('Now in %s', __METHOD__));
if (RecurrenceRepetition::WEEKEND_DO_NOTHING === $repetition->weekend) { if (RecurrenceRepetitionWeekend::WEEKEND_DO_NOTHING->value === $repetition->weekend) {
app('log')->debug('Repetition will not be filtered on weekend days.'); app('log')->debug('Repetition will not be filtered on weekend days.');
return $dates; return $dates;
@ -57,7 +58,7 @@ trait FiltersWeekends
} }
// is weekend and must set back to Friday? // is weekend and must set back to Friday?
if (RecurrenceRepetition::WEEKEND_TO_FRIDAY === $repetition->weekend) { if (RecurrenceRepetitionWeekend::WEEKEND_TO_FRIDAY->value === $repetition->weekend) {
$clone = clone $date; $clone = clone $date;
$clone->addDays(5 - $date->dayOfWeekIso); $clone->addDays(5 - $date->dayOfWeekIso);
app('log')->debug( app('log')->debug(
@ -69,7 +70,7 @@ trait FiltersWeekends
} }
// postpone to Monday? // postpone to Monday?
if (RecurrenceRepetition::WEEKEND_TO_MONDAY === $repetition->weekend) { if (RecurrenceRepetitionWeekend::WEEKEND_TO_MONDAY->value === $repetition->weekend) {
$clone = clone $date; $clone = clone $date;
$clone->addDays(8 - $date->dayOfWeekIso); $clone->addDays(8 - $date->dayOfWeekIso);
app('log')->debug( app('log')->debug(

View File

@ -235,7 +235,7 @@ class UpdatePiggybank implements ActionInterface
return true; return true;
} }
} }
Log::debug(sprintf('Piggy bank is not connected to account #%d "%s"', $account->id, $account->name)); Log::debug(sprintf('Piggy bank is not connected to account #%d "%s"', $link?->id, $link?->name));
return false; return false;
} }

View File

@ -277,7 +277,7 @@ class SearchRuleEngine implements RuleEngineInterface
app('log')->debug(sprintf('Total collection is now %d transactions', $total->count())); app('log')->debug(sprintf('Total collection is now %d transactions', $total->count()));
++$count; ++$count;
// if trigger says stop processing, do so. // if trigger says stop processing, do so.
if ($ruleTrigger->stop_processing && $result->count() > 0) { if (true === $ruleTrigger->stop_processing && $result->count() > 0) {
app('log')->debug('The trigger says to stop processing, so stop processing other triggers.'); app('log')->debug('The trigger says to stop processing, so stop processing other triggers.');
break; break;
@ -319,10 +319,10 @@ class SearchRuleEngine implements RuleEngineInterface
/** @var Rule $rule */ /** @var Rule $rule */
foreach ($this->rules as $rule) { foreach ($this->rules as $rule) {
$result = $this->fireRule($rule); $result = $this->fireRule($rule);
if (true === $result && $rule->stop_processing) { if (true === $result && true === $rule->stop_processing) {
app('log')->debug(sprintf('Rule #%d has triggered and executed, but calls to stop processing. Since not in the context of a group, do not stop.', $rule->id)); app('log')->debug(sprintf('Rule #%d has triggered and executed, but calls to stop processing. Since not in the context of a group, do not stop.', $rule->id));
} }
if (false === $result && $rule->stop_processing) { if (false === $result && true === $rule->stop_processing) {
app('log')->debug(sprintf('Rule #%d has triggered and changed nothing, but calls to stop processing. Do not stop.', $rule->id)); app('log')->debug(sprintf('Rule #%d has triggered and changed nothing, but calls to stop processing. Do not stop.', $rule->id));
} }
} }
@ -461,12 +461,12 @@ class SearchRuleEngine implements RuleEngineInterface
} }
// pick up from the action if it actually acted or not: // pick up from the action if it actually acted or not:
if ($ruleAction->stop_processing && true === $result) { if (true === $ruleAction->stop_processing && true === $result) {
app('log')->debug(sprintf('Rule action "%s" reports changes AND asks to break, so break!', $ruleAction->action_type)); app('log')->debug(sprintf('Rule action "%s" reports changes AND asks to break, so break!', $ruleAction->action_type));
return true; return true;
} }
if ($ruleAction->stop_processing && false === $result) { if (true === $ruleAction->stop_processing && false === $result) {
app('log')->debug(sprintf('Rule action "%s" reports NO changes AND asks to break, but we wont break!', $ruleAction->action_type)); app('log')->debug(sprintf('Rule action "%s" reports NO changes AND asks to break, but we wont break!', $ruleAction->action_type));
} }

View File

@ -59,7 +59,7 @@ class BillTransformer extends AbstractTransformer
*/ */
public function transform(Bill $bill): array public function transform(Bill $bill): array
{ {
$defaultCurrency = $this->parameters->get('defaultCurrency') ?? Amount::getDefaultCurrency(); $defaultCurrency = $this->parameters->get('defaultCurrency') ?? app('amount')->getDefaultCurrency();
$paidData = $this->paidData($bill); $paidData = $this->paidData($bill);
$lastPaidDate = $this->getLastPaidDate($paidData); $lastPaidDate = $this->getLastPaidDate($paidData);

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Transformers; namespace FireflyIII\Transformers;
use FireflyIII\Enums\AutoBudgetType;
use FireflyIII\Models\AutoBudget; use FireflyIII\Models\AutoBudget;
use FireflyIII\Models\Budget; use FireflyIII\Models\Budget;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
@ -71,9 +72,9 @@ class BudgetTransformer extends AbstractTransformer
$notes = $this->repository->getNoteText($budget); $notes = $this->repository->getNoteText($budget);
$types = [ $types = [
AutoBudget::AUTO_BUDGET_RESET => 'reset', AutoBudgetType::AUTO_BUDGET_RESET->value => 'reset',
AutoBudget::AUTO_BUDGET_ROLLOVER => 'rollover', AutoBudgetType::AUTO_BUDGET_ROLLOVER->value => 'rollover',
AutoBudget::AUTO_BUDGET_ADJUSTED => 'adjusted', AutoBudgetType::AUTO_BUDGET_ADJUSTED->value => 'adjusted',
]; ];
if (null !== $autoBudget) { if (null !== $autoBudget) {

View File

@ -48,6 +48,7 @@ class AccountTransformer extends AbstractTransformer
private array $fullTypes; private array $fullTypes;
private array $lastActivity; private array $lastActivity;
private array $objectGroups; private array $objectGroups;
private array $balances;
/** /**
* This method collects meta-data for one or all accounts in the transformer's collection. * This method collects meta-data for one or all accounts in the transformer's collection.
@ -55,6 +56,7 @@ class AccountTransformer extends AbstractTransformer
public function collectMetaData(Collection $objects): Collection public function collectMetaData(Collection $objects): Collection
{ {
$this->currencies = []; $this->currencies = [];
$this->balances = [];
$this->accountMeta = []; $this->accountMeta = [];
$this->accountTypes = []; $this->accountTypes = [];
$this->fullTypes = []; $this->fullTypes = [];

View File

@ -56,10 +56,10 @@ class TransactionGroupTransformer extends AbstractTransformer
// private array $currencies = []; // private array $currencies = [];
// private array $transactionTypes = []; // private array $transactionTypes = [];
// private array $meta = []; private array $meta = [];
// private array $notes = []; private array $notes = [];
// private array $locations = []; // private array $locations = [];
// private array $tags = []; private array $tags = [];
// private array $amounts = []; // private array $amounts = [];
// private array $foreignAmounts = []; // private array $foreignAmounts = [];
// private array $journalCurrencies = []; // private array $journalCurrencies = [];

View File

@ -77,7 +77,7 @@ class FireflyValidator extends Validator
} }
$secret = (string) $secret; $secret = (string) $secret;
return (bool) \Google2FA::verifyKey((string) $secret, $value); return (bool) \Google2FA::verifyKey($secret, $value);
} }
/** /**
@ -823,7 +823,7 @@ class FireflyValidator extends Validator
} }
$query->where('piggy_banks.name', $value); $query->where('piggy_banks.name', $value);
return 0 === $query->get(['piggy_banks.*'])->count(); return 0 === $query->count(['piggy_banks.*']);
} }
/** /**

View File

@ -43,7 +43,7 @@ if (!function_exists('envNonEmpty')) {
*/ */
function envNonEmpty(string $key, string | int | bool | null $default = null) function envNonEmpty(string $key, string | int | bool | null $default = null)
{ {
$result = env($key, $default); $result = env($key, $default); // @phpstan-ignore-line
if ('' === $result) { if ('' === $result) {
$result = $default; $result = $default;
} }

View File

@ -1,56 +0,0 @@
<?php
/*
* jsonapi.php
* Copyright (c) 2025 james@firefly-iii.org.
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
declare(strict_types=1);
use FireflyIII\JsonApi\V2\Server;
return [
/*
|--------------------------------------------------------------------------
| Root Namespace
|--------------------------------------------------------------------------
|
| The root JSON:API namespace, within your application's namespace.
| This is used when generating any class that does not sit *within*
| a server's namespace. For example, new servers and filters.
|
| By default this is set to `JsonApi` which means the root namespace
| will be `\App\JsonApi`, if your application's namespace is `App`.
*/
'namespace' => 'JsonApi',
/*
|--------------------------------------------------------------------------
| Servers
|--------------------------------------------------------------------------
|
| A list of the JSON:API compliant APIs in your application, referred to
| as "servers". They must be listed below, with the array key being the
| unique name for each server, and the value being the fully-qualified
| class name of the server class.
*/
'servers' => [
'v2' => Server::class,
],
];

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace Database\Seeders; namespace Database\Seeders;
use FireflyIII\Enums\AccountTypeEnum;
use FireflyIII\Models\AccountType; use FireflyIII\Models\AccountType;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
@ -34,19 +35,19 @@ class AccountTypeSeeder extends Seeder
public function run(): void public function run(): void
{ {
$types = [ $types = [
AccountType::DEFAULT, AccountTypeEnum::DEFAULT->value,
AccountType::CASH, AccountTypeEnum::CASH->value,
AccountType::ASSET, AccountTypeEnum::ASSET->value,
AccountType::EXPENSE, AccountTypeEnum::EXPENSE->value,
AccountType::REVENUE, AccountTypeEnum::REVENUE->value,
AccountType::INITIAL_BALANCE, AccountTypeEnum::INITIAL_BALANCE->value,
AccountType::BENEFICIARY, AccountTypeEnum::BENEFICIARY->value,
AccountType::IMPORT, AccountTypeEnum::IMPORT->value,
AccountType::LOAN, AccountTypeEnum::LOAN->value,
AccountType::RECONCILIATION, AccountTypeEnum::RECONCILIATION->value,
AccountType::DEBT, AccountTypeEnum::DEBT->value,
AccountType::MORTGAGE, AccountTypeEnum::MORTGAGE->value,
AccountType::LIABILITY_CREDIT, AccountTypeEnum::LIABILITY_CREDIT->value,
]; ];
foreach ($types as $type) { foreach ($types as $type) {
if (null === AccountType::where('type', $type)->first()) { if (null === AccountType::where('type', $type)->first()) {

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace Database\Seeders; namespace Database\Seeders;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Models\TransactionType; use FireflyIII\Models\TransactionType;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
@ -34,13 +35,13 @@ class TransactionTypeSeeder extends Seeder
public function run(): void public function run(): void
{ {
$types = [ $types = [
TransactionType::WITHDRAWAL, TransactionTypeEnum::WITHDRAWAL->value,
TransactionTypeEnum::DEPOSIT->value, TransactionTypeEnum::DEPOSIT->value,
TransactionType::TRANSFER, TransactionTypeEnum::TRANSFER->value,
TransactionType::OPENING_BALANCE, TransactionTypeEnum::OPENING_BALANCE->value,
TransactionType::RECONCILIATION, TransactionTypeEnum::RECONCILIATION->value,
TransactionType::INVALID, TransactionTypeEnum::INVALID->value,
TransactionType::LIABILITY_CREDIT, TransactionTypeEnum::LIABILITY_CREDIT->value,
]; ];
foreach ($types as $type) { foreach ($types as $type) {

View File

@ -40,7 +40,7 @@ Route::group(
// the rest // the rest
$guard = config('passport.guard', null); $guard = config('passport.guard', null);
Route::middleware(['web', $guard ? 'auth:'.$guard : 'auth'])->group(function (): void { Route::middleware(['web', null !== $guard ? 'auth:'.$guard : 'auth'])->group(function (): void {
Route::post('/token/refresh', ['uses' => 'TransientTokenController@refresh', 'as' => 'token.refresh']); Route::post('/token/refresh', ['uses' => 'TransientTokenController@refresh', 'as' => 'token.refresh']);
Route::post('/authorize', ['uses' => 'ApproveAuthorizationController@approve', 'as' => 'authorizations.approve']); Route::post('/authorize', ['uses' => 'ApproveAuthorizationController@approve', 'as' => 'authorizations.approve']);
Route::delete('/authorize', ['uses' => 'DenyAuthorizationController@deny', 'as' => 'authorizations.deny']); Route::delete('/authorize', ['uses' => 'DenyAuthorizationController@deny', 'as' => 'authorizations.deny']);