mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-18 23:50:09 +00:00
PHPStorm can order methods by alphabet, who knew.
This commit is contained in:
@@ -135,38 +135,6 @@ class ConvertController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the conversion.
|
||||
*
|
||||
* @return Redirector|RedirectResponse
|
||||
*/
|
||||
public function postIndex(Request $request, TransactionType $destinationType, TransactionGroup $group)
|
||||
{
|
||||
if (!$this->isEditableGroup($group)) {
|
||||
return $this->redirectGroupToAccount($group);
|
||||
}
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($group->transactionJournals as $journal) {
|
||||
// catch FF exception.
|
||||
try {
|
||||
$this->convertJournal($journal, $destinationType, $request->all());
|
||||
} catch (FireflyException $e) {
|
||||
session()->flash('error', $e->getMessage());
|
||||
|
||||
return redirect()->route('transactions.convert.index', [strtolower($destinationType->type), $group->id])->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
// correct transfers:
|
||||
$group->refresh();
|
||||
|
||||
session()->flash('success', (string)trans('firefly.converted_to_'.$destinationType->type));
|
||||
event(new UpdatedTransactionGroup($group, true, true));
|
||||
|
||||
return redirect(route('transactions.show', [$group->id]));
|
||||
}
|
||||
|
||||
private function getValidDepositSources(): array
|
||||
{
|
||||
// make repositories
|
||||
@@ -291,6 +259,38 @@ class ConvertController extends Controller
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the conversion.
|
||||
*
|
||||
* @return Redirector|RedirectResponse
|
||||
*/
|
||||
public function postIndex(Request $request, TransactionType $destinationType, TransactionGroup $group)
|
||||
{
|
||||
if (!$this->isEditableGroup($group)) {
|
||||
return $this->redirectGroupToAccount($group);
|
||||
}
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($group->transactionJournals as $journal) {
|
||||
// catch FF exception.
|
||||
try {
|
||||
$this->convertJournal($journal, $destinationType, $request->all());
|
||||
} catch (FireflyException $e) {
|
||||
session()->flash('error', $e->getMessage());
|
||||
|
||||
return redirect()->route('transactions.convert.index', [strtolower($destinationType->type), $group->id])->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
// correct transfers:
|
||||
$group->refresh();
|
||||
|
||||
session()->flash('success', (string)trans('firefly.converted_to_'.$destinationType->type));
|
||||
event(new UpdatedTransactionGroup($group, true, true));
|
||||
|
||||
return redirect(route('transactions.show', [$group->id]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws FireflyException
|
||||
*/
|
||||
|
||||
@@ -50,7 +50,7 @@ class CreateController extends Controller
|
||||
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||
app('view')->share('title', (string)trans('firefly.transactions'));
|
||||
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||
$this->repository = app(TransactionGroupRepositoryInterface::class);
|
||||
|
||||
@@ -61,7 +61,7 @@ class CreateController extends Controller
|
||||
|
||||
public function cloneGroup(Request $request): JsonResponse
|
||||
{
|
||||
$groupId = (int) $request->get('id');
|
||||
$groupId = (int)$request->get('id');
|
||||
if (0 !== $groupId) {
|
||||
$group = $this->repository->find($groupId);
|
||||
if (null !== $group) {
|
||||
@@ -101,14 +101,14 @@ class CreateController extends Controller
|
||||
{
|
||||
app('preferences')->mark();
|
||||
|
||||
$sourceId = (int) request()->get('source');
|
||||
$destinationId = (int) request()->get('destination');
|
||||
$sourceId = (int)request()->get('source');
|
||||
$destinationId = (int)request()->get('destination');
|
||||
|
||||
/** @var AccountRepositoryInterface $accountRepository */
|
||||
$accountRepository = app(AccountRepositoryInterface::class);
|
||||
$cash = $accountRepository->getCashAccount();
|
||||
$preFilled = session()->has('preFilled') ? session('preFilled') : [];
|
||||
$subTitle = (string) trans(sprintf('breadcrumbs.create_%s', strtolower((string) $objectType)));
|
||||
$subTitle = (string)trans(sprintf('breadcrumbs.create_%s', strtolower((string)$objectType)));
|
||||
$subTitleIcon = 'fa-plus';
|
||||
$optionalFields = app('preferences')->get('transaction_journal_optional_fields', [])->data;
|
||||
$allowedOpposingTypes = config('firefly.allowed_opposing_types');
|
||||
|
||||
@@ -51,7 +51,7 @@ class EditController extends Controller
|
||||
// translations:
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||
app('view')->share('title', (string)trans('firefly.transactions'));
|
||||
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||
|
||||
$this->repository = app(JournalRepositoryInterface::class);
|
||||
@@ -79,7 +79,7 @@ class EditController extends Controller
|
||||
$expectedSourceTypes = config('firefly.expected_source_types');
|
||||
$allowedSourceDests = config('firefly.source_dests');
|
||||
$title = $transactionGroup->transactionJournals()->count() > 1 ? $transactionGroup->title : $transactionGroup->transactionJournals()->first()->description;
|
||||
$subTitle = (string) trans('firefly.edit_transaction_title', ['description' => $title]);
|
||||
$subTitle = (string)trans('firefly.edit_transaction_title', ['description' => $title]);
|
||||
$subTitleIcon = 'fa-plus';
|
||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
||||
$cash = $repository->getCashAccount();
|
||||
|
||||
Reference in New Issue
Block a user