From a3534cdd2796ef1ce59adde383375325477700dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Mar 2023 11:01:32 +0100 Subject: [PATCH] Do not show description if duplicate of title on message views --- htdocs/core/lib/functions.lib.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3c9647ad7a5..4af0bbe610a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12313,25 +12313,28 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n $out .= ''; // Title + $libelle = ''; $out .= '
'; if (preg_match('/^TICKET_MSG/', $actionstatic->code)) { $out .= $langs->trans('TicketNewMessage'); } elseif (preg_match('/^TICKET_MSG_PRIVATE/', $actionstatic->code)) { $out .= $langs->trans('TicketNewMessage').' ('.$langs->trans('Private').')'; - } else { - if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'action') { - $transcode = $langs->trans("Action".$histo[$key]['acode']); + } elseif (isset($histo[$key]['type'])) { + if ($histo[$key]['type'] == 'action') { + $transcode = $langs->transnoentitiesnoconv("Action".$histo[$key]['acode']); $libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : $histo[$key]['alabel']); $libelle = $histo[$key]['note']; $actionstatic->id = $histo[$key]['id']; - $out .= dol_trunc($libelle, 120); - } - if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') { + $out .= dol_escape_htmltag(dol_trunc($libelle, 120)); + } elseif ($histo[$key]['type'] == 'mailing') { $out .= ''.img_object($langs->trans("ShowEMailing"), "email").' '; - $transcode = $langs->trans("Action".$histo[$key]['acode']); + $transcode = $langs->transnoentitiesnoconv("Action".$histo[$key]['acode']); $libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : 'Send mass mailing'); - $out .= dol_trunc($libelle, 120); + $out .= dol_escape_htmltag(dol_trunc($libelle, 120)); + } else { + $libelle .= $histo[$key]['note']; + $out .= dol_escape_htmltag(dol_trunc($libelle, 120)); } } @@ -12339,7 +12342,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n $out .= ''; - if (!empty($histo[$key]['message']) + if (!empty($histo[$key]['message'] && $histo[$key]['message'] != $libelle) && $actionstatic->code != 'AC_TICKET_CREATE' && $actionstatic->code != 'AC_TICKET_MODIFY' ) {