/** * Overloading the doActions function : replacing the parent's function with the one below * * @param array() $parameters Hook metadatas (context, etc...) * @param CommonObject &$object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) * @param string &$action Current action (if set). Generally create or edit or null * @param HookManager $hookmanager Hook manager propagated to allow calling another hook * @return int < 0 on error, 0 on success, 1 to replace standard code */ function doActions($parameters, &$object, &$action, $hookmanager) { //var_dump($parameters, $action); if (!empty($parameters['currentcontext'])) { $currentcontext = $parameters['currentcontext']; } else { $currentcontext = $parameters['context']; } // Retrocompatibility <= 3.6 $routeAction = $currentcontext . ':' . $action; define('INC_FROM_DOLIBARR', true); dol_include_once('/routing/config.php'); TRouting::route($routeAction, $object); }
/** * Function called when a Dolibarrr business event is done. * All functions "run_trigger" are triggered if file * is inside directory core/triggers * * @param string $action Event action code * @param Object $object Object * @param User $user Object user * @param Translate $langs Object langs * @param conf $conf Object conf * @return int <0 if KO, 0 if no triggered ran, >0 if OK */ public function run_trigger($action, $object, $user, $langs, $conf) { define('INC_FROM_DOLIBARR', true); dol_include_once('/routing/config.php'); if (class_exists('TRouting')) { TRouting::route($action, $object); } return 0; }