From 828b9d32aa82451d6909bbbc8c3ae3b08e85a8ad Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 7 Nov 2019 06:10:46 +0100 Subject: [PATCH] Fix #2805 --- app/Validation/AccountValidator.php | 3 +-- config/firefly.php | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/Validation/AccountValidator.php b/app/Validation/AccountValidator.php index 9721bca282..b572c5ea30 100644 --- a/app/Validation/AccountValidator.php +++ b/app/Validation/AccountValidator.php @@ -106,7 +106,6 @@ class AccountValidator return false; } - switch ($this->transactionType) { default: $this->destError = sprintf('AccountValidator::validateDestination cannot handle "%s", so it will always return false.', $this->transactionType); @@ -574,7 +573,7 @@ class AccountValidator $found = $this->accountRepository->findNull($accountId); if (null !== $found) { $type = $found->accountType->type; - if (in_array($type, $validTypes)) { + if (in_array($type, $validTypes, true)) { return true; } $this->destError = (string)trans('validation.withdrawal_dest_bad_data', ['id' => $accountId, 'name' => $accountName]); diff --git a/config/firefly.php b/config/firefly.php index baa1248318..1d397f378f 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -684,13 +684,13 @@ return [ 'source_dests' => [ TransactionTypeModel::WITHDRAWAL => [ AccountType::ASSET => [AccountType::EXPENSE, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::CASH], - AccountType::LOAN => [AccountType::EXPENSE], - AccountType::DEBT => [AccountType::EXPENSE], - AccountType::MORTGAGE => [AccountType::EXPENSE], + AccountType::LOAN => [AccountType::EXPENSE, AccountType::CASH], + AccountType::DEBT => [AccountType::EXPENSE, AccountType::CASH], + AccountType::MORTGAGE => [AccountType::EXPENSE, AccountType::CASH], ], TransactionTypeModel::DEPOSIT => [ AccountType::REVENUE => [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE], - AccountType::CASH => [AccountType::ASSET], + AccountType::CASH => [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE], AccountType::LOAN => [AccountType::ASSET], AccountType::DEBT => [AccountType::ASSET], AccountType::MORTGAGE => [AccountType::ASSET],