40 public $errors = array();
49 public $TRIGGER_PREFIX =
'';
63 public function call_trigger($triggerName, $user)
68 if (!empty($this->TRIGGER_PREFIX) && strpos($triggerName, $this->TRIGGER_PREFIX .
'_') !== 0) {
69 if (!preg_match(
'/^OBJECT_LINK/', $triggerName) && !preg_match(
'/^PAYMENTONLINE_/', $triggerName)) {
70 dol_syslog(
'The trigger "' . $triggerName .
'" does not start with "' . $this->TRIGGER_PREFIX .
'_" as required.', LOG_ERR);
75 if (!is_object($langs)) {
77 include_once DOL_DOCUMENT_ROOT.
'/core/class/translate.class.php';
79 $langs->setDefaultLang(
'');
83 include_once DOL_DOCUMENT_ROOT.
'/core/class/interfaces.class.php';
85 $result = $interface->run_triggers($triggerName, $this, $user, $langs,
$conf);
88 if (!empty($this->errors)) {
89 $this->errors = array_unique(array_merge($this->errors, $interface->errors));
91 $this->errors = $interface->errors;
Class to manage triggers.
Class to manage translations.
getCallerInfoString()
Get caller info as a string that can be appended to a log message.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.