fix: lançamento de tempo com comentário-fallback (campo obrigatório no Redmine) (1.5.4)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Gemini 2026-06-30 16:10:38 -03:00
parent 6f844e7336
commit 4214bf4814
3 changed files with 19 additions and 2 deletions

View file

@ -4,6 +4,17 @@ Todas as mudanças relevantes deste plugin são documentadas aqui.
O formato segue [Keep a Changelog](https://keepachangelog.com/pt-BR/1.0.0/)
e o versionamento segue [SemVer](https://semver.org/lang/pt-BR/).
## [1.5.4]
### Corrigido
- Lançamento de tempo: o campo **comentário** é obrigatório em algumas configs do
Redmine. Se a tarefa do GLPI não tiver descrição, o plugin agora envia um
comentário padrão ("Tempo lançado via GLPI (chamado #N)") em vez de vazio.
### Notas
- A **Atividade** do lançamento de tempo é **por projeto** no Redmine: a atividade
configurada como padrão precisa estar habilitada no projeto vinculado.
## [1.5.3]
### Corrigido

View file

@ -416,6 +416,12 @@ function _plugin_redmine_process_tickettask(TicketTask $task) {
$cfg = PluginRedmineConfig::getConfigRow();
$hours = round($task->fields['actiontime'] / HOUR_TIMESTAMP, 2);
// Comments are mandatory on time entries in some Redmine setups — never send empty.
$comments = trim(strip_tags(html_entity_decode((string) ($task->fields['content'] ?? ''))));
if ($comments === '') {
$comments = "Tempo lançado via GLPI (chamado #{$ticketId})";
}
// Time entry author = the GLPI user who logged the task, via impersonation.
$taskUserId = (int) ($task->fields['users_id'] ?? 0);
$timeSwitchUser = _plugin_redmine_impersonation_login($taskUserId, $redmineProjectId);
@ -423,7 +429,7 @@ function _plugin_redmine_process_tickettask(TicketTask $task) {
$timeEntryId = PluginRedmineRedmineapi::logTime(
$issueId,
$hours,
strip_tags(html_entity_decode($task->fields['content'])),
$comments,
!empty($cfg['default_activity_id']) ? (int) $cfg['default_activity_id'] : null,
$timeSwitchUser
);

View file

@ -1,6 +1,6 @@
<?php
define('PLUGIN_REDMINE_VERSION', '1.5.3');
define('PLUGIN_REDMINE_VERSION', '1.5.4');
/**
* Load the Mindplace License class if the autoloader has not run yet.