From c7461414944c94dcfb193870453d3681d8cf5ebd Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Wed, 17 Apr 2019 18:22:11 +0200
Subject: [PATCH] FEAT #9700 Create contact without firstname and lastname

---
 src/app/contact/controllers/ContactController.php | 4 +---
 src/core/controllers/PreparedClauseController.php | 4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php
index 797987b9407..59cd107d8b0 100755
--- a/src/app/contact/controllers/ContactController.php
+++ b/src/app/contact/controllers/ContactController.php
@@ -37,9 +37,7 @@ class ContactController
 
         $data = $request->getParams();
 
-        $check = Validator::notEmpty()->validate($data['firstname']);
-        $check = $check && Validator::stringType()->notEmpty()->validate($data['lastname']);
-        $check = $check && Validator::intVal()->notEmpty()->validate($data['contactType']);
+        $check = Validator::intVal()->notEmpty()->validate($data['contactType']);
         $check = $check && Validator::intVal()->notEmpty()->validate($data['contactPurposeId']);
         $check = $check && Validator::stringType()->notEmpty()->validate($data['isCorporatePerson']);
         $check = $check && Validator::stringType()->notEmpty()->validate($data['email']);
diff --git a/src/core/controllers/PreparedClauseController.php b/src/core/controllers/PreparedClauseController.php
index ad6f9d1342f..0d2edb0f4ea 100755
--- a/src/core/controllers/PreparedClauseController.php
+++ b/src/core/controllers/PreparedClauseController.php
@@ -153,7 +153,7 @@ class PreparedClauseController
             for ($i = 0; $i < $total; $i++) {
                 $tmpParentEntity = trim(str_replace("'", '', $parentEntity[1][$i]));
                 if (!empty($tmpParentEntity)) {
-                    $entity = entitymodel::getByEntityId(['entityId' => $tmpParentEntity, 'select' => ['entity_id', 'parent_entity_id']]);
+                    $entity = Entitymodel::getByEntityId(['entityId' => $tmpParentEntity, 'select' => ['entity_id', 'parent_entity_id']]);
                 }
                 if (empty($entity['parent_entity_id'])) {
                     $parentEntityClause = "''";
@@ -169,7 +169,7 @@ class PreparedClauseController
         if ($total > 0) {
             for ($i = 0; $i < $total; $i++) {
                 $tmpSisterEntity = trim(str_replace("'", '', $sistersEntities[1][$i]));
-                $sisterEntity = entitymodel::getByEntityId(['entityId' => $tmpSisterEntity, 'select' => ['parent_entity_id']]);
+                $sisterEntity = Entitymodel::getByEntityId(['entityId' => $tmpSisterEntity, 'select' => ['parent_entity_id']]);
                 $allSisterEntities = EntityModel::get(['select' => ['entity_id'], 'where' => ['parent_entity_id = ?'], 'data' => [$sisterEntity['parent_entity_id']]]);
 
                 $allSisterEntitiesClause = '';
-- 
GitLab