mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 09:52:20 +00:00
Catch link error.
This commit is contained in:
@@ -83,13 +83,6 @@ class LinkController extends Controller
|
|||||||
return redirect(strval(session('journal_links.delete.uri')));
|
return redirect(strval(session('journal_links.delete.uri')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function switch(LinkTypeRepositoryInterface $repository, TransactionJournalLink $link) {
|
|
||||||
|
|
||||||
$repository->switchLink($link);
|
|
||||||
|
|
||||||
return redirect(URL::previous());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param JournalLinkRequest $request
|
* @param JournalLinkRequest $request
|
||||||
* @param LinkTypeRepositoryInterface $repository
|
* @param LinkTypeRepositoryInterface $repository
|
||||||
@@ -127,7 +120,13 @@ class LinkController extends Controller
|
|||||||
$linkJournalId = intval($request->string('link_other'));
|
$linkJournalId = intval($request->string('link_other'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$opposing = $journalRepository->find($linkJournalId);
|
$opposing = $journalRepository->find($linkJournalId);
|
||||||
|
if (is_null($opposing->id)) {
|
||||||
|
Session::flash('error', trans('firefly.invalid_link_data'));
|
||||||
|
|
||||||
|
return redirect(route('transactions.show', $journal->id));
|
||||||
|
}
|
||||||
$result = $repository->findLink($journal, $opposing);
|
$result = $repository->findLink($journal, $opposing);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
Session::flash('error', trans('firefly.journals_error_linked'));
|
Session::flash('error', trans('firefly.journals_error_linked'));
|
||||||
@@ -155,4 +154,12 @@ class LinkController extends Controller
|
|||||||
return redirect(route('transactions.show', $journal->id));
|
return redirect(route('transactions.show', $journal->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function switch(LinkTypeRepositoryInterface $repository, TransactionJournalLink $link)
|
||||||
|
{
|
||||||
|
|
||||||
|
$repository->switchLink($link);
|
||||||
|
|
||||||
|
return redirect(URL::previous());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user