From 96a148397603604b4b5a78db48631d1f22d51e07 Mon Sep 17 00:00:00 2001 From: Rich Lott / Artful Robot Date: Fri, 28 Feb 2025 10:01:57 +0000 Subject: [PATCH] Add category changes to activity custom fields --- Civi/ContactCats/Processor.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Civi/ContactCats/Processor.php b/Civi/ContactCats/Processor.php index a4e57fa..a21d17c 100644 --- a/Civi/ContactCats/Processor.php +++ b/Civi/ContactCats/Processor.php @@ -22,7 +22,7 @@ class Processor { $this->categories = ContactCategoryDefinition::get(FALSE) ->addOrderBy('execution_order') - ->execute()->getArrayCopy(); + ->execute()->indexBy('id')->getArrayCopy(); // Check the last item is the 'default' one. if ((end($this->categories)['search_type'] ?? '') !== 'default') { @@ -133,6 +133,8 @@ class Processor { ->addValue('source_contact_id', $domainContactID) ->addValue('status_id:name', 'Completed') ->addValue('subject', $subject) + ->addValue('Category_changes.previous_category_id', $oldCategoryId) + ->addValue('Category_changes.new_category_id', $newCategoryId) ->execute()->first(); $activityID = (int) $a['id']; // Join activity to all relevant contacts