From 078509e4fcf2dd54c89b25225b8d3ffa42db2b5b Mon Sep 17 00:00:00 2001 From: lebozec <nicolas.lebozec@xelians.fr> Date: Mon, 20 Feb 2023 17:34:54 +0100 Subject: [PATCH] FIX #19031 TIME 1:30 Fix proof document download with php8 --- src/app/history/controllers/HistoryController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/history/controllers/HistoryController.php b/src/app/history/controllers/HistoryController.php index 5bbefb36b1..338cfa3c0b 100644 --- a/src/app/history/controllers/HistoryController.php +++ b/src/app/history/controllers/HistoryController.php @@ -434,7 +434,7 @@ class HistoryController } $queryParams = $request->getQueryParams(); - if (!empty($queryParams['onlyProof']) && (empty($queryParams['onlyProof']) || empty($proofDocument))) { + if (empty($queryParams['onlyProof']) || empty($proofDocument)) { $formattedHistory = HistoryController::getFormattedHistory(['id' => $args['id']]); $historyXml = HistoryController::arrayToXml(['data' => $formattedHistory['formattedHistory'], 'xml' => false]); $historyXmlPath = $tmpPath . 'maarchProof' . $GLOBALS['id'] . "_" . rand() . '.xml'; @@ -496,7 +496,8 @@ class HistoryController } } } - if (!empty($queryParams['onlyProof']) && !$queryParams['onlyProof']) { + if (empty($queryParams['onlyProof'])) { + $contentType = null; if ($workflowCompleted && ($queryParams['eSignDocument'] ?? $hasCertificate)) { $contentType = 'ESIGN'; } @@ -577,7 +578,7 @@ class HistoryController if (empty($queryParams['mode']) || $queryParams['mode'] == 'base64') { return $response->withJson(['encodedProofDocument' => base64_encode($content), 'format' => $format]); } else { - $response->write($content ?? ''); + $response->write($content); $response = $response->withAddedHeader('Content-Disposition', "inline; filename=maarch_history_proof." . $format); return $response->withHeader('Content-Type', $mimeType); } @@ -590,7 +591,6 @@ class HistoryController $tmpPath = CoreConfigModel::getTmpPath(); $zipFilename = $tmpPath . 'archivedProof' . $GLOBALS['id'] . '_' . rand() . '.zip'; - if (empty($zipFilename)) if ($zip->open($zipFilename, \ZipArchive::CREATE) === true) { foreach ($aArgs['documents'] as $document) { -- GitLab