From 5a3fc0fb43602f8912bf54c255914cbf4186c5d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Mon, 15 May 2023 22:42:08 +0200 Subject: [PATCH] Show and link which log entry was undone/reverted on log detail page --- src/Services/LogSystem/LogEntryExtraFormatter.php | 4 ++-- templates/log_system/details/log_details.html.twig | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Services/LogSystem/LogEntryExtraFormatter.php b/src/Services/LogSystem/LogEntryExtraFormatter.php index 2950842b..8ec328d0 100644 --- a/src/Services/LogSystem/LogEntryExtraFormatter.php +++ b/src/Services/LogSystem/LogEntryExtraFormatter.php @@ -131,9 +131,9 @@ class LogEntryExtraFormatter if (($context instanceof LogWithEventUndoInterface) && $context->isUndoEvent()) { if ('undo' === $context->getUndoMode()) { - $array['log.undo_mode.undo'] = (string) $context->getUndoEventID(); + $array['log.undo_mode.undo'] = '#' . $context->getUndoEventID(); } elseif ('revert' === $context->getUndoMode()) { - $array['log.undo_mode.revert'] = (string) $context->getUndoEventID(); + $array['log.undo_mode.revert'] = '#' . $context->getUndoEventID(); } } diff --git a/templates/log_system/details/log_details.html.twig b/templates/log_system/details/log_details.html.twig index 422548a0..dbffd8c9 100644 --- a/templates/log_system/details/log_details.html.twig +++ b/templates/log_system/details/log_details.html.twig @@ -28,6 +28,10 @@ {% if log_entry.type == 'part_stock_changed' %} ({{ ('log.part_stock_changed.' ~ log_entry.instockChangeType)|trans }}) {% endif %} + + {% if log_entry is instanceof('App\\Entity\\Contracts\\LogWithEventUndoInterface') and log_entry.undoEvent %} + ({{ ('log.undo_mode.' ~ log_entry.undoMode)|trans }}: #{{ log_entry.UndoEventID }}) + {% endif %}