Skip to content
Snippets Groups Projects
Commit db98b363 authored by Guillaume Heurtier's avatar Guillaume Heurtier
Browse files

FEAT #14565 TIME 0:00 block adding stamp signatory after non-stamp signatory

parent 5c0de770
No related branches found
No related tags found
No related merge requests found
......@@ -397,6 +397,7 @@
"addNewDate": "Add a new date",
"add": "Add",
"dateInDocAdded": "Date added in document",
"rejectDocumentWarning": "You are about to decline this document!"
"rejectDocumentWarning": "You are about to decline this document!",
"stampInTheMiddleImpossible": "You cannot add a Signatory with stamp after a Signatory with an electronic signature"
}
}
\ No newline at end of file
}
......@@ -396,6 +396,7 @@
"addNewDate": "Ajouter une nouvelle date",
"add": "Ajouter",
"dateInDocAdded": "Date ajoutée dans le document",
"rejectDocumentWarning": "Vous êtes sur le point de refuser ce document !"
"rejectDocumentWarning": "Vous êtes sur le point de refuser ce document !",
"stampInTheMiddleImpossible": "Vous ne pouvez pas ajouter un Signataire Griffe après un Signataire avec signature électronique"
}
}
......@@ -303,6 +303,7 @@ class DocumentController
}
$hasEidas = false;
$hasElectronicSignature = false;
foreach ($body['workflow'] as $key => $workflow) {
if (!empty($workflow['processingUser'])) {
$processingUser = UserModel::getByLogin(['select' => ['id'], 'login' => strtolower($workflow['processingUser'])]);
......@@ -314,6 +315,9 @@ class DocumentController
} elseif (!Validator::stringType()->notEmpty()->validate($workflow['mode']) || !in_array($workflow['mode'], DocumentController::MODES)) {
return $response->withStatus(400)->withJson(['errors' => "Body workflow[{$key}] mode is empty or not a string in ('visa', 'sign', 'note')"]);
}
if ($hasElectronicSignature && $workflow['signatureMode'] == 'stamp') {
return $response->withStatus(400)->withJson(['errors' => "Body workflow[{$key}] signatureMode cannot be stamp after an electronic signature", 'lang' => 'stampInTheMiddleImpossible']);
}
if (!empty($workflow['signaturePositions'])) {
if (!Validator::arrayType()->validate($workflow['signaturePositions'])) {
return $response->withStatus(400)->withJson(['errors' => "Body workflow[{$key}] signaturePositions is not an array"]);
......@@ -339,6 +343,9 @@ class DocumentController
if (in_array($workflow['signatureMode'], ['eidas', 'rgs_2stars_timestamped', 'inca_card_eidas'])) {
$hasEidas = true;
}
if ($workflow['signatureMode'] != 'stamp') {
$hasElectronicSignature = true;
}
$body['workflow'][$key]['userId'] = $processingUser['id'];
}
......
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