Skip to content

Firefly III: a personal finances manager

New version

Sander Dorigo63a7a4b03b9c
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) {