Redmine/setup.php
Gemini 92d1ac044a feat: vínculo Entidade -> Projeto Redmine (clientes de suporte recorrente)
- nova aba Redmine em Administração > Entidades (PluginRedmineEntity)
- tabela glpi_plugin_redmine_entities (1:1 entidade -> projeto Redmine, + categoria)
- hook resolve o projeto Redmine por: projeto vinculado OU, na ausência,
  a entidade do chamado (match exato, sem herança de árvore)
- twigs do tab generalizados (owner_field/owner_id) p/ reuso projeto+entidade

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 22:00:36 -03:00

85 lines
2 KiB
PHP

<?php
define('PLUGIN_REDMINE_VERSION', '1.4.0');
/**
* Init hooks of the plugin.
*/
function plugin_init_redmine() {
global $PLUGIN_HOOKS;
$PLUGIN_HOOKS['csrf_compliant']['redmine'] = true;
// Register classes
Plugin::registerClass('PluginRedmineConfig', [
'addtabon' => ['Config']
]);
Plugin::registerClass('PluginRedmineProject', [
'addtabon' => ['Project']
]);
Plugin::registerClass('PluginRedmineEntity', [
'addtabon' => ['Entity']
]);
// Set configuration page
$PLUGIN_HOOKS['config_page']['redmine'] = 'front/config.form.php';
// Hook to intercept item creation
$PLUGIN_HOOKS['item_add']['redmine'] = [
'TicketTask' => 'plugin_redmine_tickettask_add'
];
// Hook to intercept item updates
$PLUGIN_HOOKS['item_update']['redmine'] = [
'TicketTask' => 'plugin_redmine_tickettask_update',
'Ticket' => 'plugin_redmine_ticket_update'
];
}
/**
* Get the name and the version of the plugin
*
* @return array
*/
function plugin_version_redmine() {
return [
'name' => 'Redmine Integration',
'version' => PLUGIN_REDMINE_VERSION,
'author' => 'Mindtek',
'license' => 'GPLv3+',
'homepage' => '',
'requirements' => [
'glpi' => [
'min' => '11.0.0',
'max' => '11.99.99'
]
]
];
}
/**
* Check pre-requisites before install
*
* @return boolean
*/
function plugin_redmine_check_prerequisites() {
if (version_compare(GLPI_VERSION, '11.0.0', 'lt')) {
echo "This plugin requires GLPI >= 11.0.0";
return false;
}
return true;
}
/**
* Check configuration process
*
* @param boolean $verbose Whether to display messages.
*
* @return boolean
*/
function plugin_redmine_check_config($verbose = false) {
if ($verbose) {
echo "Installed / not configured";
}
return true;
}