From b56ac120931ed46f14617b9c19a7eaf6f229273f Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sat, 30 Nov 2024 14:24:13 +0100 Subject: [PATCH] The $empty param must follow same rules than other select component. --- htdocs/core/class/html.formticket.class.php | 40 +++++++++++---------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 9573e8c5cb6..30664b90218 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -460,7 +460,7 @@ class FormTicket // Type of Ticket print ''; - $this->selectTypesTickets($type_code, 'type_code', '', 2, 1, 0, 0, 'minwidth200 maxwidth500'); + $this->selectTypesTickets($type_code, 'type_code', '', 2, 'ifone', 0, 0, 'minwidth200 maxwidth500'); print ''; // Group => Category @@ -469,12 +469,12 @@ class FormTicket 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, 'ifone', 0, 0, 'minwidth200 maxwidth500'); print ''; // Severity => Priority print ''; - $this->selectSeveritiesTickets($severity_code, 'severity_code', '', 2, 1, 0, 0, 'minwidth200 maxwidth500'); + $this->selectSeveritiesTickets($severity_code, 'severity_code', '', 2, 'ifone', 0, 0, 'minwidth200 maxwidth500'); print ''; if (isModEnabled('knowledgemanagement')) { @@ -869,8 +869,8 @@ class FormTicket * @param string|int[] $selected Id of preselected field or array of Ids * @param string $htmlname Nom de la zone select * @param string $filtertype To filter on field type in llx_c_ticket_type (array('code'=>xx,'label'=>zz)) - * @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code - * @param int $empty 1=peut etre vide, 0 sinon + * @param int $format 0=id+label, 1=code+code, 2=code+label, 3=id+code + * @param int|string $empty 1 = can be empty or 'string' to show the string as the empty value, 0 = can't be empty, 'ifone' = can be empty but autoselected if there is one only * @param int $noadmininfo 0=Add admin info, 1=Disable admin info * @param int $maxlength Max length of label * @param string $morecss More CSS @@ -896,7 +896,7 @@ class FormTicket print ''; if ($empty) { - print ''; + print ''; } if (is_array($ticketstat->cache_category_tickets) && count($ticketstat->cache_category_tickets)) { @@ -1075,7 +1077,7 @@ class FormTicket } print ajax_combobox('select'.$htmlname); - } elseif ($htmlname != '') { + } elseif ($htmlname != '') { // complexe mode using selection of group using a combo for each level (when using a hierarchy of groups). $selectedgroups = array(); $groupvalue = ""; $groupticket = GETPOST($htmlname, 'aZ09'); @@ -1320,14 +1322,14 @@ class FormTicket /** * Return html list of ticket severitys (priorities) * - * @param string $selected Id severity pre-selected - * @param string $htmlname Name of the select area - * @param string $filtertype To filter on field type in llx_c_ticket_severity (array('code'=>xx,'label'=>zz)) - * @param int $format 0 = id+label, 1 = code+code, 2 = code+label, 3 = id+code - * @param int $empty 1 = can be empty, 0 = or not - * @param int $noadmininfo 0 = add admin info, 1 = disable admin info - * @param int $maxlength Max length of label - * @param string $morecss More CSS + * @param string $selected Id severity pre-selected + * @param string $htmlname Name of the select area + * @param string $filtertype To filter on field type in llx_c_ticket_severity (array('code'=>xx,'label'=>zz)) + * @param int $format 0 = id+label, 1 = code+code, 2 = code+label, 3 = id+code + * @param int|string $empty 1 = can be empty or 'string' to show the string as the empty value, 0 = can't be empty, 'ifone' = can be empty but autoselected if there is one only + * @param int $noadmininfo 0 = add admin info, 1 = disable admin info + * @param int $maxlength Max length of label + * @param string $morecss More CSS * @return void */ public function selectSeveritiesTickets($selected = '', $htmlname = 'ticketseverity', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '') @@ -1348,7 +1350,7 @@ class FormTicket print '