Skip to content

Commit

Permalink
Merge pull request #32131 from frederic34/patch-10
Browse files Browse the repository at this point in the history
backport of PR 32080
  • Loading branch information
eldy authored Dec 5, 2024
2 parents a26eecf + d04b1e5 commit 59642d8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions htdocs/ticket/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@
}

foreach ($search as $key => $val) {
$tmpkey = 't.' . $key;
if ($key == 'fk_statut' && !empty($search['fk_statut'])) {
$newarrayofstatus = array();
foreach ($search['fk_statut'] as $key2 => $val2) {
Expand All @@ -396,26 +397,26 @@
$newarrayofstatus[] = Ticket::STATUS_CANCELED;
}
if (count($newarrayofstatus)) {
$sql .= natural_search($key, join(',', $newarrayofstatus), 2);
$sql .= natural_search($tmpkey, join(',', $newarrayofstatus), 2);
}
continue;
} elseif ($key == 'fk_user_assign' || $key == 'fk_user_create' || $key == 'fk_project') {
if ($search[$key] > 0) {
$sql .= natural_search($key, $search[$key], 2);
$sql .= natural_search($tmpkey, $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);
$sql .= natural_search($tmpkey, join(',', $newarrayoftypecodes), 3);
}
continue;
}

$mode_search = ((!empty($object->fields[$key]) && ($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))) ? 1 : 0);
// $search[$key] can be an array of values, or a string. We add filter if array not empty or if it is a string.
if ((is_array($search[$key]) && !empty($search[$key])) || (!is_array($search[$key]) && $search[$key] != '')) {
$sql .= natural_search($key, $search[$key], $mode_search);
$sql .= natural_search($tmpkey, $search[$key], $mode_search);
}
}
if ($search_all) {
Expand All @@ -425,7 +426,7 @@
$sql .= natural_search('s.nom', $search_societe);
}
if ($search_fk_project > 0) {
$sql .= natural_search('fk_project', $search_fk_project, 2);
$sql .= natural_search('t.fk_project', $search_fk_project, 2);
}
if ($search_date_start) {
$sql .= " AND t.datec >= '".$db->idate($search_date_start)."'";
Expand Down

0 comments on commit 59642d8

Please sign in to comment.