From 82681faa5341d533170a8253c91b486b396429e3 Mon Sep 17 00:00:00 2001 From: Quentin RIBAC <quentin.ribac@xelians.fr> Date: Fri, 17 Dec 2021 16:43:32 +0100 Subject: [PATCH] FEAT #16988 TIME 0:30 folderPrint: unified mass and unitary; fixed empty filename if main doc not included --- .../controllers/FolderPrintController.php | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/app/resource/controllers/FolderPrintController.php b/src/app/resource/controllers/FolderPrintController.php index 5f471160e83..7e7fc4a9c67 100755 --- a/src/app/resource/controllers/FolderPrintController.php +++ b/src/app/resource/controllers/FolderPrintController.php @@ -218,15 +218,7 @@ class FolderPrintController $attachment = $originAttachment; } - if ($withSeparators) { - $documentPaths[] = FolderPrintController::getAttachmentSeparator([ - 'attachment' => $attachment, - 'chronoResource' => $chronoResource - ]); - } - $path = FolderPrintController::getDocumentFilePath(['document' => $attachment, 'collId' => 'attachments_coll']); - if (!empty($path['errors'])) { LogsController::add([ 'isTech' => true, @@ -237,9 +229,16 @@ class FolderPrintController 'eventType' => 'Error: ' . $path['errors'], 'eventId' => 'FolderPrint Error' ]); - } else { - $documentPaths[] = $path; + continue; } + + if ($withSeparators) { + $documentPaths[] = FolderPrintController::getAttachmentSeparator([ + 'attachment' => $attachment, + 'chronoResource' => $chronoResource + ]); + } + $documentPaths[] = $path; } } } @@ -560,6 +559,14 @@ class FolderPrintController } if (!empty($documentPaths)) { + if (empty($resource['altIdentifier'] . $resource['subject'])) { + $document = ResModel::getById([ + 'select' => ['alt_identifier', 'subject'], + 'resId' => $resource['resId'] + ]); + $resource['altIdentifier'] = $document['alt_identifier']; + $resource['subject'] = $document['subject']; + } $filePathOnTmp = trim($tmpDir . TextFormatModel::formatFilename([ 'filename' => $resource['altIdentifier'] . '_' . $resource['subject'], 'maxLength' => 100 -- GitLab