Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into 18.0

This commit is contained in:
Laurent Destailleur (aka Eldy) 2025-02-05 10:59:49 +01:00
commit bfb97edccf

View file

@ -332,7 +332,7 @@ class FormTicket
// 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, 'ifone', 0, 0, 'minwidth200');
print '</td></tr>';
// Group => Category
@ -342,12 +342,12 @@ class FormTicket
$filter = 'public=1';
}
$selected = (GETPOST('category_code') ? GETPOST('category_code') : $this->category_code);
$this->selectGroupTickets($selected, 'category_code', $filter, 2, 1, 0, 0, 'minwidth200');
$this->selectGroupTickets($selected, 'category_code', $filter, 2, 'ifone', 0, 0, 'minwidth200');
print '</td></tr>';
// Severity => Priority
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, 1);
$this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', 2, 'ifone');
print '</td></tr>';
if (!empty($conf->knowledgemanagement->enabled)) {
@ -690,8 +690,8 @@ class FormTicket
* @param string|array $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
@ -715,9 +715,9 @@ class FormTicket
$ticketstat->loadCacheTypesTickets();
print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.($multiselect?'[]':'').'"'.($multiselect?' multiple':'').'>';
if ($empty && !$multiselect) {
print '<option value="">&nbsp;</option>';
print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.($multiselect ? '[]' : '').'"'.($multiselect ? ' multiple' : '').'>';
if ($empty) {
print '<option value="">'.((is_numeric($empty) || $empty == 'ifone') ? '&nbsp;' : $empty).'</option>';
}
if (is_array($ticketstat->cache_types_tickets) && count($ticketstat->cache_types_tickets)) {
@ -755,6 +755,8 @@ class FormTicket
print ' selected="selected"';
} elseif ($arraytypes['use_default'] == "1" && empty($selected) && !$multiselect) {
print ' selected="selected"';
} elseif (count($ticketstat->cache_types_tickets) == 1 && (!$empty || $empty == 'ifone')) { // If only 1 choice, we autoselect it
print ' selected="selected"';
}
print '>';
@ -813,10 +815,10 @@ class FormTicket
$ticketstat = new Ticket($this->db);
$ticketstat->loadCacheCategoriesTickets($publicgroups ? 1 : -1); // get list of active ticket groups
if ($use_multilevel <= 0) {
if ($use_multilevel <= 0) { // Only one combo list to select the group of ticket (default)
print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
if ($empty) {
print '<option value="">&nbsp;</option>';
print '<option value="">'.((is_numeric($empty) || $empty == 'ifone') ? '&nbsp;' : $empty).'</option>';
}
if (is_array($ticketstat->cache_category_tickets) && count($ticketstat->cache_category_tickets)) {
@ -861,9 +863,9 @@ class FormTicket
print ' selected="selected"';
} elseif (isset($selected) && $selected == $id) {
print ' selected="selected"';
} elseif ($arraycategories['use_default'] == "1" && !$selected && !$empty) {
} elseif ($arraycategories['use_default'] == "1" && !$selected && (!$empty || $empty == 'ifone')) {
print ' selected="selected"';
} elseif (count($ticketstat->cache_category_tickets) == 1) {
} elseif (count($ticketstat->cache_category_tickets) == 1 && (!$empty || $empty == 'ifone')) {
print ' selected="selected"';
}
@ -1135,14 +1137,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 = '')
@ -1163,7 +1165,7 @@ class FormTicket
print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
if ($empty) {
print '<option value="">&nbsp;</option>';
print '<option value="">'.((is_numeric($empty) || $empty == 'ifone') ? '&nbsp;' : $empty).'</option>';
}
if (is_array($ticketstat->cache_severity_tickets) && count($ticketstat->cache_severity_tickets)) {
@ -1199,7 +1201,9 @@ class FormTicket
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 || $empty == 'ifone')) {
print ' selected="selected"';
} elseif (count($ticketstat->cache_severity_tickets) == 1 && (!$empty || $empty == 'ifone')) { // If only 1 choice, we autoselect it
print ' selected="selected"';
}