Merge pull request #2726 from externo6/more-filter-options

More filter options
This commit is contained in:
Isaac Connor authored and GitHub committed 2019-10-16 10:15:58 -04:00
commit fdf48c4123
4 files changed
+18

No files matched your search

@@ -236,6 +236,11 @@ sub Sql {
|| $term->{attr} eq 'Cause'
|| $term->{attr} eq 'Notes'
) {
if ( $term->{op} eq 'LIKE'
|| $term->{op} eq 'NOT LIKE'
) {
$temp_value = '%'.$temp_value.'%' if $temp_value !~ /%/;
}
$value = "'$temp_value'";
} elsif ( $term->{attr} eq 'DateTime' or $term->{attr} eq 'StartDateTime' or $term->{attr} eq 'EndDateTime' ) {
if ( $temp_value eq 'NULL' ) {
@@ -295,6 +300,10 @@ sub Sql {
$self->{Sql} .= ' IN ('.join(',', @value_list).')';
} elsif ( $term->{op} eq '!~' ) {
$self->{Sql} .= ' NOT IN ('.join(',', @value_list).')';
} elsif ( $term->{op} eq 'LIKE' ) {
$self->{Sql} .= " LIKE $value";
} elsif ( $term->{op} eq 'NOT LIKE' ) {
$self->{Sql} .= " NOT LIKE $value";
} else {
$self->{Sql} .= ' '.$term->{op}.' '.$value;
}
+5
View File
@@ -1223,6 +1223,9 @@ function parseFilter(&$filter, $saveToSession=false, $querySep='&') {
case 'Name':
case 'Cause':
case 'Notes':
if($term['op'] == 'LIKE' || $term['op'] == 'NOT LIKE') {
$value = '%'.$value.'%';
}
$value = dbEscape($value);
break;
case 'MonitorServerId':
@@ -1275,6 +1278,8 @@ function parseFilter(&$filter, $saveToSession=false, $querySep='&') {
case '>' :
case '<' :
case '<=' :
case 'LIKE' :
case 'NOT LIKE':
$filter['sql'] .= ' '.$term['op'].' '. $value;
break;
case '=~' :
+2
View File
@@ -579,6 +579,8 @@ $SLANG = array(
'OpNotMatches' => 'does not match',
'OpIs' => 'is',
'OpIsNot' => 'is not',
'OpLike' => 'Contains',
'OpNotLike' => 'Does not Contain',
'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.',
+2
View File
@@ -115,6 +115,8 @@ $opTypes = array(
'![]' => translate('OpNotIn'),
'IS' => translate('OpIs'),
'IS NOT' => translate('OpIsNot'),
'LIKE' => translate('OpLike'),
'NOT LIKE' => translate('OpNotLike'),
);
$archiveTypes = array(