Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in Event Module: Email Subject Variables Not Being Replaced in Invitations #599

Open
shubham-pawar opened this issue Jan 28, 2025 · 0 comments
Labels
Type: Bug Something isn't working

Comments

@shubham-pawar
Copy link

shubham-pawar commented Jan 28, 2025

Description

When sending out an email invitation through the Event module in SuiteCRM, the subject line does not correctly replace the variable placeholder (e.g., {XYZ}). The template engine fails to parse the placeholder, leaving it as-is in the email subject. This issue occurs in the FP_Events module, specifically in the code responsible for email subject parsing.

Expected Behavior:

The variable in the email subject should be replaced correctly when the invitation is sent, such as replacing {XYZ} with the actual value (e.g., contact name, event details, etc.).

Actual Behavior:

The email subject retains the variable placeholder as-is (e.g., Personal invitation for {XYZ}) instead of replacing it with the actual value.

Issue

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);

Possible Fix

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);

Steps to Reproduce the Issue

1. Go to the Events module and create or edit an event.
2. In the email template, include a variable in the subject line (e.g., Personal invitation for {XYZ}).
3. Send an invitation to a contact, lead, or prospect.
4. Check the received email. The variable placeholder {XYZ} does not get replaced with the corresponding value.


### Version

8.7

### What browser are you currently using?

Chrome

### Browser Version

Version 131.0

### Environment Information

PHP 8.2 

### Operating System and Version

Ubuntu 22.04
@shubham-pawar shubham-pawar added the Type: Bug Something isn't working label Jan 28, 2025
@shubham-pawar shubham-pawar changed the title Event invitation doesn’t parse variables in the subject Bug in Event Module: Email Subject Variables Not Being Replaced in Invitations Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant