From 17f16923e9d6b1d5dba7b6491b0d24c3ababa9a7 Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Fri, 27 Dec 2019 10:16:15 +0100
Subject: [PATCH] FEAT #11158 TIME 0:15 Fix onlyoffice check key

---
 src/app/contact/controllers/ContactController.php              | 2 +-
 src/app/contentManagement/controllers/OnlyOfficeController.php | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php
index b7782956fa1..5aebac7398e 100755
--- a/src/app/contact/controllers/ContactController.php
+++ b/src/app/contact/controllers/ContactController.php
@@ -216,7 +216,7 @@ class ContactController
 
         $contact = [
             'id'                    => $rawContact['id'],
-            'civility'              => $rawContact['civility'],
+            'civility'              => !empty($rawContact['civility']) ? ContactModel::getCivilityLabel(['civilityId' => $rawContact['civility']]) : null,
             'firstname'             => $rawContact['firstname'],
             'lastname'              => $rawContact['lastname'],
             'company'               => $rawContact['company'],
diff --git a/src/app/contentManagement/controllers/OnlyOfficeController.php b/src/app/contentManagement/controllers/OnlyOfficeController.php
index cdb8f4ba676..31260a14844 100644
--- a/src/app/contentManagement/controllers/OnlyOfficeController.php
+++ b/src/app/contentManagement/controllers/OnlyOfficeController.php
@@ -45,7 +45,7 @@ class OnlyOfficeController
 
         if (!Validator::stringType()->notEmpty()->validate($body['onlyOfficeKey'])) {
             return $response->withStatus(400)->withJson(['errors' => 'Query params onlyOfficeKey is empty']);
-        } elseif (!preg_match('/[^a-z0-9]/i', $body['onlyOfficeKey'])) {
+        } elseif (!preg_match('/[A-Za-z0-9]/i', $body['onlyOfficeKey'])) {
             return $response->withStatus(400)->withJson(['errors' => 'Query params onlyOfficeKey is forbidden']);
         }
 
-- 
GitLab