diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 1431dc400fd..0ff920750f7 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1223,6 +1223,16 @@ class Cronjob extends CommonObject // Run a method if ($this->jobtype == 'method') { + // Deny to launch a method from a deactivated module + if (!empty($this->module_name) && !isModEnabled(strtolower($this->module_name))) { + $this->error = $langs->transnoentitiesnoconv('CronMethodNotAllowed', $this->methodename, $this->objectname); + dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); + $this->lastoutput = $this->error; + $this->lastresult = -1; + $retval = $this->lastresult; + $error++; + } + // load classes if (!$error) { $ret = dol_include_once($this->classesname);