diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 4e6b25db11d..d8e0975edb1 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2023-2025 Charlene Benke * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Irvine FLEITH + * Copyright (C) 2026 Jon Bendtsen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1775,7 +1776,20 @@ class FormTicket $uselocalbrowser = false; - // Subject/topic + // Summary + if ($this->withtitletopic) { + print ''; + // Answer to a ticket : display of the thread title in readonly + if ($this->withtopicreadonly) { + 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' : '').' />'; + } + print ''; + } $topic = ""; foreach ($formmail->lines_model as $line) { if (!empty($this->substit) && $this->param['models_id'] == $line->id) { diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 22ab670f629..7a8e98466ac 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -3,6 +3,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2023 Benjamin Falière * Copyright (C) 2025 MDW + * Copyright (C) 2026 Jon Bendtsen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -406,6 +407,8 @@ 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->showMessageForm('100%'); } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 931a1d5e75b..866db251f09 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -8,6 +8,7 @@ * Copyright (C) 2023 Benjamin Falière * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Irvine FLEITH + * Copyright (C) 2026 Jon Bendtsen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1601,6 +1602,9 @@ if ($action == 'create' || $action == 'presend') { $formticket->substit = $substitutionarray; $formticket->backtopage = $backtopage; + $formticket->withtitletopic = 1; + $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 da1af1b5d3b..093dd2f7077 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2023-2024 Benjamin Falière * Copyright (C) 2024 William Mead * Copyright (C) 2024-2025 MDW + * Copyright (C) 2026 Jon Bendtsen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1888,11 +1889,12 @@ class Ticket extends CommonObject * @param string[] $mimefilename_list List of attached file name in message * @param bool $send_email Whether the message is sent by email * @param int<0,1> $public_area 0=Default, 1 if we are creating the message from a public area (so we can search contact from email to add it as contact of ticket if TICKET_ASSIGN_CONTACT_TO_MESSAGE is set) + * @param string $summary ''=Default means using subject, else insert the summary as label * @return int Return integer <0 if KO, ID of actioncomm create if OK */ - public function createTicketMessage($user, $notrigger = 0, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $send_email = false, $public_area = 0) + public function createTicketMessage($user, $notrigger = 0, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $send_email = false, $public_area = 0, $summary = '') { - global $conf; + global $conf, $langs; $error = 0; $now = dol_now(); @@ -1923,7 +1925,16 @@ 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->email_subject = $this->subject; + } else { + $actioncomm->label = $this->subject; + } $actioncomm->note_private = $this->message; $actioncomm->userassigned = array($user->id => array('id' => $user->id,'transparency' => 0)); $actioncomm->userownerid = $user->id; @@ -2781,6 +2792,7 @@ class Ticket extends CommonObject } if (!$error) { + $summary = mb_strcut(GETPOST('summary', 'alphanohtml'), 0, 42, 'UTF-8'); $object->subject = GETPOST('subject', 'alphanohtml'); $object->message = GETPOST("message", "restricthtml"); $object->private = GETPOST("private_message", "alpha"); @@ -2801,7 +2813,7 @@ class Ticket extends CommonObject // Add the ticket message in database (even if email is requested, we store a simple record // like a simple private message, with no information about emails) because // information about emails sent will be fill later after email sending. - $id = $object->createTicketMessage($user, 0, $listofpaths, $listofmimes, $listofnames, $send_email, $public_area); + $id = $object->createTicketMessage($user, 0, $listofpaths, $listofmimes, $listofnames, $send_email, $public_area, $summary); if ($id <= 0) { $error++;