Skip to content

Commit

Permalink
FIX select type in ticket list (issue #31619
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-Ngr committed Nov 27, 2024
1 parent acdab17 commit 1ff6074
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions htdocs/core/class/html.formticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ function(response) {

// Type of Ticket
print '<tr><td class="titlefield"><span class="fieldrequired"><label for="selecttype_code">'.$langs->trans("TicketTypeRequest").'</span></label></td><td>';
$this->selectTypesTickets((GETPOST('type_code', 'alpha') ? GETPOST('type_code', 'alpha') : $this->type_code), 'type_code', '', 2, 1, 0, 0, 'minwidth200');
$this->selectTypesTickets((GETPOST('type_code', 'alpha') ? GETPOST('type_code', 'alpha') : $this->type_code), 'type_code', '', 2, 0, 0, 0, 'minwidth200');
print '</td></tr>';

// Group => Category
Expand Down Expand Up @@ -718,6 +718,8 @@ public function selectTypesTickets($selected = '', $htmlname = 'tickettype', $fi
print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.($multiselect?'[]':'').'"'.($multiselect?' multiple':'').'>';
if ($empty) {
print '<option value="">&nbsp;</option>';
} else if (!$multiselect) {

Check warning on line 721 in htdocs/core/class/html.formticket.class.php

View workflow job for this annotation

GitHub Actions / pre-commit

Usage of ELSE IF is discouraged; use ELSEIF instead
print '<option value="">--&nbsp;'.$langs->trans('TicketSelectType').'&nbsp;--</option>';
}

if (is_array($ticketstat->cache_types_tickets) && count($ticketstat->cache_types_tickets)) {
Expand Down Expand Up @@ -753,7 +755,7 @@ public function selectTypesTickets($selected = '', $htmlname = 'tickettype', $fi
print ' selected="selected"';
} elseif (in_array($id, $selected)) {
print ' selected="selected"';
} elseif ($arraytypes['use_default'] == "1" && empty($selected)) {
} elseif ($arraytypes['use_default'] == "1" && empty($selected) && !$empty) {
print ' selected="selected"';
}

Expand Down
3 changes: 2 additions & 1 deletion htdocs/langs/en_US/ticket.lang
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ TicketsActivatePublicInterfaceHelp=Public interface allow any visitors to create
TicketsAutoAssignTicket=Automatically assign the user who created the ticket
TicketsAutoAssignTicketHelp=When creating a ticket, the user can be automatically assigned to the ticket.
TicketNumberingModules=Tickets numbering module
TicketsModelModule=Document templates for tickets
TicketsModelModule=Document templates for tickets
TicketNotifyTiersAtCreation=Notify third party at creation
TicketsDisableCustomerEmail=Always disable emails when a ticket is created from public interface
TicketsPublicNotificationNewMessage=Send email(s) when a new message/comment is added to a ticket
Expand All @@ -156,6 +156,7 @@ TicketChooseProductCategory=Product category for ticket support
TicketChooseProductCategoryHelp=Select the product category of ticket support. This will be used to automatically link a contract to a ticket.
TicketUseCaptchaCode=Use graphical code (CAPTCHA) when creating a ticket
TicketUseCaptchaCodeHelp=Adds CAPTCHA verification when creating a new ticket.
TicketSelectType=Select type

#
# Index & list page
Expand Down

0 comments on commit 1ff6074

Please sign in to comment.