diff --git a/src/app/external/exportSeda/controllers/ExportSEDATrait.php b/src/app/external/exportSeda/controllers/ExportSEDATrait.php index 5d59927dd89b5e4446818a9fcd4df587054334a6..c92339981c45e4b63459acdd5a039082c58cce18 100644 --- a/src/app/external/exportSeda/controllers/ExportSEDATrait.php +++ b/src/app/external/exportSeda/controllers/ExportSEDATrait.php @@ -33,7 +33,6 @@ use setasign\Fpdi\Tcpdf\Fpdi; use SrcCore\models\CoreConfigModel; use SrcCore\models\CurlModel; use SrcCore\models\ValidatorModel; -use User\models\UserModel; trait ExportSEDATrait { @@ -177,7 +176,7 @@ trait ExportSEDATrait 'senders' => ContactController::getParsedContacts(['resId' => $resource['res_id'], 'mode' => 'sender']), 'recipients' => ContactController::getParsedContacts(['resId' => $resource['res_id'], 'mode' => 'recipient']) ], - 'attachments' => $initData['archivalData']['archiveUnits'] ?? [], + 'attachments' => $initData['archiveUnits'], 'folders' => $folder['folderPath'], 'links' => $initData['additionalData']['linkedResources'] ]; @@ -208,9 +207,14 @@ trait ExportSEDATrait ExportSEDATrait::cleanTmpDocument(['archiveUnits' => $initData['archiveUnits']]); if ($args['data']['actionMode'] == 'download') { + static $downloadFiles; + if ($downloadFiles === null) { + $downloadFiles = []; + } $encodedContent = base64_encode(file_get_contents($sedaPackage['encodedFilePath'])); unlink($sedaPackage['encodedFilePath']); - return ['data' => ['encodedFile' => $encodedContent]]; + $downloadFiles[] = $encodedContent; + return ['data' => ['encodedFiles' => $downloadFiles]]; } elseif (count($args['resources']) > 1) { $customId = CoreConfigModel::getCustomId(); diff --git a/src/app/external/exportSeda/controllers/SedaController.php b/src/app/external/exportSeda/controllers/SedaController.php index a2be251dfe1e4d62ef755042095ab26449a8fed1..e6489c11ba749bbe35095ca4770b9bfc8fc3ad8f 100755 --- a/src/app/external/exportSeda/controllers/SedaController.php +++ b/src/app/external/exportSeda/controllers/SedaController.php @@ -52,7 +52,7 @@ class SedaController 'retentionFinalDisposition' => $args['doctype']['retention_final_disposition'] ], 'slipInfo' => [ - 'slipId' => $GLOBALS['login'] . '-' . $date->format('Ymd-Hisu'), + 'slipId' => $GLOBALS['login'] . '-' . $date->format('Ymd-Hisu') . '-' . $args['resource']['res_id'], 'archiveId' => 'archive_' . $args['resource']['res_id'] ] ], diff --git a/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.ts b/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.ts index 0a59d9deaefe4d9220f2aacf597c889bc774b1ae..41a3ffa56f19ca203acc92e0ad7765a38890e076 100644 --- a/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.ts +++ b/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.ts @@ -121,29 +121,31 @@ export class SendToRecordManagementComponent implements OnInit { this.http.put(this.data.processActionRoute, { resources: realResSelected, data: this.formatData(mode) }).pipe( tap((data: any) => { - if (mode === 'download' && !this.functions.empty(data.data.encodedFile)) { + if (mode === 'download' && !this.functions.empty(data.data.encodedFiles)) { const downloadLink = document.createElement('a'); - downloadLink.href = `data:application/zip;base64,${data.data.encodedFile}`; - let today: any; - let dd: any; - let mm: any; - let yyyy: any; - - today = new Date(); - dd = today.getDate(); - mm = today.getMonth() + 1; - yyyy = today.getFullYear(); - - if (dd < 10) { - dd = '0' + dd; - } - if (mm < 10) { - mm = '0' + mm; - } - today = dd + '-' + mm + '-' + yyyy; - downloadLink.setAttribute('download', 'seda_package_' + today + '.zip'); - document.body.appendChild(downloadLink); - downloadLink.click(); + data.data.encodedFiles.forEach((file:string) => { + downloadLink.href = `data:application/zip;base64,${file}`; + let today: any; + let dd: any; + let mm: any; + let yyyy: any; + + today = new Date(); + dd = today.getDate(); + mm = today.getMonth() + 1; + yyyy = today.getFullYear(); + + if (dd < 10) { + dd = '0' + dd; + } + if (mm < 10) { + mm = '0' + mm; + } + today = dd + '-' + mm + '-' + yyyy; + downloadLink.setAttribute('download', 'seda_package_' + today + '.zip'); + document.body.appendChild(downloadLink); + downloadLink.click(); + }); this.dialogRef.close('success'); } else if (!data) { this.dialogRef.close('success');