From da1ea959cbe84b7a0154ef7cfb5a5dde7c23a7bb Mon Sep 17 00:00:00 2001 From: evarisk-kilyan Date: Tue, 17 Feb 2026 20:31:53 +0100 Subject: [PATCH] #37167 [TicketAdmin] add: notification ticket_create email template config (#37229) * #37167 [TicketAdmin] add: notification ticket_create email template config * #37167 [Lang] add: langs trans --- htdocs/admin/ticket.php | 37 ++++++++++++++++++++++++++++++++++ htdocs/langs/en_US/ticket.lang | 2 ++ htdocs/langs/fr_FR/ticket.lang | 2 ++ 3 files changed, 41 insertions(+) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 6d5f3b592a9..4a2b2e642df 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -231,6 +231,17 @@ if ($action == 'updateMask') { $error++; } + $notification_email_template = GETPOST('TICKET_NOTIFICATION_EMAIL_TEMPLATE', 'alpha'); + $notification_email_template_description = 'Template email for ticket create notification'; + if (!empty($notification_email_to)) { + $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TEMPLATE', $notification_email_template, 'chaine', 0, $notification_email_template_description, $conf->entity); + } else { + $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TEMPLATE', '', 'chaine', 0, $notification_email_template_description, $conf->entity); + } + if (!($res > 0)) { + $error++; + } + $mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'restricthtml'); $mail_intro_description = "Introduction text of ticket replies sent from Dolibarr"; if (!empty($mail_intro)) { @@ -699,6 +710,32 @@ print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationToH print ''; print ''; +include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; +$formmail = new FormMail($db); + +$formmail->fetchAllEMailTemplate('ticket_send', $user, null, -1); // We set lang=null to get in priority record with no lang +$arrayofmessagename = array(); +if (is_array($formmail->lines_model)) { + foreach ($formmail->lines_model as $modelmail) { + //var_dump($modelmail); + $moreonlabel = ''; + if (!empty($arrayofmessagename[$modelmail->label])) { + $moreonlabel = ' ('.$langs->trans("SeveralLangugeVariatFound").')'; + } + // The 'label' is the key that is unique if we exclude the language + $arrayofmessagename[$modelmail->label.':ticket_send'] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)).$moreonlabel; + } +} + +// Email template for notification of TICKET_CREATE +print ''; +print ''; +print $form->selectarray('TICKET_NOTIFICATION_EMAIL_TEMPLATE', $arrayofmessagename, getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TEMPLATE'), 'None', 0, 0, '', 0, 0, 0, '', '', 1); +print ''; +print $formcategory->textwithpicto('', $langs->trans('TicketEmailNotificationTemplateHelp'), 1, 'help'); +print ''; +print ''; + // Check "Notify thirdparty" by default on ticket creation print ''.$langs->trans("TicketAutoCheckNotifyThirdParty").''; print ''; diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 7cb3105db12..5fa74d1c2d9 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -78,6 +78,8 @@ TicketEmailNotificationReplyTo=E-mail that must appears to recipient as the send TicketEmailNotificationReplyToHelp=Sender e-mail to use as the Reply-To to send the notification emails for tickets creation or message addition. If defined, this is the email that the recipient will reply to instead of the From. For example: support@example.com TicketEmailNotificationTo=Notify ticket creation to this e-mail address TicketEmailNotificationToHelp=If present, this e-mail address will be notified of a ticket creation (in addition to any other default recipients) +TicketEmailNotificationTemplate=Ticket email notification template +TicketEmailNotificationTemplateHelp=If defined, this email template will be used for ticket notifications (creation, updates, etc.) instead of the default template. TicketNewEmailBodyLabel=Text message sent after creating a ticket TicketNewEmailBodyHelp=The text specified here will be inserted into the email confirming the creation of a new ticket from the public interface. Information on the consultation of the ticket are automatically added. TicketParamPublicInterface=Public interface setup diff --git a/htdocs/langs/fr_FR/ticket.lang b/htdocs/langs/fr_FR/ticket.lang index f68fde2b8c3..454bdbceafe 100644 --- a/htdocs/langs/fr_FR/ticket.lang +++ b/htdocs/langs/fr_FR/ticket.lang @@ -78,6 +78,8 @@ TicketEmailNotificationReplyTo=E-mail qui doit apparaître au destinataire comme TicketEmailNotificationReplyToHelp=Adresse e-mail de l'expéditeur à utiliser comme adresse de réponse pour l'envoi des notifications de création ou d'ajout de message tickets. Si cette adresse est définie, le destinataire répondra à cette adresse plutôt qu'à l'adresse de l'expéditeur. Par exemple : support@exemple.com TicketEmailNotificationTo=Notifier la création du ticket à cette adresse e-mail TicketEmailNotificationToHelp=Si elle est présente, cette adresse e-mail sera notifiée de la création d'un ticket (en plus de tous les autres destinataires par défaut) +TicketEmailNotificationTemplate=Modèle d'e-mail pour la notification de ticket +TicketEmailNotificationTemplateHelp=Si défini, ce modèle d'e-mail sera utilisé pour les notifications liées aux tickets (création, mise à jour, etc.) à la place du modèle par défaut. TicketNewEmailBodyLabel=Texte du message envoyé après la création d'un ticket TicketNewEmailBodyHelp=Le texte spécifié ici sera inséré dans l'e-mail confirmant la création d'un nouveau ticket depuis l'interface publique. Les informations sur la consultation du ticket sont automatiquement ajoutées. TicketParamPublicInterface=Configuration de l'interface publique\n