From ba8f91f3557ae9a7b41aedf70ea96c82743ce3fb Mon Sep 17 00:00:00 2001 From: Maximilien Rozniecki Date: Mon, 6 Mar 2023 11:43:01 +0100 Subject: [PATCH 1/2] added an option to controle if we want to show the progress bar in the public interface --- htdocs/admin/ticket_public.php | 14 ++++++++++++++ htdocs/langs/en_US/ticket.lang | 2 ++ htdocs/public/ticket/list.php | 12 ++++++++---- htdocs/public/ticket/view.php | 8 +++++--- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index a1bf95d819f..1d6a83fa5f0 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -379,6 +379,20 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print ''; print ''; + // Show progression + print ''.$langs->trans("TicketsShowProgression").''; + print ''; + if (empty(getDolGlobalInt('TICKET_SHOW_PROGRESSION'))) { + print '' . img_picto($langs->trans('Disabled'), 'switch_off') . ''; + } else { + print '' . img_picto($langs->trans('Enabled'), 'switch_on') . ''; + } + print ''; + print ''; + print $form->textwithpicto('', $langs->trans("TicketsShowProgressionHelp"), 1, 'help'); + print ''; + print ''; + // Also send to main email address if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { print ''.$langs->trans("TicketsEmailAlsoSendToMainAddress").''; diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 570e7c127aa..cb261bbc378 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -103,6 +103,8 @@ TicketNewEmailBodyHelp=The text specified here will be inserted into the email c TicketParamPublicInterface=Public interface setup TicketsEmailMustExist=Require an existing email address to create a ticket TicketsEmailMustExistHelp=In the public interface, the email address should already be filled in the database to create a new ticket. +TicketsShowProgression=Display the ticket progress in the public interface +TicketsShowProgressionHelp=Enable this option to hide the progress of the ticket in the public interface pages TicketCreateThirdPartyWithContactIfNotExist=Ask name and company name for unknown emails. TicketCreateThirdPartyWithContactIfNotExistHelp=Check if a thirdparty or a contact exists for the email entered. If not, ask a name and a company name to create a third party with contact. PublicInterface=Public interface diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index aafea0365e0..7fdefb5b7fb 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -257,6 +257,9 @@ if ($action == "view_ticketlist") { //'t.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => 0, 'position' => 2) //'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); + + if (empty($conf->global->TICKET_SHOW_PROGRESSION)) + unset($arrayfields['t.progress']); // Extra fields if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { @@ -341,7 +344,8 @@ if ($action == "view_ticketlist") { $sql .= " t.message,"; $sql .= " t.fk_statut,"; $sql .= " t.resolution,"; - $sql .= " t.progress,"; + if (!empty($conf->global->TICKET_SHOW_PROGRESSION)) + $sql .= " t.progress,"; $sql .= " t.timing,"; $sql .= " t.type_code,"; $sql .= " t.category_code,"; @@ -470,7 +474,7 @@ if ($action == "view_ticketlist") { print ''; } - if (!empty($arrayfields['t.progress']['checked'])) { + if ((!empty($conf->global->TICKET_SHOW_PROGRESSION)) && !empty($arrayfields['t.progress']['checked'])) { print ''; } @@ -535,7 +539,7 @@ if ($action == "view_ticketlist") { if (!empty($arrayfields['severity.code']['checked'])) { print_liste_field_titre($arrayfields['severity.code']['label'], $url_page_current, 'severity.code', '', $param, '', $sortfield, $sortorder); } - if (!empty($arrayfields['t.progress']['checked'])) { + if ((!empty($conf->global->TICKET_SHOW_PROGRESSION)) && !empty($arrayfields['t.progress']['checked'])) { print_liste_field_titre($arrayfields['t.progress']['label'], $url_page_current, 't.progress', '', $param, '', $sortfield, $sortorder); } if (!empty($arrayfields['t.fk_user_create']['checked'])) { @@ -627,7 +631,7 @@ if ($action == "view_ticketlist") { } // Progression - if (!empty($arrayfields['t.progress']['checked'])) { + if ((!empty($conf->global->TICKET_SHOW_PROGRESSION)) && !empty($arrayfields['t.progress']['checked'])) { print ''; print $obj->progress; print ''; diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 1bfc235ff65..ccb5c9ad840 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -328,9 +328,11 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a print ''; // Progression - print ''.$langs->trans("Progression").''; - print ($object->dao->progress > 0 ? dol_escape_htmltag($object->dao->progress) : '0').'%'; - print ''; + if (!empty($conf->global->TICKET_SHOW_PROGRESSION)) { + print ''.$langs->trans("Progression").''; + print ($object->dao->progress > 0 ? dol_escape_htmltag($object->dao->progress) : '0').'%'; + print ''; + } print ''; From 6eb93fdc556a0a1c541883cf51ffd86e037de08e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 6 Mar 2023 10:49:44 +0000 Subject: [PATCH 2/2] Fixing style errors. --- htdocs/public/ticket/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 7fdefb5b7fb..3502da74555 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -257,7 +257,7 @@ if ($action == "view_ticketlist") { //'t.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => 0, 'position' => 2) //'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); - + if (empty($conf->global->TICKET_SHOW_PROGRESSION)) unset($arrayfields['t.progress']);