How to Turn Off/Disable Alerts Module

So we’re not using the alerts module yet and meanwhile, my server access logs are getting called every second for “GET /index.php?module=Alerts&action=get&to_pdf=1 HTTP/1.1”.
It’s really cluttering my otherwise neat and useful access log, with no results or benifits to my end users. :slight_smile:
I would love to be able to disable the Alerts module for now. It’s easy enough to set a display:none style on the widget in the task bar, but I’m not sure how to properly go about turning off the second by second requests to the server.

Thanks!
Daniel

Hi,

There’s no out of the box way to disable the check unfortunately (though I have added a feature request for this: https://github.com/salesagility/SuiteCRM/issues/546).

You could change the code that is doing this call by editing include/javascript/alerts.js and modules/Alerts/alerts.js. Bear in mind changing these files is not upgrade safe so if you upgrade you’ll lose the changes and need to make them again (at least until the above feature is implemented).

As always you’ll want to take a backup before changing any files.

Thanks,
Jim

Thanks! I commended out everything after the first function Alerts(); and nothing immediately changed, but I suspect that the users will have to refresh/close the tabs they’ve had open, so the new javascript will be loaded.

I’ll let you know the final result, in a week, if the constant access stops. :slight_smile:

Hi @Jim, could you explain why the edit needs to made twice? And generally, how the Javascript deployment works in SuiteCRM with regard to source, compressed, minified and grouped files?

I can;t find a thread that covers this - and your excellent book SuiteCRM for Developers http://leanpub.com/suitecrmfordevelopers doesn’t either. Maybe a topic for the second edition?

Cheers

Hi Jim,

The file modules/Alerts/alerts.js does not exist (anymore). Which file should be updated instead?

I tried changing include/javascript/alerts.js but updating this file alone does not disable the alerts.

Thanks,
Roland

To disable Alerts, you can comment out the code in include/MVC/View/SugarView.php line 177

			
$jsAlerts = new jsAlerts();
echo $jsAlerts->getScript();

and in include/SubPanel/SubPanelViewer.php line 100


echo $jsAlerts->getScript();

or, what I have done is made it dependent on a config variable disable_alerts in config_override (MUST be false if set)


if ( !isset($_SESSION['isMobile']) && 
     (!isset($GLOBALS['sugar_config']['disable_alerts']) || !$GLOBALS['sugar_config']['disable_alerts']) &&
     ($this instanceof ViewList || $this instanceof ViewDetail || $this instanceof ViewEdit)
) {
	$jsAlerts = new jsAlerts();
	echo $jsAlerts->getScript();
}

and


if (!isset($_SESSION['isMobile']) &&
   (!isset($GLOBALS['sugar_config']['disable_alerts']) || !$GLOBALS['sugar_config']['disable_alerts'])) {
    echo $jsAlerts->getScript();
}
3 Likes

Thanks for these instructions! For other’s information, FastComet adaptive firewalls are now tagging the frequent alerts as a malicious/suspicious behavior, and I was unable to access from a specific IP for a time as a result. I have informed the FastComet techs of the false positive.

The solution above didn’t work for me, so I tried something different:

I added a

return;

right after this line:

so that the function returns immediately before setting any timers.

Requires a Admin / Repairs / Repair JS Files and a hard refresh in the browser to take effect.

1 Like

The issue of alerts is causing me problems or could someone tell me why when saving a record of a CRM suite module it keeps loading for a long time? and checking the network inspector of the browser, the following path appears in pending index.php? module = Alerts&action=get&to_pdf=1. If someone could help me.

This reminds me of an old bug. Which version are you running?