mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Fix #2434
This commit is contained in:
@@ -27,6 +27,7 @@ namespace FireflyIII\Http\Controllers\Account;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Controllers\UserNavigation;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
@@ -34,6 +35,8 @@ use Illuminate\Http\Request;
|
||||
*/
|
||||
class DeleteController extends Controller
|
||||
{
|
||||
use UserNavigation;
|
||||
|
||||
/** @var AccountRepositoryInterface The account repository */
|
||||
private $repository;
|
||||
|
||||
@@ -67,6 +70,10 @@ class DeleteController extends Controller
|
||||
*/
|
||||
public function delete(Account $account)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$typeName = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type));
|
||||
$subTitle = (string)trans(sprintf('firefly.delete_%s_account', $typeName), ['name' => $account->name]);
|
||||
$accountList = app('expandedform')->makeSelectListWithEmpty($this->repository->getAccountsByType([$account->accountType->type]));
|
||||
@@ -89,6 +96,10 @@ class DeleteController extends Controller
|
||||
*/
|
||||
public function destroy(Request $request, Account $account)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$type = $account->accountType->type;
|
||||
$typeName = config(sprintf('firefly.shortNamesByFullName.%s', $type));
|
||||
$name = $account->name;
|
||||
|
Reference in New Issue
Block a user