From 3c55557c776bde1f93293a9b72f17e22a9755453 Mon Sep 17 00:00:00 2001 From: Isaac Date: Thu, 11 Jan 2018 22:53:53 +0100 Subject: [PATCH] Handle to val in a filter term --- web/includes/functions.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index 7f8b1ea70..87bce296a 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -1198,8 +1198,9 @@ function parseFilter( &$filter, $saveToSession=false, $querySep='&' ) { // Need to specify a storage area, so need to look through other terms looking for a storage area, else we default to ZM_EVENTS_PATH if ( ! $StorageArea ) { for ( $j = 0; $j < count($terms); $j++ ) { - if ( isset($terms[$j]['attr']) and $terms[$j]['attr'] == 'StorageId' ) { - $StorageArea = new Storage( $terms[$j]['val'] ); + if ( isset($terms[$j]['attr']) and $terms[$j]['attr'] == 'StorageId' and isset($terms[$j]['val']) ) { + $StorageArea = new Storage($terms[$j]['val']); + break; } } // end foreach remaining term if ( ! $StorageArea ) $StorageArea = new Storage(); @@ -1211,8 +1212,8 @@ function parseFilter( &$filter, $saveToSession=false, $querySep='&' ) { // Need to specify a storage area, so need to look through other terms looking for a storage area, else we default to ZM_EVENTS_PATH if ( ! $StorageArea ) { for ( $j = $i; $j < count($terms); $j++ ) { - if ( isset($terms[$i]['attr']) and $terms[$i]['attr'] == 'StorageId' ) { - $StorageArea = new Storage( $terms[$i]['val'] ); + if ( isset($terms[$i]['attr']) and $terms[$i]['attr'] == 'StorageId' and isset($terms[$j]['val']) ) { + $StorageArea = new Storage($terms[$i]['val']); } } // end foreach remaining term } // end no StorageArea found yet @@ -1298,8 +1299,10 @@ function parseFilter( &$filter, $saveToSession=false, $querySep='&' ) { $filter['query'] .= $querySep.urlencode("filter[Query][terms][$i][op]").'='.urlencode($terms[$i]['op']); $filter['fields'] .= "\n"; - $filter['query'] .= $querySep.urlencode("filter[Query][terms][$i][val]").'='.urlencode($terms[$i]['val']); - $filter['fields'] .= "\n"; + if ( isset($terms[$i]['val']) ) { + $filter['query'] .= $querySep.urlencode("filter[Query][terms][$i][val]").'='.urlencode($terms[$i]['val']); + $filter['fields'] .= "\n"; + } } // end foreach term if ( isset($terms[$i]['cbr']) ) { $filter['query'] .= $querySep.urlencode("filter[Query][terms][$i][cbr]").'='.urlencode($terms[$i]['cbr']);