#521 Search Node Date Range not working

This commit is contained in:
Oliver Gorwits
2019-03-02 22:23:39 +00:00
parent a643820a62
commit 7a8bcb094e
2 changed files with 33 additions and 17 deletions

View File

@@ -115,7 +115,7 @@ get '/ajax/content/report/ipinventory' => require_login sub {
)->as_query; )->as_query;
my $rs; my $rs;
if ( $start && $end ) { if ( $start and $end ) {
$start = $start . ' 00:00:00'; $start = $start . ' 00:00:00';
$end = $end . ' 23:59:59'; $end = $end . ' 23:59:59';

View File

@@ -27,35 +27,51 @@ ajax '/ajax/content/search/node' => require_login sub {
my @active = (param('archived') ? () : (-bool => 'active')); my @active = (param('archived') ? () : (-bool => 'active'));
my (@times, @wifitimes, @porttimes); my (@times, @wifitimes, @porttimes);
if ($start and $end) { if ( $start and $end ) {
$start = $start . ' 00:00:00'; $start = $start . ' 00:00:00';
$end = $end . ' 23:59:59'; $end = $end . ' 23:59:59';
if ($agenot) { if ($agenot) {
@times = (-or => [ @times = (-or => [
time_first => [ { '<', $start }, undef ], time_first => [ undef ],
time_last => { '>', $end }, time_last => [ { '<', $start }, { '>', $end } ]
]); ]);
@wifitimes = (-or => [ @wifitimes = (-or => [
time_last => { '<', $start }, time_first => [ undef ],
time_last => { '>', $end }, time_last => [ { '<', $start }, { '>', $end } ]
]); ]);
@porttimes = (-or => [ @porttimes = (-or => [
creation => { '<', $start }, creation => [ undef ],
creation => { '>', $end }, creation => [ { '<', $start }, { '>', $end } ]
]); ]);
} }
else { else {
@times = (-and => [ @times = (-or => [
time_first => { '>=', $start }, -and => [
time_last => { '<=', $end }, time_first => undef,
time_last => undef,
],
-and => [
time_last => { '>=', $start },
time_last => { '<=', $end },
],
]); ]);
@wifitimes = (-and => [ @wifitimes = (-or => [
time_last => { '>=', $start }, -and => [
time_last => { '<=', $end }, time_first => undef,
time_last => undef,
],
-and => [
time_last => { '>=', $start },
time_last => { '<=', $end },
],
]); ]);
@porttimes = (-and => [ @porttimes = (-or => [
creation => { '>=', $start }, creation => undef,
creation => { '<=', $end }, -and => [
creation => { '>=', $start },
creation => { '<=', $end },
],
]); ]);
} }
} }