From 63a7a4b03b9cbb0a38ba3d9657e7da5cb6b5fa75 Mon Sep 17 00:00:00 2001 From: Sander Dorigo Date: Fri, 23 Jun 2023 11:07:50 +0200 Subject: [PATCH] New version --- app/Validation/Account/DepositValidation.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Validation/Account/DepositValidation.php b/app/Validation/Account/DepositValidation.php index 630a19cecd..080dc490aa 100644 --- a/app/Validation/Account/DepositValidation.php +++ b/app/Validation/Account/DepositValidation.php @@ -122,6 +122,16 @@ trait DepositValidation $result = false; } + // if there is an iban, it can only be in use by a revenue account or we will fail. + if(null !== $accountIban && '' !== $accountIban) { + app('log')->debug('Check if there is not already an account with this IBAN'); + $existing = $this->findExistingAccount([AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE], ['iban' => $accountIban]); + if(null !== $existing) { + $this->destError = (string)trans('validation.deposit_src_iban_exists'); + return false; + } + } + // if the user submits an ID, but that ID is not of the correct type, // return false. if (null !== $accountId) {