$objectList['Leads'] = 'Lead';
// $beanList maps the Bean/Module name to the Class name
$beanList['Leads'] = 'CustomLead';
// $beanFiles maps the Class name to the PHP Class file
$beanFiles['CustomLead'] = 'custom/modules/Leads/CustomLead.php';
and in the âcustom/modules/leads/CustomClass.phpâ
i have this code
require_once 'modules/Leads/Lead.php';
class CustomLead extends Lead
{
/**
* Saves the record
* - You can use this method to implement before save or after save logic
*
* @param bool $check_notify
* @return string
*/
function save($check_notify = FALSE)
{
$GLOBALS['log']->fatal('---------Here----------');
$value = parent::save($check_notify);
return $value;
}
}
When i run the mass update it runs this code perfectly but when i save a single record there is error of not registering the custom class.
Thanks for the reply actually it was method written on the official sugarcrm website. Anyhow making a controller and overriding the save function will it override all the functionality available in Lead.PHP ??
I donât think itâs needed for this case. Overriding one of the Controllerâs actions is pretty standard, itâs upgrade-safe, itâs object-oriented, itâs elegant.
You only need to define what you want to change, and you can call the code from parent easily.
Secondly if i override can i change the notify bit as my main concern is changing the check_notify on some logic. how to achieve this using the overriding the controller.
i donât think that is the correct technique to apply here.
The link I gave above has a specific section for âpre-existing modulesâ, try that one.
The only doubt I have about recommending this is that the leads module uses the legacy controller system, where a file called Leads/Save.php executes the Save action. The newer controller system would use a action_save method in the controller class.
I am sure you can customize the newer controller system, I am not so sure what happens with the old one⌠the only way to find out is to try.