From 39bd5dd6dce2b5eb8e380c6ce7724a107411515f Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 3 Feb 2022 12:08:39 +0100 Subject: [PATCH 1/4] ticket config : add TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND option to config panel --- htdocs/admin/ticket.php | 27 ++++++++++++++++++++++++--- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/en_US/ticket.lang | 3 +++ htdocs/langs/fr_FR/main.lang | 1 + htdocs/langs/fr_FR/ticket.lang | 3 +++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index f4e5b4f3fad..1805f5de34d 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -178,8 +178,14 @@ if ($action == 'setvarother') { $error++; } - $param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity); + $param_auto_assign = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_assign, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + $param_auto_read = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_read, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; } @@ -470,7 +476,7 @@ if (!$conf->use_javascript_ajax) { print ''; } -print load_fiche_titre($langs->trans("Other"), '', ''); +print load_fiche_titre($langs->trans("Workflow"), '', ''); print ''; print ''; @@ -479,6 +485,21 @@ print ''; print ''; print "\n"; +// Auto mark ticket read when created from backoffice +print ''; +print ''; +print ''; +print ''; + // Auto assign ticket at user who created it print ''; print '
'.$langs->trans("TicketsAutoReadTicket").''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND", $arrval, $conf->global->TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND); +} +print ''; +print $form->textwithpicto('', $langs->trans("TicketsAutoReadTicketHelp"), 1, 'help'); +print '
'.$langs->trans("TicketsAutoAssignTicket").''; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 2d850927782..2867c7b853b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -517,6 +517,7 @@ or=or Other=Other Others=Others OtherInformations=Other information +Workflow=Workflow Quantity=Quantity Qty=Qty ChangedBy=Changed by diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index d38358eb74d..222efad8ba2 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -136,6 +136,9 @@ TicketsPublicNotificationNewMessage=Send email(s) when a new message/comment is TicketsPublicNotificationNewMessageHelp=Send email(s) when a new message is added from public interface (to assigned user or the notifications email to (update) and/or the notifications email to) 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 +TicketsAutoReadTicketHelp=Automatically mark the ticket as read when created from backoffice. + # # Index & list page # diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 63c5192a01f..12778f337dd 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -517,6 +517,7 @@ or=ou Other=Autre Others=Autres OtherInformations=Autre information +Workflow=Processus de travail Quantity=Quantité Qty=Qté ChangedBy=Modifié par diff --git a/htdocs/langs/fr_FR/ticket.lang b/htdocs/langs/fr_FR/ticket.lang index 91850194533..bc51a7627fd 100644 --- a/htdocs/langs/fr_FR/ticket.lang +++ b/htdocs/langs/fr_FR/ticket.lang @@ -136,6 +136,9 @@ TicketsPublicNotificationNewMessage=Envoyer un ou des emails lorsqu’un nouveau TicketsPublicNotificationNewMessageHelp=Envoyer un (des) courriel(s) lorsqu’un nouveau message est ajouté à partir de l’interface publique (à l’utilisateur désigné ou au courriel de notification (mise à jour) et/ou au courriel de notification) TicketPublicNotificationNewMessageDefaultEmail=Emails de notifications à (mise à jour) 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=Automatiquement marquer le ticket comme lu +TicketsAutoReadTicketHelp=Automatiquement marquer le ticket comme lu s'il est créé depuis le backoffice. + # # Index & list page # From c5d1310373a4a7f41806a412c66986a6e3cc84b3 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 3 Feb 2022 12:23:58 +0100 Subject: [PATCH 2/4] handle workflow constants in appropriate category --- htdocs/admin/ticket.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 1805f5de34d..e6a6208324e 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -143,6 +143,20 @@ if ($action == 'updateMask') { } } +if ($action == 'setvarworkflow') { + $param_auto_read = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_read, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + $param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } +} + if ($action == 'setvarother') { $param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha'); $res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity); @@ -177,18 +191,6 @@ if ($action == 'setvarother') { if (!($res > 0)) { $error++; } - - $param_auto_assign = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_assign, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } - - $param_auto_read = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_read, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } } @@ -473,7 +475,7 @@ print '
'; if (!$conf->use_javascript_ajax) { print '
'; print ''; - print ''; + print ''; } print load_fiche_titre($langs->trans("Workflow"), '', ''); From 4c5ddcf0300a59b1b50f388299e73d3014ce3f88 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 10 Feb 2022 17:57:28 +0100 Subject: [PATCH 3/4] ticket config: add constant TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND to admin panel --- htdocs/core/modules/modTicket.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 01561b40b01..6091a245bfa 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -106,7 +106,8 @@ class modTicket extends DolibarrModules $this->const = array( 1 => array('TICKET_ENABLE_PUBLIC_INTERFACE', 'chaine', '0', 'Enable ticket public interface', 0), 2 => array('TICKET_ADDON', 'chaine', 'mod_ticket_simple', 'Ticket ref module', 0), - 3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0) + 3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0), + 4 => array('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'chaine', 0, 'Automatically mark ticket as read when created from backend', 0) ); From 39bb854ef877d29e814a42b73899841e90851c0b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 19:57:45 +0100 Subject: [PATCH 4/4] Update ticket.php --- htdocs/admin/ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index e6a6208324e..fc8a5e8e0b9 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -478,7 +478,7 @@ if (!$conf->use_javascript_ajax) { print ''; } -print load_fiche_titre($langs->trans("Workflow"), '', ''); +print load_fiche_titre($langs->trans("Other"), '', ''); print ''; print '';