added an option to controle if we want to show the progress bar in the public interface

This commit is contained in:
Maximilien Rozniecki 2023-03-06 11:43:01 +01:00
parent 381ecbb1fb
commit ba8f91f355
4 changed files with 29 additions and 7 deletions

View File

@ -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>';

View File

@ -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

View File

@ -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 '</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>';

View File

@ -328,9 +328,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>';
}
print '</table>';