Event invitation doesn't parse variables in the subject

Hi gents

I found a bug in the event module. When sending out an invitation by email and in the template in the subject is a variable (ie. personal invitation for {XYZ}). the variable isn’t replaced.

So I did a bit of research and found the bug in the code in “modules/FP_Events/controller.php” in line

427 (for contacts):
$email_subject = $emailTemp->parse_template_bean($emailTemp->subject, ‘FP_events’, $event);

484 (for prospects):
$email_subject = $emailTemp->parse_template_bean($emailTemp->subject, ‘FP_events’, $event);

540 (for leads):
$email_subject = $emailTemp->parse_template_bean($emailTemp->subject, ‘FP_events’, $event);

The issue is, that parsing the subject template is not working with the bean_name of “FP_events”. So I copied the fix from the lines above and parsed the variables first through “Contacts” and then again as intended.

Here the code:

Contacts:
$firstpass_subj = $emailTemp->parse_template_bean($emailTemp->subject, ‘Contacts’, $contact);
$email_subject = $emailTemp->parse_template_bean($firstpass_subj, ‘FP_events’, $event);

Prospects:
$firstpass_subj = $emailTemp->parse_template_bean($emailTemp->subject, ‘Contacts’, $target);
$email_subject = $emailTemp->parse_template_bean($firstpass_subj, ‘FP_events’, $event);

Leads:
$firstpass_subj = $emailTemp->parse_template_bean($emailTemp->subject, ‘Contacts’, $lead);
$email_subject = $emailTemp->parse_template_bean($firstpass_subj, ‘FP_events’, $event);

It works like a charm now. Since I have no account on github, would someon be so nice, to upload it there? :slight_smile:

Cheers,
Carsten

That’s a good work! :partying_face: :partying_face: :partying_face:

1 Like

Btw: I am using SuiteCRM 8.7.1 in PROD and 8.8-beta in DEV with PHP 8.1.31

To replicate the case, just create an event (with location), add a few participants and an inivation email template. Set in the subject a variable like “firstname”, “lastname” (i.e. personal invitation for “John Doe”). Then send out the invitation.

I hope, this helps. :slight_smile:

Hey, congrats! :boom: Good job, team!

1 Like