You are not logged in.
Pages: 1
Hello, im working with tickets hooks and one of them is when the ticket is updated by a followup but i realice that the hook only is activated when is the first followup of the ticket because if i add another one the hook is not activated, someone knows why this happend or how to fix it or another way to do this?
//setup.php
function plugin_init_whatsappapi(){
global $PLUGIN_HOOKS,$CFG_GLPI;
$PLUGIN_HOOKS['csrf_compliant']['whatsappapi'] = true;
$PLUGIN_HOOKS['item_add']['whatsappapi'] = ['Ticket' => 'Whatsappapi_ticket_createitem_called'];
$PLUGIN_HOOKS['item_update']['whatsappapi'] = ['Ticket' => 'Whatsappapi_ticket_updateitem_called'];
}
//function from hook.php
function Whatsappapi_ticket_updateitem_called(CommonDBTM $item) {
global $DB;
$tipo = $item::getType();
if ($item::getType() === Ticket::getType()) {
$fields = $item->fields;
$users = $item->users[1][0];
$clienteId = $users['users_id'];
$Ticket_Id = $fields['id'];
/*
$result = $DB -> request(['FIELDS' => ['glpi_itilfollowups' => ['id','content']], 'FROM' => 'glpi_itilfollowups','WHERE' =>['itemtype' => ['Ticket'],['AND' => ['is_private'=>'0','items_id' => $Ticket_Id,'users_id' => $clienteId,'requesttypes_id' => '1']]],'ORDER BY' => 'date_creation DESC','LIMIT' => '1']);
foreach ($result as $mensajes) {
$followupId = $mensajes['id'];
$mensaje = $mensajes['content'];
}
*/
write($clienteId);
}
}
Offline
Why not listen to the creation of followups instead?
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Offline
what? that specific hook exist? , where i can find the documentation because in the documentation page i didnt found it,btw thanks u for let me know that
Offline
nvm i found how to do it thanks
Offline
Pages: 1