Browse Source

Merge pull request #24131 from MaximilienR-easya/dev_New_Progress_public_interface

NEW added an option to display the progress of tickets on the public interface
Laurent Destailleur 2 years ago
parent
commit
cb2d164c42

+ 14 - 0
htdocs/admin/ticket_public.php

@@ -379,6 +379,20 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
 	print '</td>';
 	print '</tr>';
 
+	// Show progression
+	print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowProgression").'</td>';
+	print '<td class="left">';
+	if (empty(getDolGlobalInt('TICKET_SHOW_PROGRESSION'))) {
+		print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_SHOW_PROGRESSION">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
+	} else {
+		print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_SHOW_PROGRESSION">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
+	}
+	print '</td>';
+	print '<td class="center width75">';
+	print $form->textwithpicto('', $langs->trans("TicketsShowProgressionHelp"), 1, 'help');
+	print '</td>';
+	print '</tr>';
+
 	// Also send to main email address
 	if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
 		print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailAlsoSendToMainAddress").'</td>';

+ 2 - 0
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

+ 8 - 4
htdocs/public/ticket/list.php

@@ -257,6 +257,9 @@ if ($action == "view_ticketlist") {
 			//'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'])) {
 			foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
@@ -340,7 +343,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 '</td>';
 				}
 
-				if (!empty($arrayfields['t.progress']['checked'])) {
+				if ((!empty($conf->global->TICKET_SHOW_PROGRESSION)) && !empty($arrayfields['t.progress']['checked'])) {
 					print '<td class="liste_titre"></td>';
 				}
 
@@ -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 '<td>';
 						print $obj->progress;
 						print '</td>';

+ 5 - 3
htdocs/public/ticket/view.php

@@ -331,9 +331,11 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
 		print '</td></tr>';
 
 		// Progression
-		print '<tr><td>'.$langs->trans("Progression").'</td><td>';
-		print ($object->dao->progress > 0 ? dol_escape_htmltag($object->dao->progress) : '0').'%';
-		print '</td></tr>';
+		if (!empty($conf->global->TICKET_SHOW_PROGRESSION)) {
+			print '<tr><td>'.$langs->trans("Progression").'</td><td>';
+			print ($object->dao->progress > 0 ? dol_escape_htmltag($object->dao->progress) : '0').'%';
+			print '</td></tr>';
+		}
 
 		// Other attributes
 		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';