mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-05 07:54:35 +02:00
Allow to add a comment when editing/creating/deleting an element.
This commit is contained in:
parent
c14d6d91ff
commit
b6f95ebe48
19 changed files with 421 additions and 47 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue