Redmine/setup.php
Gemini 80d1576a80 Redmine Integration 1.3.0
Plugin de integração GLPI <-> Redmine:
- Config nativa (Twig) com API key cifrada (GLPIKey)
- Vínculo projeto GLPI <-> projeto Redmine (aba do projeto) + categoria por vínculo
- 1 issue Redmine por chamado; defaults (tracker/priority/activity) e mapa de status
- Tempo das TicketTasks -> time entries (gate em "Feito"), idempotente
- Autores via impersonation (X-Redmine-Switch-User) + auto-membership por role
- Mapeamento de usuários GLPI->Redmine (auto-match por e-mail + overrides)

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

82 lines
1.9 KiB
PHP

<?php
define('PLUGIN_REDMINE_VERSION', '1.3.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']
]);
// 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;
}