Do not search for empty number.

This commit is contained in:
James Cole 2022-02-28 08:31:58 +01:00
parent efb7d4275d
commit a58c6b0cec
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80

View File

@ -172,7 +172,7 @@ trait JournalServiceTrait
private function findAccountByNumber(?Account $account, array $data, array $types): ?Account private function findAccountByNumber(?Account $account, array $data, array $types): ?Account
{ {
// third attempt, find by account number // third attempt, find by account number
if (null === $account && null !== $data['number']) { if (null === $account && null !== $data['number'] && '' !== (string) $data['number']) {
Log::debug(sprintf('Searching for account number "%s".', $data['number'])); Log::debug(sprintf('Searching for account number "%s".', $data['number']));
// find by preferred type. // find by preferred type.
$source = $this->accountRepository->findByAccountNumber((string)$data['number'], [$types[0]]); $source = $this->accountRepository->findByAccountNumber((string)$data['number'], [$types[0]]);