From 6d42c8cc8bc14934ecd63dd21fc369bf2c1bc0ae Mon Sep 17 00:00:00 2001 From: NikhilJeenru <129547845+NikhilJeenru@users.noreply.github.com> Date: Mon, 4 Nov 2024 12:41:59 -0800 Subject: [PATCH 1/2] BCMOHAM-20755 --- .../default/classes/ChangeAccountOwner.cls | 34 +++++++------------ 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/src/main/default/classes/ChangeAccountOwner.cls b/src/main/default/classes/ChangeAccountOwner.cls index 18b4571a..7b30f232 100644 --- a/src/main/default/classes/ChangeAccountOwner.cls +++ b/src/main/default/classes/ChangeAccountOwner.cls @@ -34,23 +34,15 @@ public with sharing class ChangeAccountOwner { Id newOwnerId = input.newOwnerId; List accountId = input.accountId; - Boolean isBlaChecked = input.isBlaChecked; - Boolean isPublicChecked = input.isPublicChecked; - Boolean isCaseChecked = input.isCaseChecked; - Boolean isInspectionChecked = input.isInspectionChecked; - - if(isBlaChecked != null || isPublicChecked != null || isCaseChecked != null || isInspectionChecked != null){ - isBlaChecked = TRUE; - isPublicChecked = TRUE; - isCaseChecked = TRUE; - isInspectionChecked = TRUE; - } - else{ - isBlaChecked = FALSE; - isPublicChecked = FALSE; - isCaseChecked = FALSE; - isInspectionChecked = FALSE; - } + Boolean isBlaChecked = input.isBlaChecked != null ? input.isBlaChecked : false; + Boolean isPublicChecked = input.isPublicChecked != null ? input.isPublicChecked : false; + Boolean isCaseChecked = input.isCaseChecked != null ? input.isCaseChecked : false; + Boolean isInspectionChecked = input.isInspectionChecked != null ? input.isInspectionChecked : false; + + system.debug(isBlaChecked); + system.debug(isPublicChecked); + system.debug(isCaseChecked); + system.debug(isInspectionChecked); if (newOwnerId == null || accountId.isEmpty()) { return; @@ -91,28 +83,28 @@ public with sharing class ChangeAccountOwner { Account acc = new Account(Id = accId.Id, OwnerId = newOwnerId); accountsToUpdate.add(acc); - if ((isBlaChecked && mapBlaRecords.containsKey(accId.Id)) || (accId.RecordType.DeveloperName != 'Registrant' && isBlaChecked == FALSE)) { + if ((isBlaChecked && mapBlaRecords.containsKey(accId.Id))) { for (BusinessLicenseApplication bla : mapBlaRecords.get(accId.Id)) { bla.OwnerId = newOwnerId; blaRecordsToUpdate.add(bla); } } - if ((isPublicChecked && mapPublicCompRecords.containsKey(accId.Id)) || (accId.RecordType.DeveloperName != 'Registrant' && isPublicChecked == FALSE)){ + if ((isPublicChecked && mapPublicCompRecords.containsKey(accId.Id))) { for (PublicComplaint pubComp : mapPublicCompRecords.get(accId.Id)) { pubComp.OwnerId = newOwnerId; publicCompRecordsToUpdate.add(pubComp); } } - if ((isCaseChecked && mapCaseRecords.containsKey(accId.Id)) || (accId.RecordType.DeveloperName != 'Registrant' && isCaseChecked == FALSE)) { + if ((isCaseChecked && mapCaseRecords.containsKey(accId.Id))) { for (Case caseRec : mapCaseRecords.get(accId.Id)) { caseRec.OwnerId = newOwnerId; caseRecordsToUpdate.add(caseRec); } } - if ((isInspectionChecked && mapVisitRecords.containsKey(accId.Id)) || (accId.RecordType.DeveloperName != 'Registrant' && isInspectionChecked == FALSE)) { + if ((isInspectionChecked && mapVisitRecords.containsKey(accId.Id))) { for (Visit visit : mapVisitRecords.get(accId.Id)) { visit.OwnerId = newOwnerId; visitRecordsToUpdate.add(visit); From 54ac125b2526b41708751d9f05bdbddc03e101d8 Mon Sep 17 00:00:00 2001 From: NikhilJeenru <129547845+NikhilJeenru@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:08:36 -0800 Subject: [PATCH 2/2] BCMOHAM-20755 --- src/main/default/classes/ChangeAccountOwner.cls | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main/default/classes/ChangeAccountOwner.cls b/src/main/default/classes/ChangeAccountOwner.cls index 7b30f232..d2a1d36b 100644 --- a/src/main/default/classes/ChangeAccountOwner.cls +++ b/src/main/default/classes/ChangeAccountOwner.cls @@ -38,12 +38,7 @@ public with sharing class ChangeAccountOwner { Boolean isPublicChecked = input.isPublicChecked != null ? input.isPublicChecked : false; Boolean isCaseChecked = input.isCaseChecked != null ? input.isCaseChecked : false; Boolean isInspectionChecked = input.isInspectionChecked != null ? input.isInspectionChecked : false; - - system.debug(isBlaChecked); - system.debug(isPublicChecked); - system.debug(isCaseChecked); - system.debug(isInspectionChecked); - + if (newOwnerId == null || accountId.isEmpty()) { return; }