diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 223740efc64..ff815e738fc 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -321,7 +321,8 @@ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&con if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); foreach($search as $key => $val) { - $param.= '&search_'.$key.'='.urlencode($search[$key]); + if (is_array($search[$key]) && count($search[$key])) foreach($search[$key] as $skey) $param.='&search_'.$key.'[]='.urlencode($skey); + else $param.= '&search_'.$key.'='.urlencode($search[$key]); } if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); // Add $param from extra fields diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index db4bd33b2d4..a73ff210f4e 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1031,6 +1031,8 @@ class Ticket extends CommonObject { print Form::selectarray('search_fk_statut', $this->statuts_short, $selected, $show_empty = 1, $key_in_label = 0, $value_as_key = 0, $option = '', $translate = 1, $maxlen = 0, $disabled = 0, $sort = '', $morecss = ''); } + + /** * Charge dans cache la liste des types de tickets (paramétrable dans dictionnaire) * diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 2c16e4508f1..81f4678eb89 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -54,7 +54,7 @@ $socid = GETPOST('socid', 'int'); $projectid = GETPOST('projectid', 'int'); $search_fk_soc=GETPOST('$search_fk_soc', 'int')?GETPOST('$search_fk_soc', 'int'):GETPOST('socid', 'int'); $search_fk_project=GETPOST('search_fk_project', 'int')?GETPOST('search_fk_project', 'int'):GETPOST('projectid', 'int'); -$search_fk_status = GETPOST('search_fk_status', 'alpha'); +$search_fk_status = GETPOST('search_fk_statut', 'array'); $mode = GETPOST('mode', 'alpha'); // Load variable for pagination @@ -213,8 +213,13 @@ if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity( else $sql.=" WHERE 1 = 1"; foreach($search as $key => $val) { - if ($key == 'fk_statut' && $search[$key] == -1) continue; - $mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))?1:0); + if ($key == 'fk_statut') + { + if ($search_fk_status == 'non_closed') $sql.= " AND ".$key." IN (0, 1, 3, 4, 5, 6)"; + elseif (is_array($search[$key]) && count($search[$key])) $sql.=natural_search($key, join(',', $search[$key]), 2); + continue; + } + $mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))?1:0); if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'fk_statut')?2:$mode_search)); } if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); @@ -224,11 +229,6 @@ if (!$user->societe_id && ($mode == "my_assign" || (!$user->admin && $conf->glob $sql.= " AND t.fk_user_assign=".$user->id; } -if (isset($search_fk_status) && $search_fk_status == 'non_closed') { - //$search['fk_statut'] = '0,1'; // - $sql.= " AND t.fk_statut IN (0, 1, 3, 4, 5, 6)"; -} - // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks @@ -420,7 +420,8 @@ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&con if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); foreach($search as $key => $val) { - $param.= '&search_'.$key.'='.urlencode($search[$key]); + if (is_array($search[$key]) && count($search[$key])) foreach($search[$key] as $skey) $param.='&search_'.$key.'[]='.urlencode($skey); + else $param.= '&search_'.$key.'='.urlencode($search[$key]); } if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); // Add $param from extra fields @@ -536,7 +537,7 @@ foreach($object->fields as $key => $val) print ''; } elseif ($key == 'fk_statut') { print '