Skip to content

Commit

Permalink
Mixed Owner validation fix (#1834)
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron-eyds authored Apr 17, 2024
1 parent 4b8e94f commit 3c64740
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ppr-ui/src/composables/mhrRegistration/useHomeOwners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,17 @@ export function useHomeOwners (isMhrTransfer: boolean = false, isMhrCorrection:

const hasMixedOwnersInGroup = (groupId: number): boolean => {
if (isMhrCorrection) return false

const owners = getGroupById(groupId)?.owners
if (owners?.length < 2) return false

// Verify there is at least one unique owner type in the group, as business and individuals can be mixed
const hasAdminExecOrTrustee = owners?.some(owner =>
[HomeOwnerPartyTypes.TRUSTEE, HomeOwnerPartyTypes.EXECUTOR, HomeOwnerPartyTypes.ADMINISTRATOR]
.includes(owner.partyType))

const partyType = owners?.[0].partyType
return owners?.some(owner => owner.partyType !== partyType)
return hasAdminExecOrTrustee && owners?.some(owner => owner.partyType !== partyType)
}
// WORKING WITH GROUPS

Expand Down

0 comments on commit 3c64740

Please sign in to comment.