From 3de0bc3376c5fce7608222e7d4ca694d611a674a Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Fri, 21 May 2021 16:54:49 +0200
Subject: [PATCH] FIX #16982 TIME 0:25 wrong condition for validator

---
 src/app/workflow/controllers/YousignController.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/app/workflow/controllers/YousignController.php b/src/app/workflow/controllers/YousignController.php
index 9cd61fad2e..920c8be982 100755
--- a/src/app/workflow/controllers/YousignController.php
+++ b/src/app/workflow/controllers/YousignController.php
@@ -48,7 +48,7 @@ class YousignController
         $externalSB['message_content'] = json_decode($externalSB['message_content'], true);
 
         $workflowExternalInformations['informations'] = json_decode($workflowExternalInformations['informations'], true);
-        if (empty($workflowExternalInformations['informations']['signaturePositions']) && $workflowExternalInformations['role'] == 'sign') {
+        if (empty($workflowExternalInformations['informations']['signaturePositions']) && $workflowExternalInformations['informations']['role'] == 'sign') {
             return ['errors' => 'Signature positions are needed for signer'];
         }
 
@@ -70,7 +70,7 @@ class YousignController
         $trunkedFileId = str_replace('/files/', '', $fileId);
 
         $fileObjects = [['file' => $fileId, 'page' => 0]];
-        if ($workflowExternalInformations['role'] == 'sign') {
+        if ($workflowExternalInformations['informations']['role'] == 'sign') {
             $fileObjects = [];
             foreach ($workflowExternalInformations['informations']['signaturePositions'] as $signaturePosition) {
                 $fileObjects[] = [
@@ -98,7 +98,7 @@ class YousignController
                         'operationLevel'            => 'custom',
                         'operationCustomModes'      => [$workflowExternalInformations['informations']['security']],
                         'operationModeSmsConfig'    => ['content' => $externalSB['message_content']['otp_sms']],
-                        'type'                      => $workflowExternalInformations['role'] == 'visa' ? 'validator' : 'signer',
+                        'type'                      => $workflowExternalInformations['informations']['role'] == 'visa' ? 'validator' : 'signer',
                         'fileObjects'               => $fileObjects
                     ]
                 ],
-- 
GitLab