Fix an issue where users were unable to create revenue / expense account combinations with the same name. #2987

This commit is contained in:
James Cole 2020-01-11 17:31:32 +01:00
parent 8c36a371be
commit 534f4de520
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E

View File

@ -375,13 +375,14 @@ class FireflyValidator extends Validator
*/
public function validateUniqueAccountForUser($attribute, $value, $parameters): bool
{
// because a user does not have to be logged in (tests and what-not).
if (!auth()->check()) {
return $this->validateAccountAnonymously();
}
if (isset($this->data['what'])) {
if (isset($this->data['objectType'])) {
return $this->validateByAccountTypeString($value, $parameters, $this->data['what']);
return $this->validateByAccountTypeString($value, $parameters, $this->data['objectType']);
}
if (isset($this->data['type'])) {
return $this->validateByAccountTypeString($value, $parameters, $this->data['type']);