From 3b368242e96745026f1b7427cfb5d81233e2da07 Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Fri, 20 Aug 2021 16:55:03 +0100 Subject: [PATCH] Handle contact subtypes when retrieving preData/originalData for Contacts (affects customdata) --- CRM/Civirules/Utils/PreData.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/CRM/Civirules/Utils/PreData.php b/CRM/Civirules/Utils/PreData.php index 9d08db4..7856261 100644 --- a/CRM/Civirules/Utils/PreData.php +++ b/CRM/Civirules/Utils/PreData.php @@ -127,10 +127,16 @@ class CRM_Civirules_Utils_PreData { * @static */ public static function getPreData($entity, $entityId, $eventID) { - if (isset(self::$preData[$entity][$entityId][$eventID])) { - return self::$preData[$entity][$entityId][$eventID]; + $entityNames = [$entity]; + if ($entity === 'Contact') { + $entityNames = ['Contact', 'Individual', 'Organization', 'Household']; } - return array(); + foreach ($entityNames as $entity) { + if (isset(self::$preData[$entity][$entityId][$eventID])) { + return self::$preData[$entity][$entityId][$eventID]; + } + } + return []; } } -- GitLab