Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX select on ticket list for fields group and severity (issue #31619) #32122

Open
wants to merge 1 commit into
base: 20.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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