give the possibility to leave the "Request type", "Ticket categorization" and "Severity" selectors empty

This commit is contained in:
Franck Lauby 2022-07-27 17:03:45 +02:00
parent a514824342
commit 209db182b3
2 changed files with 16 additions and 4 deletions

View File

@ -210,7 +210,7 @@ class FormTicket
// Type
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, 0, 0, 0, 'minwidth200');
$this->selectTypesTickets((GETPOST('type_code', 'alpha') ? GETPOST('type_code', 'alpha') : $this->type_code), 'type_code', '', 2, $conf->global->TICKET_FORCE_DISPLAY_EMPTY_OPTION, 0, 0, 'minwidth200');
print '</td></tr>';
// Group
@ -219,12 +219,12 @@ class FormTicket
if ($public) {
$filter = 'public=1';
}
$this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', $filter, 2, 0, 0, 0, 'minwidth200');
$this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', $filter, 2, $conf->global->TICKET_FORCE_DISPLAY_EMPTY_OPTION, 0, 0, 'minwidth200');
print '</td></tr>';
// Severity
print '<tr><td><span class="fieldrequired"><label for="selectseverity_code">'.$langs->trans("TicketSeverity").'</span></label></td><td>';
$this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', 2, 0);
$this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', 2, $conf->global->TICKET_FORCE_DISPLAY_EMPTY_OPTION);
print '</td></tr>';
// Subject

View File

@ -171,7 +171,19 @@ if (empty($reshook)) {
if (GETPOST('save', 'alpha') && !empty($user->rights->ticket->write)) {
$error = 0;
if (!GETPOST("subject", 'alphanohtml')) {
if (!GETPOST("type_code", 'alpha')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketTypeRequest")), null, 'errors');
$action = 'create';
} elseif (!GETPOST("category_code", 'alpha')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketCategory")), null, 'errors');
$action = 'create';
} elseif (!GETPOST("severity_code", 'alpha')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketSeverity")), null, 'errors');
$action = 'create';
} elseif (!GETPOST("subject", 'alphanohtml')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject")), null, 'errors');
$action = 'create';