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

Extended modules Email Template variables #10355

Open
ojs87 opened this issue Feb 6, 2024 · 2 comments
Open

Extended modules Email Template variables #10355

ojs87 opened this issue Feb 6, 2024 · 2 comments
Labels
Area: Emails Issues & PRs related to all things regarding emails & email module Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds Severity: Moderate Key function failed, but no or little impact Status:Fix Proposed A issue that has a PR related to it that provides a possible resolution Type: Bug Bugs within the core SuiteCRM codebase

Comments

@ojs87
Copy link
Contributor

ojs87 commented Feb 6, 2024

Issue

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.

Expected Behavior

Extended modules should still be able to use the basic variable options in the email template editor

Actual Behavior

The basic variables aren't parsed.

Possible Fix

use the $bean->table_name as a key for template_parser, rather than the name of the module in the $beanList global array.

Steps to Reproduce

  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

Your Environment

  • SuiteCRM Version used: 7.14.3
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)):
  • Environment name and version (e.g. MySQL, PHP 7): PHP 7.4
  • Operating System and version (e.g Ubuntu 16.04): Ubuntu 22.04.3 LTS
ojs87 added a commit to ojs87/SuiteCRM that referenced this issue Feb 6, 2024
@johnM2401
Copy link
Contributor

Hey @ojs87 !

Apologies if I'm wrong, but this looks like it might be a duplicate of: #10307

Which is resolved by: #10308
(Which was pulled into the latest release)

Is that right?

If not, I'm happy to investigate this ticket further
Thanks!

@johnM2401 johnM2401 added the Status:Requires Updates Issues & PRs which requires input or update from the author label Feb 12, 2024
@ojs87
Copy link
Contributor Author

ojs87 commented Feb 12, 2024

hey @johnM2401,

This looks like the same issue with using the beanList on an extended module but #10308 deals with building the smarty templates and this fix deals with parsing email templates so I don't think #10308 fixes this issue. Maybe the team would prefer to fix my issue in a similar way though.

Good catch though I didn't see that other PR when searching for dupes.

Cheers!

@johnM2401 johnM2401 removed the Status:Requires Updates Issues & PRs which requires input or update from the author label Feb 12, 2024
@johnM2401 johnM2401 added Type: Bug Bugs within the core SuiteCRM codebase Status:Fix Proposed A issue that has a PR related to it that provides a possible resolution Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds Area: Emails Issues & PRs related to all things regarding emails & email module Severity: Moderate Key function failed, but no or little impact labels Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Emails Issues & PRs related to all things regarding emails & email module Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds Severity: Moderate Key function failed, but no or little impact Status:Fix Proposed A issue that has a PR related to it that provides a possible resolution Type: Bug Bugs within the core SuiteCRM codebase
Projects
None yet
Development

No branches or pull requests

2 participants