Allow to add a comment when editing/creating/deleting an element.

This commit is contained in:
Jan Böhmer 2020-02-23 00:44:52 +01:00
parent c14d6d91ff
commit b6f95ebe48
19 changed files with 421 additions and 47 deletions

View file

@ -116,24 +116,38 @@ class LogEntryExtraFormatter
);
}
if ($context instanceof ElementCreatedLogEntry && $context->hasCreationInstockValue()) {
return sprintf(
'<i>%s</i>: %s',
$this->translator->trans('log.element_created.original_instock'),
$context->getCreationInstockValue()
);
if ($context instanceof ElementCreatedLogEntry ) {
$comment = '';
if ($context->hasComment()) {
$comment = htmlspecialchars($context->getComment()) . '; ';
}
if($context->hasCreationInstockValue()) {
return $comment . sprintf(
'<i>%s</i>: %s',
$this->translator->trans('log.element_created.original_instock'),
$context->getCreationInstockValue()
);
}
return $comment;
}
if ($context instanceof ElementDeletedLogEntry) {
return sprintf(
'<i>%s</i>: %s',
$this->translator->trans('log.element_deleted.old_name'),
$context->getOldName() ?? $this->translator->trans('log.element_deleted.old_name.unknown')
);
$comment = '';
if ($context->hasComment()) {
$comment = htmlspecialchars($context->getComment()) . '; ';
}
return $comment . sprintf(
'<i>%s</i>: %s',
$this->translator->trans('log.element_deleted.old_name'),
$context->getOldName() ?? $this->translator->trans('log.element_deleted.old_name.unknown')
);
}
if ($context instanceof ElementEditedLogEntry && ! empty($context->getMessage())) {
return htmlspecialchars($context->getMessage());
if ($context instanceof ElementEditedLogEntry) {
if ($context->hasComment()) {
return htmlspecialchars($context->getComment());
}
}
if ($context instanceof InstockChangedLogEntry) {