don't overwrite contact ID when trigger is contact-based
This fixes an old regression from !3 (merged).
MR !3 (merged) passes the id of the entity that triggered a rule into
Email.send. E.g. if the trigger is a contribution, we pass the contribution ID in - so we can process contribution tokens.
$params['contact_id'] represents the recipient of the email, and should not be overwritten. When using a rule like "Send to Related Contact" or "Send to Roles on Case", where the contact ID that triggered the rule isn't the same as the recipient, this changes the recipient. So "Send to Related Contact/Roles on Case" functions identically to "Send to Contact" when the contact is trigger-based.
Steps to replicate
- Create a new rule with a trigger of "Contact is changed" and an action of "Send Rule to Related Contact".
- Go to a contact that has a relationship matching the one specified in the rule.
- Edit the contact
Email goes to related contact.
Email goes to contact that triggered the rule.