Some Conditions and Actions don't work with Renew Membership Trigger
This is using the latest CiviRules 2.23-dev at 12/3/21, and CiviCRM 5.35.0 on Drupal 8.9.13.
I invoke the Membership Renewed trigger by using the Renew button on the Membership tab of the Contact Summary screen. In this case a Condition checking the Contact Type with the Field Value Comparison condition fails and the rule never fires. Without the Condition, Actions which use the Contact Id also fail.
If I use the Edit button to just change the Membership End Date then the Membership Changed trigger fires instead, which works correctly. If I test the same operation on CiviRules 2.19, CiviCRM 5.30.0 and Drupal 7 it works correctly.
I believe the fault is because the $objectRef passed to the CRM_Civirules_Trigger_Post::post()
function in the failing case has contactId set to null, whereas in other cases it is properly populated. I note that in the failing D8 case the post() function is passed a CRM_Member_BAO_Membership
object, while the D7 case passes a CRM_Member_DAO_Membership
.
I do not know whether to say that this is a problem with
- Core CiviCRM for not completing the ContactId when calling the trigger's post() callback function.
- CiviRules for not extracting the ContactId from the Membership record if not available directly.
- Something else I've missed.
This seems to have some similarities with #123 (closed), but probably not the same in detail.