From 6deb40983c922fc0e9e7ece72c06e6e04d2f40c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Fri, 28 Jul 2023 14:29:23 +0200 Subject: [PATCH 1/2] NEW add and list external contributors --- htdocs/langs/en_US/ticket.lang | 3 +++ htdocs/langs/fr_FR/ticket.lang | 3 +++ htdocs/public/ticket/view.php | 39 ++++++++++++++++++++++++++++++++-- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 46bb70ebc40..ed0e893b97c 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -329,6 +329,9 @@ OldUser=Old user NewUser=New user NumberOfTicketsByMonth=Number of tickets per month NbOfTickets=Number of tickets +ExternalContributors=External contributors +AddContributor=Add external contributor + # notifications TicketCloseEmailSubjectCustomer=Ticket closed TicketCloseEmailBodyCustomer=This is an automatic message to notify you that ticket %s has just been closed. diff --git a/htdocs/langs/fr_FR/ticket.lang b/htdocs/langs/fr_FR/ticket.lang index cde34d64c33..cdbf781b28b 100644 --- a/htdocs/langs/fr_FR/ticket.lang +++ b/htdocs/langs/fr_FR/ticket.lang @@ -328,6 +328,9 @@ OldUser=Ancien utilisateur NewUser=Nouvel utilisateur NumberOfTicketsByMonth=Nombre de tickets par mois NbOfTickets=Nombre de tickets +ExternalContributors=Contributeurs externes +AddContributor=Ajouter un contributeur externe + # notifications TicketCloseEmailSubjectCustomer=Billet fermé TicketCloseEmailBodyCustomer=Ceci est un message automatique pour vous avertir que le ticket %s vient d'être clôturé. diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 83c3b991087..ca6f0610cb7 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -1,7 +1,8 @@ * Copyright (C) 2018 Frédéric France - * + * Copyright (C) 2023 Benjamin Falière + * * 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 * the Free Software Foundation; either version 3 of the License, or @@ -93,7 +94,7 @@ if ($cancel) { $action = 'view_ticket'; } -if ($action == "view_ticket" || $action == "presend" || $action == "close" || $action == "confirm_public_close" || $action == "add_message") { +if ($action == "view_ticket" || $action == "presend" || $action == "close" || $action == "confirm_public_close" || $action == "add_message" || $action == "add_contact") { $error = 0; $display_ticket = false; if (!strlen($track_id)) { @@ -190,6 +191,15 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a } } + // Add a new external contributor to a ticket + if (!$error && $action == "add_contact" && $display_ticket && GETPOSTISSET('btn_add_contact')) { + $ret = $object->dao->add_contact(GETPOSTINT('contactid'), 'CONTRIBUTOR'); + + if (!$error) { + $action = 'view_ticket'; + } + } + if ($error || $errors) { setEventMessages($object->error, $object->errors, 'errors'); if ($action == "add_message") { @@ -328,6 +338,31 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a } print ''; + // External contributors + if (!empty($conf->global->TICKET_PUBLIC_DISPLAY_EXTERNAL_CONTRIBUTORS)){ + print ''.$langs->trans("ExternalContributors").''; + if ($object->dao->id > 0) { + $contactlist = $object->dao->liste_contact(-1, 'external'); + foreach($contactlist as $externalContributor) { + print img_picto('', 'contact', 'class="pictofixedwidth"'); + print $externalContributor["lastname"]." ".$externalContributor["firstname"]."
"; + } + } + print ''; + } + + // Add new external contributor + if (!empty($conf->global->TICKET_PUBLIC_SELECT_EXTERNAL_CONTRIBUTORS) && !empty($object->dao->fk_soc)){ + print '
'; + print ''; + print ''; + print ''; + print ''.$langs->trans("AddContributor").''; + print $form->selectcontacts($object->dao->fk_soc, '', 'contactid', 3, '', '', 1, 'minwidth100imp widthcentpercentminusxx maxwidth400'); + print ''; + print '
'; + } + // Progression if (!empty($conf->global->TICKET_SHOW_PROGRESSION)) { print ''.$langs->trans("Progression").''; From 219562b48a780a5d19345ff9dced4c0018c963fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Fri, 4 Aug 2023 16:54:16 +0200 Subject: [PATCH 2/2] Use getDolGlobalInt --- htdocs/public/ticket/view.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index ca6f0610cb7..8f51d623325 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -339,7 +339,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a print ''; // External contributors - if (!empty($conf->global->TICKET_PUBLIC_DISPLAY_EXTERNAL_CONTRIBUTORS)){ + if (getDolGlobalInt('TICKET_PUBLIC_DISPLAY_EXTERNAL_CONTRIBUTORS')){ print ''.$langs->trans("ExternalContributors").''; if ($object->dao->id > 0) { $contactlist = $object->dao->liste_contact(-1, 'external'); @@ -352,7 +352,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a } // Add new external contributor - if (!empty($conf->global->TICKET_PUBLIC_SELECT_EXTERNAL_CONTRIBUTORS) && !empty($object->dao->fk_soc)){ + if (getDolGlobalInt('TICKET_PUBLIC_SELECT_EXTERNAL_CONTRIBUTORS') && !empty($object->dao->fk_soc)){ print '
'; print ''; print '';