From e5f3c0789e260be763c7de4f2630ceeca59b3a41 Mon Sep 17 00:00:00 2001
From: Guillaume Heurtier <guillaume.heurtier@maarch.org>
Date: Mon, 9 Dec 2019 17:48:54 +0100
Subject: [PATCH] FEAT #12510 TIME 0:15 display number of contacts in list if
 more than 2 contacts

---
 .../documents_list_mlb_search_adv.php         | 23 +++++++++++--------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/apps/maarch_entreprise/indexing_searching/documents_list_mlb_search_adv.php b/apps/maarch_entreprise/indexing_searching/documents_list_mlb_search_adv.php
index 76d1d826bfd..4c25858d8a7 100755
--- a/apps/maarch_entreprise/indexing_searching/documents_list_mlb_search_adv.php
+++ b/apps/maarch_entreprise/indexing_searching/documents_list_mlb_search_adv.php
@@ -792,18 +792,18 @@ if ($mode == 'normal') {
                 // Contacts
                 if ($tab[$i][$j][$value] == 'real_dest') {
                     $resId = $tab[$i][$j]['value'];
-                    $contactList = \Contact\controllers\ContactController::getFormattedContacts(['resId' => $resId, 'mode' => 'recipient', 'onlyContact' => true]);
-
-                    $formattedRecipients = implode("<br>", $contactList);
-
-                    $contactList = \Contact\controllers\ContactController::getFormattedContacts(['resId' => $resId, 'mode' => 'sender', 'onlyContact' => true]);
-
-                    $formattedSenders = implode("<br>", $contactList);
+                    $recipientList = \Contact\controllers\ContactController::getFormattedContacts(['resId' => $resId, 'mode' => 'recipient', 'onlyContact' => true]);
 
+                    $senderList = \Contact\controllers\ContactController::getFormattedContacts(['resId' => $resId, 'mode' => 'sender', 'onlyContact' => true]);
 
                     $tab[$i][$j]['value'] = '';
 
-                    if (!empty($formattedSenders)) {
+                    if (!empty($senderList)) {
+                        if (count($senderList) > 2) {
+                            $formattedSenders = count($senderList) . ' ' . _SENDERS;
+                        } else {
+                            $formattedSenders = implode("<br>", $senderList);
+                        }
                         $formattedSenders = '<b>'._TO_CONTACT_C.'</b>'.$formattedSenders;
                         $tab[$i][$j]['value'] .= $formattedSenders;
 
@@ -811,7 +811,12 @@ if ($mode == 'normal') {
                             $tab[$i][$j]['value'] .= "<br>";
                         }
                     }
-                    if (!empty($formattedRecipients)) {
+                    if (!empty($recipientList)) {
+                        if (count($recipientList) > 2) {
+                            $formattedRecipients = count($recipientList) . ' ' . _RECIPIENTS;
+                        } else {
+                            $formattedRecipients = implode("<br>", $recipientList);
+                        }
                         $formattedRecipients = '<b>'._FOR_CONTACT_C.'</b>'.$formattedRecipients;
                         $tab[$i][$j]['value'] .= $formattedRecipients;
                     }
-- 
GitLab