diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 12b70731896..3c9651b339d 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -670,23 +670,25 @@ class FormTicket /** * Return html list of tickets type * - * @param string $selected Id du type pre-selectionne - * @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 $noadmininfo 0=Add admin info, 1=Disable admin info - * @param int $maxlength Max length of label - * @param string $morecss More CSS + * @param string|array $selected Id du type pre-selectionne + * @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 $noadmininfo 0=Add admin info, 1=Disable admin info + * @param int $maxlength Max length of label + * @param string $morecss More CSS + * @param int $multiselect Is multiselect ? * @return void */ - public function selectTypesTickets($selected = '', $htmlname = 'tickettype', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '') + public function selectTypesTickets($selected = '', $htmlname = 'tickettype', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '', $multiselect = 0) { global $langs, $user; + $selected = is_array($selected) ? $selected : (!empty($selected) ? implode(',', $selected) : array()); $ticketstat = new Ticket($this->db); - dol_syslog(get_class($this)."::select_types_tickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); + dol_syslog(get_class($this)."::select_types_tickets ".implode(';',$selected).", ".$htmlname.", ".$filtertype.", ".$format.", ".$multiselect, LOG_DEBUG); $filterarray = array(); @@ -696,7 +698,7 @@ class FormTicket $ticketstat->loadCacheTypesTickets(); - print ''; + print ''; if ($empty) { print ' '; } @@ -730,9 +732,9 @@ class FormTicket } // If text is selected, we compare with code, otherwise with id - if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) { + if (in_array($arraytypes['code'], $selected)) { print ' selected="selected"'; - } elseif ($selected == $id) { + } elseif (in_array($id, $selected)) { print ' selected="selected"'; } elseif ($arraytypes['use_default'] == "1" && !$selected && !$empty) { print ' selected="selected"'; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index c989d6f1c4d..e2f4d9c60ba 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -397,6 +397,12 @@ foreach ($search as $key => $val) { $sql .= natural_search($key, $search[$key], 2); } continue; + } elseif ($key == 'type_code') { + $newarrayoftypecodes = is_array($search[$key]) ? $search[$key] : (!empty($search[$key]) ? explode(',', $search[$key]) : array()); + if (count($newarrayoftypecodes)) { + $sql .= natural_search($key, join(',', $newarrayoftypecodes), 3); + } + continue; } $mode_search = ((!empty($object->fields[$key]) && ($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))) ? 1 : 0); @@ -814,7 +820,7 @@ foreach ($object->fields as $key => $val) { print ''; } elseif ($key == 'type_code') { print ''; - $formTicket->selectTypesTickets(dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]), 'search_'.$key.'', '', 2, 1, 1, 0, (!empty($val['css']) ? $val['css'] : 'maxwidth150')); + $formTicket->selectTypesTickets(dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]), 'search_'.$key.'', '', 2, 1, 1, 0, (!empty($val['css']) ? $val['css'] : 'maxwidth150'), 1); print ''; } elseif ($key == 'category_code') { print '';