Skip to content
Snippets Groups Projects
Commit e6c5509b authored by Florian Azizian's avatar Florian Azizian
Browse files

FEAT #14565 TIME 0:15 get refused document in proof folder

parent 855b8877
No related branches found
No related tags found
Loading
...@@ -211,25 +211,25 @@ class HistoryController ...@@ -211,25 +211,25 @@ class HistoryController
} }
$workflow = WorkflowModel::getByDocumentId(['select' => ['user_id', 'process_date', 'note', 'status', 'signature_mode'], 'documentId' => $args['id'], 'orderBy' => ['"order"']]); $workflow = WorkflowModel::getByDocumentId(['select' => ['user_id', 'process_date', 'note', 'status', 'signature_mode'], 'documentId' => $args['id'], 'orderBy' => ['"order"']]);
$hasEidas = false; $hasCertificate = false;
$workflowTerminated = true; $workflowTerminated = true;
$canGetdocaposteProof = true; $workflowCompleted = true;
foreach ($workflow as $step) { foreach ($workflow as $step) {
if (!$hasEidas && in_array($step['signature_mode'], ['eidas', 'rgs_2stars', 'rgs_2stars_timestamped', 'inca_card', 'inca_card_eidas'])) { if (!$hasCertificate && in_array($step['signature_mode'], ['eidas', 'rgs_2stars', 'rgs_2stars_timestamped', 'inca_card', 'inca_card_eidas'])) {
$hasEidas = true; $hasCertificate = true;
} }
if (empty($step['status'])) { if (empty($step['status'])) {
$workflowTerminated = false; $workflowTerminated = false;
} }
if (in_array($step['status'], ['REF', 'STOP'])) { if (in_array($step['status'], ['REF', 'STOP'])) {
$canGetdocaposteProof = false; $workflowCompleted = false;
} }
} }
if (empty($workflow) || !$workflowTerminated) { if (empty($workflow) || !$workflowTerminated) {
return $response->withStatus(403)->withJson(['errors' => 'The document is still being processed']); return $response->withStatus(403)->withJson(['errors' => 'The document is still being processed']);
} }
if ($canGetdocaposteProof) { if ($workflowCompleted) {
$proofDocument = DigitalSignatureController::proof(['documentId' => $args['id']]); $proofDocument = DigitalSignatureController::proof(['documentId' => $args['id']]);
if (!empty($proofDocument['errors'])) { if (!empty($proofDocument['errors'])) {
return $response->withStatus(403)->withJson(['errors' => $proofDocument['errors']]); return $response->withStatus(403)->withJson(['errors' => $proofDocument['errors']]);
...@@ -270,7 +270,7 @@ class HistoryController ...@@ -270,7 +270,7 @@ class HistoryController
$mimeType = 'application/xml'; $mimeType = 'application/xml';
} }
} else { } else {
$eSignDocument = $queryParams['eSignDocument'] ?? $hasEidas; $eSignDocument = $workflowCompleted && ($queryParams['eSignDocument'] ?? $hasCertificate);
$mainDocument = DocumentController::getContentPath(['id' => $args['id'], 'eSignDocument' => $eSignDocument]); $mainDocument = DocumentController::getContentPath(['id' => $args['id'], 'eSignDocument' => $eSignDocument]);
if (!empty($mainDocument['errors'])) { if (!empty($mainDocument['errors'])) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment