mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-01-29 15:09:26 +01:00
Fix ricerca colonne per data e numero
This commit is contained in:
parent
48319fe974
commit
2b733bd440
@ -212,11 +212,14 @@ class Query
|
||||
|
||||
$value = trim(str_replace(['<', '>'], '', $value));
|
||||
|
||||
if ($more || $minus) {
|
||||
[$giorno, $mese, $anno] = explode('/', $value);
|
||||
$data = "'".$anno.'-'.$mese.'-'.$giorno."'";
|
||||
if ($data != "'1970-01-01'") {
|
||||
$search_filters[] = $search_query.' '.$sign.' '.$data.'';
|
||||
if ($minus || $more) {
|
||||
// Se il filtro contiene una data, la converto in formato YYYY-MM-DD per la query
|
||||
if (preg_match('/^(\d{2})\/(\d{2})\/(\d{4})$/', $value, $m)) {
|
||||
$giorno = $m[1];
|
||||
$mese = $m[2];
|
||||
$anno = $m[3];
|
||||
$data = "'".$anno.'-'.$mese.'-'.$giorno."'";
|
||||
$search_filters[] = $search_query.' '.$sign.' '.$data;
|
||||
} else {
|
||||
$search_filters[] = 'CAST('.$search_query.' AS UNSIGNED) '.$sign.' '.prepare($value);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user