From f660ad273ff58bdb116ccaa4b1c275fa085c1b83 Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Fri, 29 Mar 2019 14:38:09 +0100
Subject: [PATCH] FIX User without services

---
 src/app/group/controllers/ServiceController.php | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/app/group/controllers/ServiceController.php b/src/app/group/controllers/ServiceController.php
index 02e37ebe97c..f99332ac3d0 100755
--- a/src/app/group/controllers/ServiceController.php
+++ b/src/app/group/controllers/ServiceController.php
@@ -18,9 +18,12 @@ class ServiceController
             $servicesStoredInDB[] = $value['service_id'];
         }
 
-        $menu = ServiceModel::getApplicationServicesByUserServices(['userServices' => $servicesStoredInDB, 'type' => 'menu']);
-        $menuModules = ServiceModel::getModulesServicesByUserServices(['userServices' => $servicesStoredInDB, 'type' => 'menu']);
-        $menu = array_merge($menu, $menuModules);
+        $menu = [];
+        if (!empty($servicesStoredInDB)) {
+            $menu = ServiceModel::getApplicationServicesByUserServices(['userServices' => $servicesStoredInDB, 'type' => 'menu']);
+            $menuModules = ServiceModel::getModulesServicesByUserServices(['userServices' => $servicesStoredInDB, 'type' => 'menu']);
+            $menu = array_merge($menu, $menuModules);
+        }
 
         return $menu;
     }
-- 
GitLab