#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;
my $rs;
if ( $start && $end ) {
if ( $start and $end ) {
$start = $start . ' 00:00:00';
$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 (@times, @wifitimes, @porttimes);
if ($start and $end) {
if ( $start and $end ) {
$start = $start . ' 00:00:00';
$end = $end . ' 23:59:59';
if ($agenot) {
@times = (-or => [
time_first => [ { '<', $start }, undef ],
time_last => { '>', $end },
time_first => [ undef ],
time_last => [ { '<', $start }, { '>', $end } ]
]);
@wifitimes = (-or => [
time_last => { '<', $start },
time_last => { '>', $end },
time_first => [ undef ],
time_last => [ { '<', $start }, { '>', $end } ]
]);
@porttimes = (-or => [
creation => { '<', $start },
creation => { '>', $end },
creation => [ undef ],
creation => [ { '<', $start }, { '>', $end } ]
]);
}
else {
@times = (-and => [
time_first => { '>=', $start },
time_last => { '<=', $end },
@times = (-or => [
-and => [
time_first => undef,
time_last => undef,
],
-and => [
time_last => { '>=', $start },
time_last => { '<=', $end },
],
]);
@wifitimes = (-and => [
time_last => { '>=', $start },
time_last => { '<=', $end },
@wifitimes = (-or => [
-and => [
time_first => undef,
time_last => undef,
],
-and => [
time_last => { '>=', $start },
time_last => { '<=', $end },
],
]);
@porttimes = (-and => [
creation => { '>=', $start },
creation => { '<=', $end },
@porttimes = (-or => [
creation => undef,
-and => [
creation => { '>=', $start },
creation => { '<=', $end },
],
]);
}
}