From 1c68b0902d6e32f6597457fbc9ce5cdcb493ffcb Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 7 Sep 2019 19:40:44 +0200 Subject: [PATCH] Fix for #2555 --- app/Validation/AccountValidator.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/Validation/AccountValidator.php b/app/Validation/AccountValidator.php index 3e9400abd2..ebbc66cb73 100644 --- a/app/Validation/AccountValidator.php +++ b/app/Validation/AccountValidator.php @@ -106,6 +106,10 @@ class AccountValidator return false; } + + // whatever happens, source cannot equal destination: + + switch ($this->transactionType) { default: $this->destError = sprintf('AccountValidator::validateDestination cannot handle "%s", so it will always return false.', $this->transactionType); @@ -508,7 +512,14 @@ class AccountValidator $this->destination = $search; // must not be the same as the source account - return !(null !== $this->source && $this->source->id === $this->destination->id); + if (null !== $this->source && $this->source->id === $this->destination->id) { + $this->sourceError = 'Source and destination are the same.'; + $this->destError = 'Source and destination are the same.'; + + return false; + } + + return true; } /**