Allow null as well as NULL infilter values

This commit is contained in:
Isaac Connor 2021-02-20 12:32:38 -05:00
parent e562888ed0
commit 0fc4b00ac1
1 changed files with 8 additions and 8 deletions

View File

@ -68,7 +68,7 @@ class FilterTerm {
$vals = is_array($this->val) ? $this->val : preg_split('/["\'\s]*?,["\'\s]*?/', preg_replace('/^["\']+?(.+)["\']+?$/', '$1', $this->val));
foreach ( $vals as $value ) {
$value_upper = strtoupper($value);
switch ( $this->attr ) {
case 'AlarmedZoneId':
@ -96,36 +96,36 @@ class FilterTerm {
case 'ServerId':
if ( $value == 'ZM_SERVER_ID' ) {
$value = ZM_SERVER_ID;
} else if ( $value == 'NULL' ) {
} else if ( $value_upper == 'NULL' ) {
} else {
$value = dbEscape($value);
}
break;
case 'StorageId':
if ( $value != 'NULL' ) {
if ( $value_upper != 'NULL' ) {
$value = dbEscape($value);
}
break;
case 'DateTime':
case 'StartDateTime':
case 'EndDateTime':
if ( $value != 'NULL' )
if ( $value_upper != 'NULL' )
$value = '\''.strftime(STRF_FMT_DATETIME_DB, strtotime($value)).'\'';
break;
case 'Date':
case 'StartDate':
case 'EndDate':
if ( $value == 'CURDATE()' or $value == 'NOW()' ) {
if ( $value_upper == 'CURDATE()' or $value_upper == 'NOW()' ) {
$value = 'to_days('.$value.')';
} else if ( $value != 'NULL' ) {
} else if ( $value_upper != 'NULL' ) {
$value = 'to_days(\''.strftime(STRF_FMT_DATETIME_DB, strtotime($value)).'\')';
}
break;
case 'Time':
case 'StartTime':
case 'EndTime':
if ( $value != 'NULL' )
if ( $value_upper != 'NULL' )
$value = 'extract(hour_second from \''.strftime(STRF_FMT_DATETIME_DB, strtotime($value)).'\')';
break;
default :
@ -133,7 +133,7 @@ class FilterTerm {
$value = 1;
} else if ( $value == 'Even' ) {
$value = 0;
} else if ( $value != 'NULL' )
} else if ( $value_upper != 'NULL' )
$value = dbEscape($value);
break;
}