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