From 28bb3630b4ff073f04f99e3272a1d7a78bec4757 Mon Sep 17 00:00:00 2001 From: Aina Sitraka <35221835+aynsix@users.noreply.github.com> Date: Mon, 25 Mar 2024 21:23:06 +0300 Subject: [PATCH] PHRAS-4033 fix timeline history for writemetadata and subdefinition (#4491) * fix timeline historic for writemetadata and subdefinition * fix alter table in log_docs --- lib/classes/Session/Logger.php | 3 ++- lib/conf.d/bases_structure.xml | 2 +- .../web/prod/preview/short_history.html.twig | 24 +++++++++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/lib/classes/Session/Logger.php b/lib/classes/Session/Logger.php index 8900742cca..a8aa3eea40 100644 --- a/lib/classes/Session/Logger.php +++ b/lib/classes/Session/Logger.php @@ -295,7 +295,8 @@ public function initOrUpdateLogDocsFromWorker(\record_adapter $record, \databox $comment = json_encode([ 'finished' => empty($finished) ? '' : $finished->format('Y-m-d H:i:s'), 'duration' => empty($finished) ? '' : $finished->getTimestamp() - $workerRunningJob->getCreated()->getTimestamp() , - 'status' => $status + 'status' => $status, + 'subdefName' => $subdefName ]); if ($count > 0) { diff --git a/lib/conf.d/bases_structure.xml b/lib/conf.d/bases_structure.xml index ed0459fa6b..20e867ec4b 100644 --- a/lib/conf.d/bases_structure.xml +++ b/lib/conf.d/bases_structure.xml @@ -2580,7 +2580,7 @@ action - enum('push','add','validate','edit','collection','status','print','substit','publish','download','mail','ftp','delete', 'subdefCreation', 'writeMetadatas', '') + enum('push','add','validate','edit','collection','status','print','substit','publish','download','mail','ftp','delete','subdefCreation','writeMetadatas','') diff --git a/templates/web/prod/preview/short_history.html.twig b/templates/web/prod/preview/short_history.html.twig index 469c0dbf47..1c2b7738e5 100644 --- a/templates/web/prod/preview/short_history.html.twig +++ b/templates/web/prod/preview/short_history.html.twig @@ -43,11 +43,27 @@ {% set content = done['final']|join(', ') %} {% trans with {'%dest%' : dest, '%content%' : content} %}Envoi par ftp a %dest% de %content%{% endtrans %} {% elseif action == 'subdefCreation' %} - {% set comment = done['comment'] | join(', ') | json_to_array %} - {% trans with {'%subdefName%' : done['final'] | join(', '), '%started%' : hour, '%duration%' : (comment.duration == '') ? '-' : comment.duration | date_duration , '%status%' : comment.status} %}create subdefinition: %subdefName% start at %started% during %duration% -- status %status%{% endtrans %} + {% for k, comment in done['comment'] %} + {% set comment = comment | json_to_array %} + {% set subdefName = comment.subdefName is defined ? comment.subdefName : done['final'][k] %} + + {% trans with {'%subdefName%' : subdefName, '%started%' : hour, '%duration%' : (comment.duration == '') ? '-' : comment.duration | date_duration , '%status%' : comment.status} %}create subdefinition: %subdefName% start at %started% during %duration% -- status %status%{% endtrans %} + {% if done['final']|length > 1 %} + {# separate with line break #} +

+ {% endif %} + {% endfor %} {% elseif action == 'writeMetadatas' %} - {% set comment = done['comment'] | join(', ') | json_to_array %} - {% trans with {'%subdefName%' : done['final'] | join(', '), '%started%' : hour, '%duration%' : (comment.duration == '') ? '-' : comment.duration | date_duration , '%status%' : comment.status} %}write metadatas: %subdefName% start at %started% during %duration% -- status %status%{% endtrans %} + {% for k, comment in done['comment'] %} + {% set comment = comment | json_to_array %} + {% set subdefName = comment.subdefName is defined ? comment.subdefName : done['final'][k] %} + + {% trans with {'%subdefName%' : subdefName, '%started%' : hour, '%duration%' : (comment.duration == '') ? '-' : comment.duration | date_duration , '%status%' : comment.status} %}write metadatas: %subdefName% start at %started% during %duration% -- status %status%{% endtrans %} + {% endfor %} + {% if done['final']|length > 1 %} + {# separate with line break #} +

+ {% endif %} {% elseif action == 'delete' %} {{ 'report::supression du document' | trans }} {% elseif action == 'add' %}