Merge pull request #6855 from eps90/fix-bulk-validator-for-expenses

Do not validate currency if account has no currency configured
This commit is contained in:
James Cole 2023-01-14 17:44:55 +01:00 committed by GitHub
commit 63a7aad44c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,8 +67,16 @@ trait ValidatesBulkTransactionQuery
return; return;
} }
// must have same currency: // must have same currency:
if ($repository->getAccountCurrency($source)->id !== $repository->getAccountCurrency($dest)->id) { // some account types (like expenses) do not have currency, so they have to be omitted
$sourceCurrency = $repository->getAccountCurrency($source);
$destCurrency = $repository->getAccountCurrency($dest);
if (
$sourceCurrency !== null
&& $destCurrency !== null
&& $sourceCurrency->id !== $destCurrency->id
) {
$validator->errors()->add('query', (string)trans('validation.invalid_query_currency')); $validator->errors()->add('query', (string)trans('validation.invalid_query_currency'));
} }
} }