Autoformat lol

This commit is contained in:
James Cole
2026-01-23 15:09:50 +01:00
parent ae1347c550
commit 8f15a32bd6
1071 changed files with 21111 additions and 21687 deletions

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Recurring;
use FireflyIII\Support\Facades\Preferences;
use FireflyIII\Enums\RecurrenceRepetitionWeekend;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
@@ -35,6 +34,7 @@ use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
use FireflyIII\Support\Facades\Preferences;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
@@ -47,9 +47,9 @@ use Illuminate\View\View;
*/
class CreateController extends Controller
{
private AttachmentHelperInterface $attachments;
private BillRepositoryInterface $billRepository;
private BudgetRepositoryInterface $budgetRepos;
private AttachmentHelperInterface $attachments;
private BillRepositoryInterface $billRepository;
private BudgetRepositoryInterface $budgetRepos;
private RecurringRepositoryInterface $repository;
/**
@@ -60,20 +60,18 @@ class CreateController extends Controller
parent::__construct();
// translations:
$this->middleware(
function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-paint-brush');
app('view')->share('title', (string) trans('firefly.recurrences'));
app('view')->share('subTitle', (string) trans('firefly.create_new_recurrence'));
$this->middleware(function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-paint-brush');
app('view')->share('title', (string) trans('firefly.recurrences'));
app('view')->share('subTitle', (string) trans('firefly.create_new_recurrence'));
$this->repository = app(RecurringRepositoryInterface::class);
$this->budgetRepos = app(BudgetRepositoryInterface::class);
$this->attachments = app(AttachmentHelperInterface::class);
$this->billRepository = app(BillRepositoryInterface::class);
$this->repository = app(RecurringRepositoryInterface::class);
$this->budgetRepos = app(BudgetRepositoryInterface::class);
$this->attachments = app(AttachmentHelperInterface::class);
$this->billRepository = app(BillRepositoryInterface::class);
return $next($request);
}
);
return $next($request);
});
}
/**
@@ -94,30 +92,35 @@ class CreateController extends Controller
$this->rememberPreviousUrl('recurring.create.url');
}
$request->session()->forget('recurring.create.fromStore');
$repetitionEnds = [
$repetitionEnds = [
'forever' => (string) trans('firefly.repeat_forever'),
'until_date' => (string) trans('firefly.repeat_until_date'),
'times' => (string) trans('firefly.repeat_times'),
'times' => (string) trans('firefly.repeat_times')
];
$weekendResponses = [
$weekendResponses = [
RecurrenceRepetitionWeekend::WEEKEND_DO_NOTHING->value => (string) trans('firefly.do_nothing'),
RecurrenceRepetitionWeekend::WEEKEND_SKIP_CREATION->value => (string) trans('firefly.skip_transaction'),
RecurrenceRepetitionWeekend::WEEKEND_TO_FRIDAY->value => (string) trans('firefly.jump_to_friday'),
RecurrenceRepetitionWeekend::WEEKEND_TO_MONDAY->value => (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
$preFilled = [
$hasOldInput = null !== $request->old('_token'); // flash some data
$preFilled = [
'first_date' => $tomorrow->format('Y-m-d'),
'transaction_type' => $hasOldInput ? $request->old('transaction_type') : 'withdrawal',
'active' => $hasOldInput ? (bool) $request->old('active') : true,
'apply_rules' => $hasOldInput ? (bool) $request->old('apply_rules') : true,
'apply_rules' => $hasOldInput ? (bool) $request->old('apply_rules') : true
];
$request->session()->flash('preFilled', $preFilled);
return view(
'recurring.create',
['tomorrow' => $tomorrow, 'oldRepetitionType' => $oldRepetitionType, 'bills' => $bills, 'weekendResponses' => $weekendResponses, 'preFilled' => $preFilled, 'repetitionEnds' => $repetitionEnds, 'budgets' => $budgets]
);
return view('recurring.create', [
'tomorrow' => $tomorrow,
'oldRepetitionType' => $oldRepetitionType,
'bills' => $bills,
'weekendResponses' => $weekendResponses,
'preFilled' => $preFilled,
'repetitionEnds' => $repetitionEnds,
'budgets' => $budgets
]);
}
/**
@@ -136,31 +139,31 @@ class CreateController extends Controller
$this->rememberPreviousUrl('recurring.create.url');
}
$request->session()->forget('recurring.create.fromStore');
$repetitionEnds = [
$repetitionEnds = [
'forever' => (string) trans('firefly.repeat_forever'),
'until_date' => (string) trans('firefly.repeat_until_date'),
'times' => (string) trans('firefly.repeat_times'),
'times' => (string) trans('firefly.repeat_times')
];
$weekendResponses = [
$weekendResponses = [
RecurrenceRepetitionWeekend::WEEKEND_DO_NOTHING->value => (string) trans('firefly.do_nothing'),
RecurrenceRepetitionWeekend::WEEKEND_SKIP_CREATION->value => (string) trans('firefly.skip_transaction'),
RecurrenceRepetitionWeekend::WEEKEND_TO_FRIDAY->value => (string) trans('firefly.jump_to_friday'),
RecurrenceRepetitionWeekend::WEEKEND_TO_MONDAY->value => (string) trans('firefly.jump_to_monday'),
RecurrenceRepetitionWeekend::WEEKEND_TO_MONDAY->value => (string) trans('firefly.jump_to_monday')
];
// fill prefilled with journal info
$type = strtolower((string) $journal->transactionType->type);
$type = strtolower((string) $journal->transactionType->type);
/** @var Transaction $source */
$source = $journal->transactions()->where('amount', '<', 0)->first();
$source = $journal->transactions()->where('amount', '<', 0)->first();
/** @var Transaction $dest */
$dest = $journal->transactions()->where('amount', '>', 0)->first();
$category = null !== $journal->categories()->first() ? $journal->categories()->first()->name : '';
$budget = null !== $journal->budgets()->first() ? $journal->budgets()->first()->id : 0;
$bill = null !== $journal->bill ? $journal->bill->id : 0;
$hasOldInput = null !== $request->old('_token'); // flash some data
$preFilled = [];
$dest = $journal->transactions()->where('amount', '>', 0)->first();
$category = null !== $journal->categories()->first() ? $journal->categories()->first()->name : '';
$budget = null !== $journal->budgets()->first() ? $journal->budgets()->first()->id : 0;
$bill = null !== $journal->bill ? $journal->bill->id : 0;
$hasOldInput = null !== $request->old('_token'); // flash some data
$preFilled = [];
if ($hasOldInput) {
$preFilled = [
'title' => $request->old('title'),
@@ -179,7 +182,7 @@ class CreateController extends Controller
'budget_id' => $request->old('budget_id'),
'bill_id' => $request->old('bill_id'),
'active' => (bool) $request->old('active'),
'apply_rules' => (bool) $request->old('apply_rules'),
'apply_rules' => (bool) $request->old('apply_rules')
];
}
if (false === $hasOldInput) {
@@ -200,12 +203,20 @@ class CreateController extends Controller
'budget_id' => $budget,
'bill_id' => $bill,
'active' => true,
'apply_rules' => true,
'apply_rules' => true
];
}
$request->session()->flash('preFilled', $preFilled);
return view('recurring.create', ['tomorrow' => $tomorrow, 'oldRepetitionType' => $oldRepetitionType, 'bills' => $bills, 'weekendResponses' => $weekendResponses, 'preFilled' => $preFilled, 'repetitionEnds' => $repetitionEnds, 'budgets' => $budgets]);
return view('recurring.create', [
'tomorrow' => $tomorrow,
'oldRepetitionType' => $oldRepetitionType,
'bills' => $bills,
'weekendResponses' => $weekendResponses,
'preFilled' => $preFilled,
'repetitionEnds' => $repetitionEnds,
'budgets' => $budgets
]);
}
/**
@@ -217,7 +228,7 @@ class CreateController extends Controller
*/
public function store(RecurrenceFormRequest $request)
{
$data = $request->getAll();
$data = $request->getAll();
try {
$recurrence = $this->repository->store($data);
@@ -233,7 +244,7 @@ class CreateController extends Controller
// store attachment(s):
/** @var null|array $files */
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
if (null !== $files && !auth()->user()->hasRole('demo')) {
$this->attachments->saveAttachmentsForModel($recurrence, $files);
}