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

Fix #10355 - Template Parser for extended modules #10356

Open
wants to merge 1 commit into
base: hotfix
Choose a base branch
from

Conversation

ojs87
Copy link
Contributor

@ojs87 ojs87 commented Feb 6, 2024

Description

Modules that are extended in the custom folder, e.g. AOS_Quotes.php, are not correctly replacing variables based on the variables available in the Email Templates module. This is due to an extended module using a different beanList name(e.g. customAOS_Quotes) and the template parser using that beanList name as the key for the variables.

Motivation and Context

Extended modules should use the same basic variables in the Email Template editor to parse Email Templates

How To Test This

  1. Extend the AOS_Quotes.php file by adding it to the custom/modules/AOS_Quotes folder and creating a basic class
<?php
if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}
require_once('modules/AOS_Quotes/AOS_Quotes_sugar.php');

class CustomAOS_Quotes extends AOS_Quotes_sugar
{
    public function save($check_notify = false)
    {
    
        $saved = parent::save($check_notify);

          return $saved;
       }
}
  1. Add the required global name changes for the module in custom/Extension/application/Ext/Include/AOS_Quotes.php file
<?php
$objectList['AOS_Quotes'] = 'AOS_Quotes';
$beanList['AOS_Quotes'] = 'CustomAOS_Quotes';
$beanFiles['CustomAOS_Quotes'] = 'custom/modules/AOS_Quotes/CustomAOS_Quotes.php';
  1. Repair and rebuild and create an email template for quotes, then a workflow to send an email when a quote is created
  2. Create a quote
  3. The sent email will not parse the variables correctly

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Final checklist

  • My code follows the code style of this project found here.
  • My change requires a change to the documentation.
  • I have read the How to Contribute guidelines.

@serhiisamko091184
Copy link
Contributor

Hey @ojs87,

thanks a lot for contributing to the project!

Regards,
Serhii

@serhiisamko091184 serhiisamko091184 added Status: Requires Code Review Needs the core team to code review Status:Assessed PRs that have been tested and confirmed to resolve an issue by a core team member Branch:Hotfix PR 4-8 Score given to PRs once assessed labels Feb 9, 2024
@jack7anderson7 jack7anderson7 added Status: Requires Testing Requires Manual Testing Status: Passed Code Review Mark issue has passed code review reviewed and removed Status: Requires Code Review Needs the core team to code review labels May 1, 2024
@johnM2401
Copy link
Contributor

Hey @ojs87 !

I've given this a test locally and this does appear to resolve the issue when sending via the Workflow-Send Email action.

However, I see that the issue is still present when sending an Email via the regular Email->Compose action.


For example
Using the same Email Template and Quote selections on Email->Compose

Before Extending Quotes:
image

After Extending Quotes:
image

If possible, could you investigate and resolve this aspect too?
(If you feel this would need a longer investigation/fix, I would be happy to raise this as a separate Github issue so we can close and merge this fix. Please let me know if so)

Thanks!

@johnM2401 johnM2401 added Status:Requires Updates Issues & PRs which requires input or update from the author and removed Status: Requires Testing Requires Manual Testing labels May 3, 2024
@ojs87
Copy link
Contributor Author

ojs87 commented May 6, 2024

Hey @ojs87 !

I've given this a test locally and this does appear to resolve the issue when sending via the Workflow-Send Email action.

However, I see that the issue is still present when sending an Email via the regular Email->Compose action.

For example Using the same Email Template and Quote selections on Email->Compose

Before Extending Quotes: image

After Extending Quotes: image

If possible, could you investigate and resolve this aspect too? (If you feel this would need a longer investigation/fix, I would be happy to raise this as a separate Github issue so we can close and merge this fix. Please let me know if so)

Thanks!

Hi @johnM2401,

Thanks for testing that, I think this needs to be put on hold for now. This won't work for a Cases email template since the beanList value for cases is aCase and the table_name is case, so a little bit more thought is needed here.

Template parsing may need looked at so that the Compose view uses the same parser as the Workflow send Email action.

This is not ready to merge as it stands!

Thanks,
Owen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Branch:Hotfix PR 4-8 Score given to PRs once assessed Status:Assessed PRs that have been tested and confirmed to resolve an issue by a core team member Status: Passed Code Review Mark issue has passed code review reviewed Status:Requires Updates Issues & PRs which requires input or update from the author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants