Aggiunta ricerche datatables con filtro per simbolo "="
This commit is contained in:
parent
9cd21bee23
commit
d03c2c8aaf
|
@ -174,17 +174,25 @@ class Query
|
||||||
$real_value = trim(str_replace(['<', '>'], ['<', '>'], $value));
|
$real_value = trim(str_replace(['<', '>'], ['<', '>'], $value));
|
||||||
$more = starts_with($real_value, '>=') || starts_with($real_value, '> =') || starts_with($real_value, '>');
|
$more = starts_with($real_value, '>=') || starts_with($real_value, '> =') || starts_with($real_value, '>');
|
||||||
$minus = starts_with($real_value, '<=') || starts_with($real_value, '< =') || starts_with($real_value, '<');
|
$minus = starts_with($real_value, '<=') || starts_with($real_value, '< =') || starts_with($real_value, '<');
|
||||||
|
$equal = starts_with($real_value, '=');
|
||||||
|
|
||||||
if ($minus || $more) {
|
if ($minus || $more || $equal) {
|
||||||
$sign = str_contains($real_value, '=') ? '=' : '';
|
$sign = str_contains($real_value, '=') ? '=' : '';
|
||||||
if ($more) {
|
if ($more) {
|
||||||
$sign = '>'.$sign;
|
$sign = '>'.$sign;
|
||||||
} else {
|
} elseif ($minus) {
|
||||||
$sign = '<'.$sign;
|
$sign = '<'.$sign;
|
||||||
|
} else {
|
||||||
|
$sign = '=';
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = trim(str_replace(['<', '=', '>'], '', $value));
|
$value = trim(str_replace(['<', '=', '>'], '', $value));
|
||||||
$search_filters[] = 'CAST('.$search_query.' AS UNSIGNED) '.$sign.' '.prepare($value);
|
|
||||||
|
if ($more || $minus){
|
||||||
|
$search_filters[] = 'CAST('.$search_query.' AS UNSIGNED) '.$sign.' '.prepare($value);
|
||||||
|
} else {
|
||||||
|
$search_filters[] = $search_query.' = '.prepare($value);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$search_filters[] = $search_query.' LIKE '.prepare('%'.$value.'%');
|
$search_filters[] = $search_query.' LIKE '.prepare('%'.$value.'%');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue