add contactId
to params array in EmailTrait
#26748
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Add
contactId
to params array in EmailTrait calling wrapper function send email.Related to add contact_id to email params in emailLetter function.
Before
Params array of
alterMailParams
hook does not containcontactId
when context issingleEmail
.After
Params array of
alterMailParams
hook containscontactId
when context issingleEmail
.Comments
These comments are not referring to this PR, but to the
alterMailParams
hook that I encountered while during my testing.When I send a single email
alterMailParams
hook is called 2 times: one for contextmessageTemplate
and one forsingleEmail
. I have no way of knowing whether it is called only for rendering the template or for sending the email: respectively functionsCRM_Core_BAO_MessageTemplate:renderTemplate
andCRM_Core_BAO_MessageTemplate:sendTemplate
.In this hook I add attachments for context
messageTemplate
, these attachments are ignored because functionsendMessage
is called ignoring the attachements in rendered template (see row 796 ofCRM_Contact_Form_Task_EmailTrait
class).Finally, I do not understand why
CRM_Contribute_Form_Task_PDFLetter
does not useCRM_Contact_Form_Task_EmailTrait
trait.Let me know if you think there are things that can be improved in this PR. If not, I can open issues.