From 531311c1be41a0128c034206bbcf2840992cc8f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Apr 2026 17:47:39 +0200 Subject: [PATCH] Fix regression in email title (must contains ref of ticket) Fix the status private is already stored in code, so we can show it in list with a picto. --- htdocs/core/class/html.formactions.class.php | 5 ++++- htdocs/core/class/html.formticket.class.php | 10 ++++------ htdocs/public/ticket/view.php | 3 ++- htdocs/ticket/card.php | 2 +- htdocs/ticket/class/ticket.class.php | 13 ++++++------- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 42844cff036..df7d4ce171e 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -322,8 +322,11 @@ class FormActions // Type $labeltypelong = $actioncomm->getTypeLabel(2); - print ''; + print ''; print $actioncomm->getTypePicto('valignmiddle'); + if (preg_match('/PRIVATE/', $actioncomm->code)) { + print ' '.img_picto($langs->transnoentitiesnoconv("Private"), 'lock', 'class="valignmiddle"'); + } //$labeltype = $actioncomm->getTypeLabel(0); //print $labeltype; print ''; diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index d8e0975edb1..1b32a9e08df 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1780,13 +1780,11 @@ class FormTicket if ($this->withtitletopic) { print ''; // Answer to a ticket : display of the thread title in readonly - if ($this->withtopicreadonly) { + if ($this->withtopicreadonly && $this->topic_title) { print $langs->trans('Summary').' '.$this->topic_title; - } else { - if (isset($this->withreadid) && $this->withreadid > 0) { - $subject = $langs->trans('Summary').' '.$this->withreadid.' : '.$this->topic_title; - } - print 'withemail) ? ' autofocus' : '').' />'; + } elseif (empty($this->withtopicreadonly)) { + $subject = $this->topic_title; + print 'withemail) ? ' autofocus' : '').' />'; } print ''; } diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 7a8e98466ac..56f8fab07a5 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -219,6 +219,7 @@ if (in_array($action, array("view_ticket", "presend", "close", "confirm_public_c } } + // Actions to send emails (for ticket, we need to manage the addfile and removefile only) $triggersendname = 'TICKET_SENTBYMAIL'; $paramname = 'id'; @@ -408,7 +409,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a $formticket->withfile = 2; $formticket->withcancel = 1; $formticket->withtitletopic = 1; - $formticket->topic_title = $langs->trans('Summary').' '.$langs->trans('CreatedByPublicPortal'); + //$formticket->topic_title = $langs->trans('Summary').' '.$langs->trans('CreatedByPublicPortal'); $formticket->showMessageForm('100%'); } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 866db251f09..6f30f4f26de 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1603,7 +1603,7 @@ if ($action == 'create' || $action == 'presend') { $formticket->backtopage = $backtopage; $formticket->withtitletopic = 1; - $formticket->topic_title = $langs->trans('Message').' '.$langs->trans('Summary'); + //$formticket->topic_title = $langs->trans('Message').' '.$langs->trans('Summary'); $formticket->showMessageForm('100%'); print ''; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 093dd2f7077..b418bce5e93 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1925,16 +1925,15 @@ class Ticket extends CommonObject $actioncomm->email_from = $_SESSION['email_customer']; } $actioncomm->socid = $this->socid; + $actioncomm->label = $this->subject; if ($summary) { - if ($this->private) { - $actioncomm->label = '['.$langs->trans('Private').'] '.((string) $summary); - } else { - $actioncomm->label = (string) $summary; + $actioncomm->label = preg_replace('/(\[[^\]]*\]).*$/', '\1', $actioncomm->label); + if ($actioncomm->label) { + $actioncomm->label .= ' '; } - $actioncomm->email_subject = $this->subject; - } else { - $actioncomm->label = $this->subject; + $actioncomm->label .= (string) $summary; } + $actioncomm->note_private = $this->message; $actioncomm->userassigned = array($user->id => array('id' => $user->id,'transparency' => 0)); $actioncomm->userownerid = $user->id;