Skip to content

Commit

Permalink
FIX select on ticket list for fields group and severity (issue #31619)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-Ngr committed Nov 27, 2024
1 parent aa849f5 commit de7edbf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 9 additions & 5 deletions htdocs/core/class/html.formticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,12 @@ function(response) {
if ($public) {
$filter = '(public:=:1)';
}
$this->selectGroupTickets($category_code, 'category_code', $filter, 2, 1, 0, 0, 'minwidth200 maxwidth500');
$this->selectGroupTickets($category_code, 'category_code', $filter, 2, 0, 0, 0, 'minwidth200 maxwidth500');
print '</td></tr>';

// Severity => Priority
print '<tr><td><span class="fieldrequired"><label for="selectseverity_code">'.$langs->trans("TicketSeverity").'</span></label></td><td>';
$this->selectSeveritiesTickets($severity_code, 'severity_code', '', 2, 1, 0, 0, 'minwidth200 maxwidth500');
$this->selectSeveritiesTickets($severity_code, 'severity_code', '', 2, 0, 0, 0, 'minwidth200 maxwidth500');
print '</td></tr>';

if (isModEnabled('knowledgemanagement')) {
Expand Down Expand Up @@ -885,6 +885,8 @@ public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory',
print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
if ($empty) {
print '<option value="">&nbsp;</option>';
} else {
print '<option value="">--&nbsp;'.$langs->trans('TicketSelectGroup').'&nbsp;--</option>';
}

if (is_array($ticketstat->cache_category_tickets) && count($ticketstat->cache_category_tickets)) {
Expand Down Expand Up @@ -929,9 +931,9 @@ public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory',
print ' selected="selected"';
} elseif (isset($selected) && $selected == $id) {
print ' selected="selected"';
} elseif ($arraycategories['use_default'] == "1" && empty($selected)) {
} elseif ($arraycategories['use_default'] == "1" && empty($selected) && !$empty) {
print ' selected="selected"';
} elseif (count($ticketstat->cache_category_tickets) == 1) { // If only 1 choice, we autoselect it
} elseif (count($ticketstat->cache_category_tickets) == 1 && !$empty) { // If only 1 choice, we autoselect it
print ' selected="selected"';
}

Expand Down Expand Up @@ -1238,6 +1240,8 @@ public function selectSeveritiesTickets($selected = '', $htmlname = 'ticketsever
print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
if ($empty) {
print '<option value="">&nbsp;</option>';
} else {
print '<option value="">--&nbsp;'.$langs->trans('TicketSelectGroup').'&nbsp;--</option>';
}

if (is_array($conf->cache['severity_tickets']) && count($conf->cache['severity_tickets'])) {
Expand Down Expand Up @@ -1273,7 +1277,7 @@ public function selectSeveritiesTickets($selected = '', $htmlname = 'ticketsever
print ' selected="selected"';
} elseif (isset($selected) && $selected == $id) {
print ' selected="selected"';
} elseif ($arrayseverities['use_default'] == "1" && empty($selected)) {
} elseif ($arrayseverities['use_default'] == "1" && empty($selected) && !$empty) {
print ' selected="selected"';
}

Expand Down
2 changes: 2 additions & 0 deletions htdocs/langs/en_US/ticket.lang
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ ShowAsConversation=Show as conversation list
MessageListViewType=Show as table list
ConfirmMassTicketClosingSendEmail=Automatically send emails when closing tickets
ConfirmMassTicketClosingSendEmailQuestion=Do you want to notify thirdparties when closing these tickets ?
TicketSelectGroup=Select group
TicketSelectSeverity=Select severity
# Ticket card
Ticket=Ticket
TicketCard=Ticket card
Expand Down

0 comments on commit de7edbf

Please sign in to comment.