diff --git a/src/app/document/controllers/DocumentController.php b/src/app/document/controllers/DocumentController.php index 17106d6e11596030a1daaf7b2aca1595bba88616..611b1f24afce4a1eb643afbb175433113cbc436a 100755 --- a/src/app/document/controllers/DocumentController.php +++ b/src/app/document/controllers/DocumentController.php @@ -194,6 +194,7 @@ class DocumentController if (!empty($workflowExternalInformations)) { $userLabel = "{$workflowExternalInformations['firstname']} {$workflowExternalInformations['lastname']}"; $workflowExternalInformations['informations'] = json_decode($workflowExternalInformations['informations'], true); + unset($workflowExternalInformations['informations']['yousignFileId'], $workflowExternalInformations['informations']['yousignProcedureId']); } $formattedDocument['workflow'][] = [ @@ -927,12 +928,16 @@ class DocumentController } } - DocumentController::endAction([ + $end = DocumentController::endAction([ 'id' => $args['id'], 'workflowId' => $workflow['id'], 'status' => DocumentController::ACTIONS[$args['actionId']], 'note' => $body['note'] ?? null ]); + if (!empty($end['errors'])) { + return $response->withStatus(400)->withJson(['errors' => $end['errors']]); + } + $historyMessagePart = "{actionDone} : "; if ($workflow['user_id'] != $GLOBALS['id']) { @@ -1063,13 +1068,16 @@ class DocumentController $content = file_get_contents($content['path']); $document = DocumentModel::getById(['select' => ['title', 'description'], 'id' => $args['id']]); - YousignController::createProcedure([ + $procedureCreated = YousignController::createProcedure([ 'documentId' => $args['id'], 'encodedDocument' => base64_encode($content), 'name' => $document['title'], 'description' => $document['description'], 'workflowId' => $nextWorkflow['id'] ]); + if (!empty($procedureCreated['errors'])) { + return ['errors' => $procedureCreated['errors']]; + } } } else { EmailController::sendNotification(['documentId' => $args['id'], 'status' => $args['status']]);