From b5d348356dbc590b50ec97b25fceae111e7ac91a Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 17 Jul 2019 16:49:41 +0200 Subject: [PATCH] Fix socpeople assigned list in action com list --- htdocs/comm/action/list.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 2d8be09ee7a..aae2d48e9cf 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -524,6 +524,7 @@ if ($resql) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; $caction=new CActionComm($db); $arraylist=$caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0), '', 1); + $contactListCache = array(); while ($i < min($num,$limit)) { @@ -634,7 +635,34 @@ if ($resql) // Contact if (! empty($arrayfields['a.fk_contact']['checked'])) { print ''; - if ($obj->fk_contact > 0) + + + $actionstatic->fetchResources(); + if(!empty($actionstatic->socpeopleassigned)) + { + $contactList = array(); + foreach ($actionstatic->socpeopleassigned as $socpeopleId => $socpeopleassigned) + { + if(!isset($contactListCache[$socpeopleassigned['id']])) + { + // if no cache found we fetch it + $contact = new Contact($db); + if($contact->fetch($socpeopleassigned['id'])>0) + { + $contactListCache[$socpeopleassigned['id']] = $contact->getNomUrl(1,'',28); + $contactList[] = $contact->getNomUrl(1,'',28); + } + } + else{ + // use cache + $contactList[] = $contactListCache[$socpeopleassigned['id']]; + } + } + if(!empty($contactList)){ + print implode(', ', $contactList); + } + } + elseif ($obj->fk_contact > 0) //keep for retrocompatibility with faraway event { $contactstatic->id=$obj->fk_contact; $contactstatic->email=$obj->email;