diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Event.pm b/scripts/ZoneMinder/lib/ZoneMinder/Event.pm index 8ba3d2098..16a117297 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Event.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Event.pm @@ -367,6 +367,7 @@ sub DiskSpace { my $size = 0; File::Find::find( { wanted=>sub { $size += -f $_ ? -s _ : 0 }, untaint=>1 }, $_[0]->Path() ); $_[0]{DiskSpace} = $size; + Debug("DiskSpace for event $_[0]{Id} Updated to $size bytes"); } } diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm b/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm index 82deff6ff..07dd659cc 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm @@ -259,6 +259,10 @@ sub Sql { $self->{Sql} .= " regexp $value"; } elsif ( $term->{op} eq '!~' ) { $self->{Sql} .= " not regexp $value"; + } elsif ( $term->{op} eq 'IS' ) { + $self->{Sql} .= " IS $value"; + } elsif ( $term->{op} eq 'IS NOT' ) { + $self->{Sql} .= " IS NOT $value"; } elsif ( $term->{op} eq '=[]' ) { $self->{Sql} .= " in (".join( ",", @value_list ).")"; } elsif ( $term->{op} eq '!~' ) { @@ -277,15 +281,15 @@ sub Sql { if ( $self->{AutoMessage} ) { # Include all events, including events that are still ongoing # and have no EndTime yet - $sql .= " and ( ".$self->{Sql}." )"; + $sql .= ' AND ( '.$self->{Sql}.' )'; } else { # Only include closed events (events with valid EndTime) - $sql .= " where not isnull(E.EndTime) and ( ".$self->{Sql}." )"; + $sql .= ' WHERE (E.EndTime IS NOT NULL) AND ( '.$self->{Sql}.' )'; } } my @auto_terms; if ( $self->{AutoArchive} ) { - push @auto_terms, "E.Archived = 0"; + push @auto_terms, 'E.Archived = 0'; } # Don't do this, it prevents re-generation and concatenation. # If the file already exists, then the video won't be re-recreated diff --git a/scripts/zmfilter.pl.in b/scripts/zmfilter.pl.in index d1b4c1766..b52ae90c1 100644 --- a/scripts/zmfilter.pl.in +++ b/scripts/zmfilter.pl.in @@ -251,7 +251,8 @@ sub checkFilter { my $filter = shift; my @Events = $filter->Execute(); - Info( join( "Checking filter '$filter->{Name}'", + Info( join( ' ', + "Checking filter '$filter->{Name}'", ($filter->{AutoDelete}?', delete':''), ($filter->{AutoArchive}?', archive':''), ($filter->{AutoVideo}?', video':''), diff --git a/web/includes/functions.php b/web/includes/functions.php index ab0e1c898..012dc7760 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -1274,6 +1274,10 @@ function parseFilter( &$filter, $saveToSession=false, $querySep='&' ) { case '![]' : $filter['sql'] .= ' not in ('.join( ',', $valueList ).')'; break; + case 'IS' : + $filter['sql'] .= " IS $value"; + case 'IS NOT' : + $filter['sql'] .= " IS NOT $value"; } $filter['query'] .= $querySep.urlencode("filter[Query][terms][$i][op]").'='.urlencode($terms[$i]['op']); diff --git a/web/lang/en_gb.php b/web/lang/en_gb.php index 59b5b8ba3..45132b72f 100644 --- a/web/lang/en_gb.php +++ b/web/lang/en_gb.php @@ -556,6 +556,8 @@ $SLANG = array( 'OpNe' => 'not equal to', 'OpNotIn' => 'not in set', 'OpNotMatches' => 'does not match', + 'OpIs' => 'is', + 'OpIsNot' => 'is not', 'OptionalEncoderParam' => 'Optional Encoder Parameters', 'OptionHelp' => 'Option Help', 'OptionRestartWarning' => 'These changes may not come into effect fully\nwhile the system is running. When you have\nfinished making your changes please ensure that\nyou restart ZoneMinder.', diff --git a/web/skins/classic/views/filter.php b/web/skins/classic/views/filter.php index b62d85d4a..cb7e30087 100644 --- a/web/skins/classic/views/filter.php +++ b/web/skins/classic/views/filter.php @@ -104,6 +104,8 @@ $opTypes = array( '!~' => translate('OpNotMatches'), '=[]' => translate('OpIn'), '![]' => translate('OpNotIn'), + 'IS' => translate('OpIs'), + 'IS NOT' => translate('OpIsNot'), ); $archiveTypes = array(