diff --git a/CHANGELOG.md b/CHANGELOG.md index 6560193..513124b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/hook.php b/hook.php index b3c0dca..273789f 100644 --- a/hook.php +++ b/hook.php @@ -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 ); diff --git a/setup.php b/setup.php index f2e775f..91bdb19 100644 --- a/setup.php +++ b/setup.php @@ -1,6 +1,6 @@