diff --git a/src/DataTables/LogDataTable.php b/src/DataTables/LogDataTable.php
index 35e24f0d..6eef58e3 100644
--- a/src/DataTables/LogDataTable.php
+++ b/src/DataTables/LogDataTable.php
@@ -37,6 +37,7 @@ use App\Entity\LogSystem\CollectionElementDeleted;
use App\Entity\LogSystem\ElementCreatedLogEntry;
use App\Entity\LogSystem\ElementDeletedLogEntry;
use App\Entity\LogSystem\ElementEditedLogEntry;
+use App\Entity\LogSystem\PartStockChangedLogEntry;
use App\Entity\UserSystem\Group;
use App\Entity\UserSystem\User;
use App\Exceptions\EntityNotSupportedException;
@@ -190,7 +191,16 @@ class LogDataTable implements DataTableTypeInterface
'label' => $this->translator->trans('log.type'),
'propertyPath' => 'type',
'render' => function (string $value, AbstractLogEntry $context) {
- return $this->translator->trans('log.type.'.$value);
+ $text = $this->translator->trans('log.type.'.$value);
+
+ if ($context instanceof PartStockChangedLogEntry) {
+ $text .= sprintf(
+ ' (%s)',
+ $this->translator->trans('log.part_stock_changed.' . $context->getInstockChangeType())
+ );
+ }
+
+ return $text;
},
]);
diff --git a/src/Services/LogSystem/LogEntryExtraFormatter.php b/src/Services/LogSystem/LogEntryExtraFormatter.php
index e8508707..e9bcf591 100644
--- a/src/Services/LogSystem/LogEntryExtraFormatter.php
+++ b/src/Services/LogSystem/LogEntryExtraFormatter.php
@@ -32,10 +32,12 @@ use App\Entity\LogSystem\ElementDeletedLogEntry;
use App\Entity\LogSystem\ElementEditedLogEntry;
use App\Entity\LogSystem\ExceptionLogEntry;
use App\Entity\LogSystem\LegacyInstockChangedLogEntry;
+use App\Entity\LogSystem\PartStockChangedLogEntry;
use App\Entity\LogSystem\SecurityEventLogEntry;
use App\Entity\LogSystem\UserLoginLogEntry;
use App\Entity\LogSystem\UserLogoutLogEntry;
use App\Entity\LogSystem\UserNotAllowedLogEntry;
+use App\Entity\Parts\PartLot;
use App\Services\ElementTypeNameGenerator;
use Symfony\Contracts\Translation\TranslatorInterface;
@@ -179,6 +181,23 @@ class LogEntryExtraFormatter
$array[] = htmlspecialchars($context->getMessage());
}
+ if ($context instanceof PartStockChangedLogEntry) {
+ $array['log.part_stock_changed.change'] = sprintf("%s %s %s (%s)",
+ $context->getOldStock(),
+ '',
+ $context->getNewStock(),
+ ($context->getNewStock() > $context->getOldStock() ? '+' : '-'). $context->getChangeAmount(),
+ );
+ if (!empty($context->getComment())) {
+ $array['log.part_stock_changed.comment'] = htmlspecialchars($context->getComment());
+ }
+ if ($context->getInstockChangeType() === PartStockChangedLogEntry::TYPE_MOVE) {
+ $array['log.part_stock_changed.move_target'] =
+ $this->elementTypeNameGenerator->getLocalizedTypeLabel(PartLot::class)
+ .' ' . $context->getMoveToTargetID();
+ }
+ }
+
return $array;
}
}
diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf
index 072af113..a601b8a1 100644
--- a/translations/messages.en.xlf
+++ b/translations/messages.en.xlf
@@ -10223,5 +10223,47 @@ Element 3
The permission schema of your user were upgraded to the latest version.
+
+
+ log.type.part_stock_changed
+ Part Stock changed
+
+
+
+
+ log.part_stock_changed.withdraw
+ Stock withdrawn
+
+
+
+
+ log.part_stock_changed.add
+ Stock added
+
+
+
+
+ log.part_stock_changed.move
+ Stock moved
+
+
+
+
+ log.part_stock_changed.comment
+ Comment
+
+
+
+
+ log.part_stock_changed.change
+ Change
+
+
+
+
+ log.part_stock_changed.move_target
+ Move target
+
+