From 07b31a38e2f27948d086e005b0393fd33738a54b Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Mon, 6 Jan 2020 20:35:57 +0100
Subject: [PATCH] fix empty other info + remove check admin get contacts
 parameters

---
 src/app/contact/controllers/ContactController.php     |  4 ++--
 .../app/contact/list/contacts-list.component.ts       | 11 ++++++++++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php
index 16060ba9902..6a2fbc56b17 100755
--- a/src/app/contact/controllers/ContactController.php
+++ b/src/app/contact/controllers/ContactController.php
@@ -419,9 +419,9 @@ class ContactController
 
     public function getContactsParameters(Request $request, Response $response)
     {
-        if (!PrivilegeController::hasPrivilege(['privilegeId' => 'admin_contacts', 'userId' => $GLOBALS['id']])) {
+        /*if (!PrivilegeController::hasPrivilege(['privilegeId' => 'admin_contacts', 'userId' => $GLOBALS['id']])) {
             return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']);
-        }
+        }*/
 
         $contactsFilling = ContactFillingModel::get();
         $contactParameters = ContactParameterModel::get([
diff --git a/src/frontend/app/contact/list/contacts-list.component.ts b/src/frontend/app/contact/list/contacts-list.component.ts
index 382629ae212..c45146d13ae 100644
--- a/src/frontend/app/contact/list/contacts-list.component.ts
+++ b/src/frontend/app/contact/list/contacts-list.component.ts
@@ -169,7 +169,16 @@ export class ContactsListComponent implements OnInit {
     }
 
     empty(value: any) {
-        if (value !== null && value !== '' && value !== undefined) {
+        if (value === null || value === undefined) {
+            return true;
+
+        } else if (Array.isArray(value)) {
+            if (value.length > 0) {
+                return false;
+            } else {
+                return true;
+            }
+        } else if (String(value) !== '') {
             return false;
         } else {
             return true;
-- 
GitLab