Add category changes to activity custom fields

This commit is contained in:
Rich Lott / Artful Robot 2025-02-28 10:01:57 +00:00
parent 69d4c6b2e8
commit 96a1483976

View file

@ -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