From 3d2c20193fadf7a0df232f650b9b480fc26997c5 Mon Sep 17 00:00:00 2001 From: evarisk-kilyan Date: Sat, 21 Feb 2026 23:28:21 +0100 Subject: [PATCH] #37185 [Workflow] add: ticket workflow read ticket when assign someone (#37187) * #37185 [Workflow] add: ticket workflow read ticket when assign someone * #37185 [Workflow] remove: double quote * #37185 [Ticket] fix: move conf to ticket conf * #37185 [Ticket] fix: typo --- htdocs/admin/ticket.php | 16 ++++++++++++++++ htdocs/langs/en_US/ticket.lang | 2 ++ htdocs/langs/fr_FR/ticket.lang | 2 ++ htdocs/ticket/class/ticket.class.php | 6 +++++- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 4a2b2e642df..233b48780c9 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -590,6 +590,22 @@ print $formcategory->textwithpicto('', $langs->trans("TicketsAutoReadTicketHelp" print ''; print ''; +// Auto mark ticket as read when assign someone +print ''.$langs->trans("TicketsAutoReadTicketWhenAssign").''; +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_AUTO_READ_WHEN_ASSIGN'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $formcategory->selectarray("TICKET_AUTO_READ_WHEN_ASSIGN", $arrval, getDolGlobalString('TICKET_AUTO_READ_WHEN_ASSIGN')); +} +print ''; +print ''; +print $formcategory->textwithpicto('', $langs->trans("TicketsAutoReadTicketWhenAssignHelp"), 1, 'help'); +print ''; +print ''; + + // Auto assign ticket to user who created it print ''; print ''; diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 5fa74d1c2d9..454f91bc17f 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -132,6 +132,8 @@ TicketPublicNotificationNewMessageDefaultEmail=Notifications email to (update) TicketPublicNotificationNewMessageDefaultEmailHelp=Send an email to this address for each new message notifications if the ticket doesn't have a user assigned to it or if the user doesn't have any known email. TicketsAutoReadTicket=Automatically mark the ticket as read (when created from back office) TicketsAutoReadTicketHelp=Automatically mark the ticket as read when created from back office. When ticket is create from the public interface, ticket remains with the status "Not Read". +TicketsAutoReadTicketWhenAssign=Automatically mark the ticket as read when assigned +TicketsAutoReadTicketWhenAssignHelp=When a user is assigned to a ticket, the ticket is automatically marked as read. TicketsDelayBeforeFirstAnswer=A new ticket should receive a first answer before (hours): TicketsDelayBeforeFirstAnswerHelp=If a new ticket has not received an answer after this time period (in hours), an important warning icon will be displayed in the list view. TicketsDelayBetweenAnswers=An unresolved ticket should not be unactive during (hours): diff --git a/htdocs/langs/fr_FR/ticket.lang b/htdocs/langs/fr_FR/ticket.lang index 454bdbceafe..6b9f0547e02 100644 --- a/htdocs/langs/fr_FR/ticket.lang +++ b/htdocs/langs/fr_FR/ticket.lang @@ -132,6 +132,8 @@ TicketPublicNotificationNewMessageDefaultEmail=Emails de notifications à (mise TicketPublicNotificationNewMessageDefaultEmailHelp=Envoyez un email à cette adresse email pour chaque nouveau message de notifications si le ticket n'a pas d'utilisateur assigné ou si l'utilisateur n'a pas d'email connu. TicketsAutoReadTicket=Marquer automatiquement le ticket comme "Lu" (en cas de création depuis le back-office) TicketsAutoReadTicketHelp=Les tickets créés depuis le back-office seront automatiquement marqués comme "Lu". Les tickets créés depuis l'interface publique seront créés au statut "Non lu". +TicketsAutoReadTicketWhenAssign=Marquer automatiquement le ticket comme lu lors de l'assignation +TicketsAutoReadTicketWhenAssignHelp=Lorsque qu'un utilisateur est assigné à un ticket, celui-ci est automatiquement marqué comme lu. TicketsDelayBeforeFirstAnswer=Un nouveau ticket devrait recevoir une réponse avant (en heures) : TicketsDelayBeforeFirstAnswerHelp=Si un nouveau ticket n'a pas reçu de réponse dans le délai indiqué ici (en heures), une icône d'alerte est affiché dans la liste. TicketsDelayBetweenAnswers=Un ticket non résolu ne doit pas rester sans actions pendant (en heures) : diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 8be726ba18d..c3f45021e61 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1779,7 +1779,11 @@ class Ticket extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; if ($id_assign_user > 0) { - $sql .= " SET fk_user_assign=".((int) $id_assign_user).", fk_statut = ".Ticket::STATUS_ASSIGNED; + $newstatus = Ticket::STATUS_ASSIGNED; + if (getDolGlobalString('TICKET_AUTO_READ_WHEN_ASSIGN')) { + $newstatus = Ticket::STATUS_READ; + } + $sql .= " SET fk_user_assign=".((int) $id_assign_user).", fk_statut = ".$newstatus; } else { $sql .= " SET fk_user_assign=null, fk_statut = ".Ticket::STATUS_READ; }