You are not logged in.
I tried adding my plugin type to the 'ticket_types' array through the following code:
$CFG_GLPI["ticket_types"] += [
PluginAssetlistAssetlist::class
];
Still, my class isn't showing in the item dropdown when creating a ticket.
Last edited by scarletTornado (2024-04-29 17:49:58)
Offline
Did you add this type to the list of itemtypes allowed to be associated with tickets? There is a per-profile option for this on the Assistance tab of the profile form.
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
I changed the code declaration to the following so the class could be detected. But still it is not appearing in the dropdown. I also declared it in the ticket types on the Assistant tab from the profile page.
$CFG_GLPI["ticket_types"][] = PluginAssetlistAssetlist::class;
Last edited by scarletTornado (2024-04-26 08:50:49)
Offline
Still trying to find out the problem. I'll leave clear what's happening:
1. I defined all my classes in the "inc" folder. Each one has her name preceded by "PluginAssetlist".
2. The only class I want to associate to a ticket has been inserted in the "ticket_types" array through the following code.
$CFG_GLPI["ticket_types"][] = PluginAssetlistAssetlist::class;
3. After that I moved to the "Assistance" tab of one available user profile and added my class to it. It appeared with the name "Assetlists" (getTypeName() method invoked). I saved the changes and moved to the "/front/ticket.form.php" file. In the dropdown of items which can be associated to the ticket doesn't appear my class though.
Note: I just discovered that I can associate the object to the ticket if I create the ticket directly from the "Ticket" tab of my plugin object.
Last edited by scarletTornado (2024-04-29 13:48:19)
Offline
Nevermind, I found out there's a hook called "assign_to_ticket". Basically, in your setup php you have to declare your plugin in the "assign_to_ticket" array with your plugin name as the key.
$PLUGIN_HOOKS['assign_to_ticket']['assetlist'] = ""; // Value isn't used
Later in your hook.php you declare a function like the following which returns an array with the different classes as keys and their representation in the dropdown as the values so they can be shown.
function plugin_assetlist_AssignToTicket() {
return [
PluginAssetlistAssetlist::class => PluginAssetlistAssetlist::getTypeName()
];
}
Offline