N°4446 - Attachments: deleted file re-appear

This commit is contained in:
acognet
2022-01-28 10:33:41 +01:00
parent b9ea7d4913
commit f0933eaf1e

View File

@@ -206,7 +206,7 @@ abstract class AbstractAttachmentsRenderer
function RefreshAttachmentsDisplay(dataUpload)
{
var sContentNode = '#AttachmentsListContainer',
aAttachmentsDeletedHiddenInputs = $('table.attachmentsList>tbody>tr[id^="display_attachment_"]>td input[name="removed_attachments[]"]'),
aAttachmentsDeletedHiddenInputs = $('#AttachmentsListContainer table>tbody>tr[id^="display_attachment_"]>td input[name="removed_attachments[]"]'),
aAttachmentsDeletedIds = aAttachmentsDeletedHiddenInputs.map(function() { return $(this).val() }).toArray();
$(sContentNode).block();
$.post(GetAbsoluteUrlModulesRoot()+'itop-attachments/ajax.itop-attachment.php',
@@ -416,7 +416,6 @@ class TableDetailsAttachmentsRenderer extends AbstractAttachmentsRenderer
$sFileDate = Dict::S('Attachments:File:Date');
$sFileUploader = Dict::S('Attachments:File:Uploader');
$sFileType = Dict::S('Attachments:File:MimeType');
$sDeleteColumn = '';
if ($bWithDeleteButton)
{
@@ -488,17 +487,9 @@ JS
{
$iAttachmentId = $oAttachment->GetKey();
$sLineClass = '';
if ($bIsEven)
{
$sLineClass = 'class="even"';
}
$sLineStyle = '';
$bIsDeletedAttachment = false;
if (in_array($iAttachmentId, $aAttachmentsDeleted, true))
{
$sLineStyle = 'style="display: none;"';
$bIsDeletedAttachment = true;
}
@@ -513,7 +504,6 @@ JS
$sFileFormattedSize = $oDoc->GetFormattedSize();
$bIsTempAttachment = ($oAttachment->Get('item_id') === 0);
$sAttachmentDateFormatted = '';
$iAttachmentDateRaw = '';
if (!$bIsTempAttachment)
{
$sAttachmentDate = $oAttachment->Get('creation_date');
@@ -523,7 +513,6 @@ JS
}
$oAttachmentDate = DateTime::createFromFormat(AttributeDateTime::GetInternalFormat(), $sAttachmentDate);
$sAttachmentDateFormatted = AttributeDateTime::GetFormat()->Format($oAttachmentDate);
$iAttachmentDateRaw = AttributeDateTime::GetAsUnixSeconds($sAttachmentDate);
}
$sAttachmentUploader = $oAttachment->Get('contact_id_friendlyname');
@@ -560,7 +549,11 @@ JS
'type' => $sFileType,
'js' => '',
);
if ($bIsDeletedAttachment) {
$aAttachmentLine['@class'] = 'ibo-is-hidden';
}
if ($bWithDeleteButton)
{
$sDeleteButton = $this->GetDeleteAttachmentButton($iAttachmentId);