Ajouter le fichier hook.php et corriger l'installation

This commit is contained in:
tips-of-mine
2025-05-31 11:05:58 +02:00
committed by GitHub
parent c428a4271b
commit 2f73a61861
3 changed files with 154 additions and 3 deletions

74
hook.php Normal file
View File

@ -0,0 +1,74 @@
<?php
/**
* Hook functions for the SOC plugin
*/
/**
* Hook called after a new item has been added
*
* @param CommonDBTM $item
* @return void
*/
function plugin_soc_item_add(CommonDBTM $item) {
// Add actions when a new item is created
}
/**
* Hook called after an item has been updated
*
* @param CommonDBTM $item
* @return void
*/
function plugin_soc_item_update(CommonDBTM $item) {
// Add actions when an item is updated
}
/**
* Hook called after an item has been deleted
*
* @param CommonDBTM $item
* @return void
*/
function plugin_soc_item_delete(CommonDBTM $item) {
// Add actions when an item is deleted
}
/**
* Hook called after an item has been purged
*
* @param CommonDBTM $item
* @return void
*/
function plugin_soc_item_purge(CommonDBTM $item) {
// Add actions when an item is purged
}
/**
* Hook called when displaying the tabs for an item
*
* @param array $params
* @return array
*/
function plugin_soc_getAddSearchOptions($itemtype) {
$options = [];
// Add search options for supported item types
if ($itemtype == 'Ticket' || $itemtype == 'Change') {
$options[9000] = [
'table' => 'glpi_plugin_soc_cases',
'field' => 'name',
'name' => __('SOC Case', 'soc'),
'joinparams' => [
'beforejoin' => [
'table' => $itemtype == 'Ticket' ? 'glpi_plugin_soc_case_tickets' : 'glpi_plugin_soc_case_changes',
'joinparams' => [
'jointype' => 'itemtype_item',
'specific_itemtype' => $itemtype
]
]
]
];
}
return $options;
}