well im developing an custom module and i have a trigger there, when i develope the module i was doing that in localhost but today when i add the module to a hosting version of dolibarr the trigger of my module dosent work if i go to (admin settings->about dolibarr → triggers) doesnt show nothing but if i desactivate the module and go back to that page now i can se the triggers, if i go to module builder and select my custom module i can see all the files exept for the triggers that page dont shome noting idk if is mi code or what.
code:
require_once DOL_DOCUMENT_ROOT.'/custom/conectiontoglpi/data/config.php';
require_once DOL_DOCUMENT_ROOT.'/custom/conectiontoglpi/data/funcapi.php';
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
if (!isModEnabled('societe')) {
return 0; // If module is not enabled, we do nothing
}
$methodName = lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($action)))));
$callback = array($this, $methodName);
if (is_callable($callback)) {
dol_syslog(
"Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
);
return call_user_func($callback, $action, $object, $user, $langs, $conf);
}
switch ($action)
{
//Companys
case 'COMPANY_CREATE':
$this->createCompanyGLPI($object);
break;
case 'COMPANY_MODIFY':
$this->modifyCompanyGLPI($object);
break;
case 'COMPANY_DELETE':
$this->deleteCompanyGLPI($object);
break;
// Contacts
case 'CONTACT_CREATE':
$this->createContactGLPI($object);
break;
case 'CONTACT_MODIFY':
$this->modifyContactGLPI($object);
break;
case 'CONTACT_DELETE':
$this->deleteContactGLPI($object);
break;
default:
dol_syslog("Trigger '".$this->name."' for action '".$action."' launched by ".__FILE__.". id=".$object->id);
break;
}
return 0;
}
function createCompanyGLPI($object)
{
$sessionToken = sesionid();
$thirdparty_clientecode = $object->code_client;
$thirdparty_name = $object->nom;
$thirdparty_alias = $object->name_alias;
$thirdparty_phone = $object->phone;
$thirdparty_address = $object->address;
$thirdparty_country = $object->country;
$thirdparty_state = $object->state_id;
$thirdparty_town = $object->town;
$thirdparty_zip = $object->zip;
$thirdparty_email = $object->email;
$thirdparty_rfc = $object->idprof1;
CreateLocation($thirdparty_name,$thirdparty_clientecode,$thirdparty_address,$thirdparty_zip,$thirdparty_state,$thirdparty_country,$thirdparty_email,$thirdparty_town,$thirdparty_phone,$thirdparty_rfc,$sessionToken);
// Lógica adicional para crear la compañía en GLPI
dol_syslog("Create company in GLPI. id=" . $object->id);
}
after the runTrigger function I have the functions that are called depending on the action, when I create a new module and paste the switch code works fine but when I paste the extra functions after the runTrigger function no longer works I want to know if I am placing the functions where they do not go or why I get this error because in localhost loads everything and works correctly.