NEW: Change filter type on tickets list to multiselect
This commit is contained in:
parent
60cf6437e0
commit
4d92bef616
@ -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 '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
|
||||
print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.($multiselect?'[]':'').'"'.($multiselect?' multiple':'').'>';
|
||||
if ($empty) {
|
||||
print '<option value=""> </option>';
|
||||
}
|
||||
@ -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"';
|
||||
|
||||
@ -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 '</td>';
|
||||
} elseif ($key == 'type_code') {
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
$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 '</td>';
|
||||
} elseif ($key == 'category_code') {
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user