Change the name of module in the email

Hi everyone,

I have change the name of the module Contract to Sales Order in my CRM via the Panel on the admin board. When I assign a user to a sale order, the user gets a notification via email but the name of the module is wrong (Should be Sales Order)

->Administrator has assigned a(n) Contracts to Username.
You may review this Contracts - > URL

I have copied the include\language\en_us.notify_template.html to custom\include\language\en_us.notify_template.html and i have done the change in the original folder too just to see if it was taking the right file. The change doesn’t seem to take effect even tought i did a quick repair and rebuild of the CRM.¸

Here’s what I found so far

1.
The function in include\utils.php is supose the get the new custom template but it is not doing anything (my language is en_us)

function get_notify_template_file($language)
{
    /*
     * Order of operation:
     * 1) custom version of specified language
     * 2) stock version of specified language
     * 3) custom version of en_us template
     * 4) stock en_us template
     */

    // set $file to the base code template so it's set if none of the conditions pass
    $file = 'include/language/en_us.notify_template.html';

    if (file_exists("custom/include/language/{$language}.notify_template.html")) {
        $file = "custom/include/language/{$language}.notify_template.html";
    } elseif (file_exists("include/language/{$language}.notify_template.html")) {
        $file = "include/language/{$language}.notify_template.html";
    } elseif (file_exists('custom/include/language/en_us.notify_template.html')) {
        $file = 'custom/include/language/en_us.notify_template.html';
    }

    return $file;
}

2

If I check all the other module, they all have the function “set_body_notification” like the one in Leads.php but contract dont have it.
The tag are putting the right value in the email but im not able to find where it is changing because it doesn’t have that specific function.
Should i put AOS_Contract.php in custom directory even tough i made no change to the file ?

 public function set_notification_body($xtpl, $lead)
    {
        global $app_list_strings;
        global $locale;

        $xtpl->assign("LEAD_NAME", $locale->getLocaleFormattedName($lead->first_name, $lead->last_name, $lead->salutation));
        $xtpl->assign("LEAD_SOURCE", (isset($lead->lead_source) ? $app_list_strings['lead_source_dom'][$lead->lead_source] : ""));
        $xtpl->assign("LEAD_STATUS", (isset($lead->status)? $app_list_strings['lead_status_dom'][$lead->status]:""));
        $xtpl->assign("LEAD_DESCRIPTION", $lead->description);

        return $xtpl;
    }

Does anyone know what I’m missing ?

Check the email templates. Some predefined templates have standard text on them. You might need to modify it from there.

yoursite.com/index.php?module=EmailTemplates&action=index&parentTab=All

Thanks,

AlxGr

Thank you but the assigned email template by default is not in this section. Those are email template for Case mostly. None of them is for Assigned Contract.

Word “Contract” is hard coded on file /include/language/en_us_template.html on lines 318 +

Try to change the original file to see if it changes.

Thanks,

AlxGr

Big thanks for your help! I already changed this part last week

the line 318 is

SuiteCRM Sales Orders - {CONTRACT_NAME}

{ASSIGNER} has assigned a Sale Order to {ASSIGNED_USER}.

and is still receive the email as

Administrator has assigned a(n) Contracts to Alex Béliveau.
You may review this Contracts

I Even did a custom directory in the custom file and it doesnt change the email.

Seems like theres is a cache or something. But even if i do a repair and rebuild nothing change

my custom file is in custom/include/language/en_us_template.html and it doest get the change. This is really weird

Thank you

I Found the problem but it is kind of weird. I used the contract module and renamed it into Sales Orders so i tought it was going into the contract template.

It is actually going to the default template at line 222

SuiteCRM - Assigned {OBJECT}

{ASSIGNER} has assigned a(n) {OBJECT} to {ASSIGNED_USER}.

I just don’t know how to make it that the Objet is sales Order Instead of contract

I need to fing where the {OBJECT} is replaced by the variable name

Seems like as soon as you make a modification in the Module, it goes in the default template

Found the solution but this is not a pretty one. Usually i would have to rename the AOS_contract module in the code but just for this purpose i hardcoded a value in the data\SugarBean.php at line 3335. Dont forget to put the sugarBean.php in a custom directory to be update proof

if(translate(‘LBL_MODULE_NAME’,$this->module_name)==“Contracts”)
{

             $xtpl->assign("OBJECT","Sales Orders");
       } else{
      
       
        $xtpl->assign("OBJECT", translate('LBL_MODULE_NAME', $this->module_name));
       }
1 Like

I am didn’t go and check, but if the set_notification_body isn’t defined in that class, and it goes to a default template, I’d say you should look for that function in the parent class (maybe SugarBean?). There must be a default method, some modules then override that. You probably need to extend the class yourself and add such an override.