From 664f6206ab3a8bf75d22d48b97669a1b23b03c66 Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Mon, 31 May 2021 17:47:07 +0200
Subject: [PATCH] FEAT #16982 TIME 0:30 (back) signature position is mandatory
 for sign_yousign

---
 src/app/document/controllers/DocumentController.php | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/app/document/controllers/DocumentController.php b/src/app/document/controllers/DocumentController.php
index bf9e1256f6..a25d488cf4 100755
--- a/src/app/document/controllers/DocumentController.php
+++ b/src/app/document/controllers/DocumentController.php
@@ -365,6 +365,9 @@ class DocumentController
             if ($hasElectronicSignature && $workflow['signatureMode'] == 'stamp' && $workflow['mode'] == 'sign') {
                 return $response->withStatus(400)->withJson(['errors' => "Body workflow[{$key}] signatureMode cannot be stamp after an electronic signature", 'lang' => 'stampInTheMiddleImpossible']);
             }
+            if ($workflow['externalInformations']['role'] == 'sign_yousign' && empty($workflow['signaturePositions'])) {
+                return $response->withStatus(400)->withJson(['errors' => "Body workflow[{$key}] signaturePositions must be set for sign_yousign role"]);
+            }
             if (!empty($workflow['signaturePositions'])) {
                 if (!Validator::arrayType()->validate($workflow['signaturePositions'])) {
                     return $response->withStatus(400)->withJson(['errors' => "Body workflow[{$key}] signaturePositions is not an array"]);
-- 
GitLab