From 1a488fb4e8510c7435e98e66f9cc94ecfa1971f8 Mon Sep 17 00:00:00 2001 From: GeekStewie Date: Wed, 6 Nov 2024 14:56:54 +0000 Subject: [PATCH] Update ASCS_MovementTriggerHandler.cls --- .../classes/ASCS_MovementTriggerHandler.cls | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/force-app/main/default/classes/ASCS_MovementTriggerHandler.cls b/force-app/main/default/classes/ASCS_MovementTriggerHandler.cls index b25cbc7..a342835 100644 --- a/force-app/main/default/classes/ASCS_MovementTriggerHandler.cls +++ b/force-app/main/default/classes/ASCS_MovementTriggerHandler.cls @@ -2,7 +2,7 @@ public with sharing class ASCS_MovementTriggerHandler { // Method to handle logic after insert public static void handleInsert(Map newMap) { - + // Check if the allocation toggle is set: // Return out if allocation enabled is false // ASCS_Allocation_Toggle__c toggle = ASCS_Allocation_Toggle__c.getOrgDefaults(); @@ -25,17 +25,17 @@ public with sharing class ASCS_MovementTriggerHandler { // Method to handle logic after update public static void handleUpdate(Map newMap, Map oldMap) { - + // Return out if allocation enables is false // ASCS_Allocation_Toggle__c toggle = ASCS_Allocation_Toggle__c.getOrgDefaults(); // Boolean toggleValue = Boolean.valueOf(toggle.get('ASCS_Allocation_Enabled__c')); // System.debug('Toggle' + toggleValue); // if(toggleValue == false) return; - - // Create List of Locations + + // Create List of Locations //Create Lost of Location Id Strings List locationIdStringList = new List(); - + // Loop incase of bulk movement creation for (Id movementId : newMap.keySet()) { animalshelters__Movement__c newMovement = newMap.get(movementId); @@ -43,7 +43,7 @@ public with sharing class ASCS_MovementTriggerHandler { // Pull current value from new and onld map Boolean oldCurrentValue = Boolean.valueOf(oldMovement.get('animalshelters__Current__c')); Boolean newCurrentValue = Boolean.valueOf(newMovement.get('animalshelters__Current__c')); - + // Check that the movement current value has been changed if(oldCurrentValue != newCurrentValue){ // Add to location string list @@ -68,12 +68,12 @@ public with sharing class ASCS_MovementTriggerHandler { WHERE animalshelters__Location__c IN :locationIdStringList AND animalshelters__Current__c = true GROUP BY animalshelters__Location__c ]; - + // Loop through the results and populate the map for (AggregateResult result : results) { String locationId = (String)result.get('animalshelters__Location__c'); Integer count = (Integer)result.get('expr0'); - + // Create temp location to update the allocation animalshelters__Locations__c tempLocation = new animalshelters__Locations__c(); tempLocation.Id = locationId;