AnsweredAssumed Answered

How to override bean class in EmailTemplate?

Question asked by BuMa BuMa on Oct 29, 2014
Latest reply on Aug 23, 2016 by Jay Khatal
Hello all,
I am working on SugarCRM 7.

I have to add the campaign's information in email template.
So I need to override the EmailTemplate class in order to override some functions (like generateFieldDefsJS, parse_template_bean...)

1- I created the file : custom/modules/EmailTemplates/CustomEmailTemplate.php
With :


class CustomEmailTemplate extends EmailTemplate {
    public function CustomEmailTemplate()
        //die('YSANCE DEV1');

    public function __construct() {
        //die('YSANCE DEV2');
2- Then I created the file include/modules_override.php
With :

$beanList['EmailTemplates']     = 'CustomEmailTemplate';
$beanFiles['EmailTemplate']     = 'modules/EmailTemplates/CustomEmailTemplate.php';

Normally, now for each EmailTemplate class call  SugarCRM will call CustomEmailTemplate class. Unfortunately, it's not working...

When I do an BeanFactory::getBean('EmailTemplates') it return me null

After some research I noticed that in the BeanFactory class class_exists($beanClass)  return false.
So I think that the custom file CustomEmailTemplate.php is not added properly.

I am stuck...
Hope you will help me.

Thanks for your help !