Commit 46da72d1 authored by jaapjansma's avatar jaapjansma
Browse files

Merge branch 'triggerdata-primaryentity' into 'master'

set contact 1 as "primary" entity when setting entity data

See merge request !4
parents 3e3e12dd 7e957c86
...@@ -21,7 +21,7 @@ class CRM_WebformCivirules_TriggerData extends CRM_Civirules_TriggerData_Trigger ...@@ -21,7 +21,7 @@ class CRM_WebformCivirules_TriggerData extends CRM_Civirules_TriggerData_Trigger
foreach($data as $entity => $datasets) { foreach($data as $entity => $datasets) {
foreach ($datasets as $rec_num => $record) { foreach ($datasets as $rec_num => $record) {
if ($rec_num == 1) { if ($rec_num == 1) {
$this->setEntityData($entity, $record); $this->setEntityData($entity, $record, $entity == 'contact'); // make contact 1 the "primary entity" for the Trigger Data
} }
$this->setEntityData($entity . '_' . $rec_num, $record); $this->setEntityData($entity . '_' . $rec_num, $record);
} }
...@@ -53,4 +53,4 @@ class CRM_WebformCivirules_TriggerData extends CRM_Civirules_TriggerData_Trigger ...@@ -53,4 +53,4 @@ class CRM_WebformCivirules_TriggerData extends CRM_Civirules_TriggerData_Trigger
return $return; return $return;
} }
} }
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment