override Lead.php functionality not work on /custom

Hi, there,
I modified the file Lead.php , precisely I made these changes to the method set_notification_body()

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);
        $xtpl->assign("LEAD_CAMPAIGN", $lead->campaign_id);

        return $xtpl;
    }

I added for testing:


 $xtpl->assign("LEAD_CAMPAIGN", $lead->campaign_id);

I saved the file Lead.php in /custom/modules/Leads but the changes are not taken.

Should I use the extension framework?

Thanks

I’m not sure, but it might work with something similar to this

https://suitecrm.com/suitecrm/forum/installation-upgrade-help/22389-how-to-override-email-module-file#79973

You would make a custom leads module that inherits everything from the other, and redefines that function.

If you get it working, please share here. Thanks

I tried to follow the example… but it didn’t work for me… I tried to look for other articles in the forum like these that were practically very similar to my problem

https://suitecrm.com/suitecrm/forum/suitecrm-7-0-discussion/6811-addind-new-field-into-notification-email-templates

https://suitecrm.com/suitecrm/forum/suitecrm-7-0-discussion/20425-change-default-task-notification

But they weren’t solved.

It seems that there is no clean upgrade-safe solution. (I don’t want to change the core code of the Lead module, I did it to test it and it works but it should be lost with updates)

I think the best solution to customize the assignment notifications is through WorkFlow, after disabling the default notifications from the system. B-)