diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm b/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm index 73e7b8321..b7fee879c 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm @@ -346,7 +346,7 @@ sub Sql { $self->{Sql} .= ' LIKE '.$value; } elsif ( $term->{op} eq 'NOT LIKE' ) { $self->{Sql} .= ' NOT LIKE '.$value; - } elsif ( $term->{attr} eq 'Tags' and ($term->{op} eq 'LIKE' or $term->{op} eq 'IS') and $term->{val} eq '') { + } elsif ( $term->{attr} eq 'Tags' and ($term->{op} eq 'LIKE' or $term->{op} eq 'IS') and $term->{val} eq 0) { $self->{Sql} .= 'NOT EXISTS (SELECT NULL FROM `Events_Tags` AS ET WHERE ET.EventId = E.Id)'; } else { $self->{Sql} .= ' '.$term->{op}.' '.$value; diff --git a/web/ajax/events.php b/web/ajax/events.php index dadb5963b..e5bf3a120 100644 --- a/web/ajax/events.php +++ b/web/ajax/events.php @@ -46,7 +46,7 @@ if (!empty($_REQUEST['MonitorId'])) { $filter->addTerm(array('cnj'=>'and', 'attr'=>'MonitorId', 'op'=> '=', 'val'=>$_REQUEST['MonitorId'])); } if (!empty($_REQUEST['Tag'])) { - $filter->addTerm(array('cnj'=>'and', 'attr'=>'Tag', 'op'=>'=', 'val'=>'')); + $filter->addTerm(array('cnj'=>'and', 'attr'=>'Tag', 'op'=>'=', 'val'=>$_REQUEST['Tag'])); } // Search contains a user entered string to search on diff --git a/web/includes/Filter.php b/web/includes/Filter.php index fe5b62aca..1eca3402b 100644 --- a/web/includes/Filter.php +++ b/web/includes/Filter.php @@ -924,6 +924,9 @@ class Filter extends ZM_Object { return self::$archiveTypes; } + // + // This displays filters from the filters page. + // public function widget() { $html = '
| '.htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op'], ['class'=>'chosen chosen-full-width']).' | '.PHP_EOL; $options = ['class'=>'chosen chosen-full-width', 'multiple'=>'multiple']; $selected = explode(',', $term['val']); - if (count($selected) == 1 and !$selected[0]) { - $selected = null; - } $html .= ''.htmlSelect("filter[Query][terms][$i][val]", $availableTags, $selected, $options).' | '.PHP_EOL; - // ZM\Debug('$availableTags: '.$availableTags); - // ZM\Debug('$selected: '.$selected); - - + // These echo statements print these variables at the top of the view for debugging. + // echo ''.htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op'], ['class'=>'chosen chosen-full-width']).' | '.PHP_EOL; @@ -1088,6 +1088,9 @@ class Filter extends ZM_Object { return $html; } # end function widget() + // + // This displays filters from the events page. + // public function simple_widget() { $html = '