From 41f8e0cd00b9812082ec49600fd343f7bdcbdd32 Mon Sep 17 00:00:00 2001
From: "kevin.dezaphi" <kevin.dezaphi@maarch.org>
Date: Fri, 5 Oct 2018 12:54:14 +0200
Subject: [PATCH] FIX #8426 remove useless query

---
 src/app/entity/controllers/EntityController.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/app/entity/controllers/EntityController.php b/src/app/entity/controllers/EntityController.php
index 0d95794a85e..8288b2e8d75 100644
--- a/src/app/entity/controllers/EntityController.php
+++ b/src/app/entity/controllers/EntityController.php
@@ -98,7 +98,7 @@ class EntityController
             if ($listTemplate['object_type'] == 'entity_id' && !empty($listTemplate['item_id'])) {
                 $entity['listTemplate']['id'] = $listTemplate['id'];
                 if ($listTemplate['item_type'] == 'user_id') {
-                    $statusUser = UserModel::getByUserId(['select' => ['status'], 'userId' => $listTemplate['item_id']]);
+                    $statusUser = UserModel::getByUserId(['select' => ['status', 'firstname', 'lastname'], 'userId' => $listTemplate['item_id']]);
                     if ($statusUser['status'] != 'DEL') {
                         $entity['listTemplate'][$listTemplate['item_mode']][] = [
                             'item_type'             => $listTemplate['item_type'],
@@ -106,7 +106,7 @@ class EntityController
                             'sequence'              => $listTemplate['sequence'],
                             'title'                 => $listTemplate['title'],
                             'description'           => $listTemplate['description'],
-                            'labelToDisplay'        => UserModel::getLabelledUserById(['userId' => $listTemplate['item_id']]),
+                            'labelToDisplay'        => $statusUser['firstname']. ' ' .$statusUser['lastname'],
                             'descriptionToDisplay'  => UserModel::getPrimaryEntityByUserId(['userId' => $listTemplate['item_id']])['entity_label']
                         ];
                     }
-- 
GitLab