Skip to content

Firefly III: a personal finances manager

Removed some unused code.

James Coled43936155c15
diff --git a/app/Crud/Account/AccountCrud.php b/app/Crud/Account/AccountCrud.php
index e1d63dc8fe..172d3f1783 100644
--- a/app/Crud/Account/AccountCrud.php
+++ b/app/Crud/Account/AccountCrud.php
@@ -119,7 +119,7 @@ class AccountCrud implements AccountCrudInterface
*/
public function findByIban(string $iban, array $types): Account
{
- $query = $this->user->accounts()->where('iban', '!=', '');
+ $query = $this->user->accounts()->where('iban', '!=', '')->whereNotNull('iban');
if (count($types) > 0) {
$query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
@@ -176,11 +176,7 @@ class AccountCrud implements AccountCrudInterface
public function getAccountsById(array $accountIds): Collection
{
/** @var Collection $result */
- $query = $this->user->accounts()->with(
- ['accountmeta' => function (HasMany $query) {
- $query->where('name', 'accountRole');
- }]
- );
+ $query = $this->user->accounts();
if (count($accountIds) > 0) {
$query->whereIn('accounts.id', $accountIds);
@@ -204,11 +200,7 @@ class AccountCrud implements AccountCrudInterface
public function getAccountsByType(array $types): Collection
{
/** @var Collection $result */
- $query = $this->user->accounts()->with(
- ['accountmeta' => function (HasMany $query) {
- $query->where('name', 'accountRole');
- }]
- );
+ $query = $this->user->accounts();
if (count($types) > 0) {
$query->accountTypeIn($types);
}
@@ -303,24 +295,6 @@ class AccountCrud implements AccountCrudInterface
return $account;
}
- /**
- * @param Account $account
- * @param string $type
- *
- * @return Account
- */
- public function updateAccountType(Account $account, string $type): Account
- {
- $type = AccountType::whereType($type)->first();
- if (!is_null($type)) {
- $account->accountType()->associate($type);
- $account->save();
- }
-
- return $this->find($account->id);
-
- }
-
/**
* @param array $data
*
diff --git a/app/Crud/Account/AccountCrudInterface.php b/app/Crud/Account/AccountCrudInterface.php
index 8a3d7507c4..772bf6afcb 100644
--- a/app/Crud/Account/AccountCrudInterface.php
+++ b/app/Crud/Account/AccountCrudInterface.php
@@ -108,11 +108,4 @@ interface AccountCrudInterface
*/
public function update(Account $account, array $data): Account;
- /**
- * @param Account $account
- * @param string $type
- *
- * @return Account
- */
- public function updateAccountType(Account $account, string $type): Account;
}
diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php
index 164a3e8ffb..7880ddea05 100644
--- a/app/Http/Controllers/TransactionController.php
+++ b/app/Http/Controllers/TransactionController.php
@@ -62,6 +62,7 @@ class TransactionController extends Controller
*/
public function create(string $what = TransactionType::DEPOSIT)
{
+ /** @var AccountCrudInterface $crud */
$crud = app(AccountCrudInterface::class);
$budgetRepository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
$piggyRepository = app('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface');