FIX add notification hook to allow external module trigger (#25506)
This commit is contained in:
parent
e2915d2979
commit
cdc8bc1b6f
1 changed files with 15 additions and 1 deletions
|
|
@ -66,10 +66,25 @@ class InterfaceNotification extends DolibarrTriggers
|
|||
*/
|
||||
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
if (empty($conf->notification) || !isModEnabled('notification')) {
|
||||
return 0; // Module not active, we do nothing
|
||||
}
|
||||
|
||||
if (!is_object($hookmanager)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager = new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('notification'));
|
||||
|
||||
$reshook = $hookmanager->executeHooks('notifsupported', $parameters, $object, $action);
|
||||
if (empty($reshook)) {
|
||||
if (!empty($hookmanager->resArray['arrayofnotifsupported'])) {
|
||||
$this->listofmanagedevents = array_merge($this->listofmanagedevents, $hookmanager->resArray['arrayofnotifsupported']);
|
||||
}
|
||||
}
|
||||
|
||||
// If the trigger code is not managed by the Notification module
|
||||
if (!in_array($action, $this->listofmanagedevents)) {
|
||||
return 0;
|
||||
|
|
@ -83,7 +98,6 @@ class InterfaceNotification extends DolibarrTriggers
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return list of events managed by notification module
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue