Skip to content

Correct capitalisation in TriggerData->getContactId

I think there is a small bug in CRM_Civirules_TriggerData_TriggerData->getContactId that prevents the contact ID from being returned as quickly as it could be. But I cannot be sure as I am in no way an expert on CiviRules internals. All I have noticed is that types of entity data are always spelled with the first letter in capitals in CiviRules (search the whole extension for the RE ['"][cC]ontact['"]). I can only find occurences starting with a capital C and several of these refer to entities. If my observation is correct, the piece of code in getContactId that tries to find its result in $this->entity_data['contact']['id'] will never succeed.

As a consequence, if I am right, retrieving the contact ID would probably still work in many cases, as the code tries to find it in two other ways (via the class member or other entities with a contact_id property). But the lines I am changing in this MR are a shortcut that would never be used. If a am wrong, however, there would be some cases where the contact ID would no longer be found. I have to leave that to you to determine, sorry :-)

Merge request reports