Skip to content

Commit

Permalink
Merge pull request #1044 from bcgov/release-PRD-1.14.0.2
Browse files Browse the repository at this point in the history
Updating hotfix branch with Build 1.14.0.2
  • Loading branch information
NataliaNikishina authored Nov 19, 2024
2 parents 129f1cc + d4d8d73 commit f5aa9bf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 24 deletions.
31 changes: 9 additions & 22 deletions src/main/default/classes/ChangeAccountOwner.cls
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,11 @@ public with sharing class ChangeAccountOwner {

Id newOwnerId = input.newOwnerId;
List<Id> 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;

if (newOwnerId == null || accountId.isEmpty()) {
return;
}
Expand Down Expand Up @@ -91,28 +78,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);
Expand Down
4 changes: 2 additions & 2 deletions src/main/default/classes/FetchAndGenerateCSV.cls
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public with sharing class FetchAndGenerateCSV {
List<Account> accounts = [SELECT Id, RegId__c, Name, HealthAuthority__c, ExemptionofAddressPublication__c, Phone, Extension__c, Fax, Website, Status__c, Parent.Name,
(SELECT ContactId, PrimaryContact__c, Contact.Name FROM AccountContactRelations WHERE PrimaryContact__c = true LIMIT 1),
(SELECT RegistrationCertificate__c FROM AccountBusinessLicenses__r WHERE Status = 'Active' LIMIT 1),
(SELECT ServiceName__c FROM Services__r WHERE ServiceName__c IN: serviceNameList LIMIT 50),
(SELECT ServiceName__c, Status__c FROM Services__r WHERE ServiceName__c IN: serviceNameList LIMIT 50),
(SELECT Id, Location.VisitorAddress.Address FROM AssociatedLocations WHERE ActiveTo = NULL LIMIT 1),
Account.LicenseType__r.RegulatoryAuthorizationCode__c,
(SELECT Quantity, Type__c FROM Assets WHERE Type__c IN: typeList AND ParentId = NULL AND Quantity > 0.00)
Expand Down Expand Up @@ -140,7 +140,7 @@ public with sharing class FetchAndGenerateCSV {
// Helper method to get the service flag
private static String getServiceFlag(List<Service__c> services, String serviceName){
for(Service__c service : services){
if(!String.isEmpty(serviceName) && serviceName.containsIgnoreCase(service.ServiceName__c)){
if(service.Status__c == 'Active' && service.ServiceName__c == serviceName){
return '-1'; // Flag '-1' if service name is found
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/default/classes/FetchAndGenerateCSVTest.cls
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ private class FetchAndGenerateCSVTest {
ServiceName__c = 'Assistance with daily living activities',
ServiceType__c = 'Assisted Living Service',
ProvidedBy__c = 'Registrant',
Status__c = 'Active',
Account__c = Residence.id
);
insert ser;
Expand Down Expand Up @@ -122,6 +123,7 @@ private class FetchAndGenerateCSVTest {
ServiceName__c = 'Assistance with daily living activities',
ServiceType__c = 'Assisted Living Service',
ProvidedBy__c = 'Registrant',
Status__c = 'Active',
Account__c = Residence.id
);
insert ser;
Expand Down

0 comments on commit f5aa9bf

Please sign in to comment.