Handle to val in a filter term

This commit is contained in:
Isaac 2018-01-11 22:53:53 +01:00
parent 12d310a9cb
commit 3c55557c77
1 changed files with 9 additions and 6 deletions

View File

@ -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 // 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 ) { if ( ! $StorageArea ) {
for ( $j = 0; $j < count($terms); $j++ ) { for ( $j = 0; $j < count($terms); $j++ ) {
if ( isset($terms[$j]['attr']) and $terms[$j]['attr'] == 'StorageId' ) { if ( isset($terms[$j]['attr']) and $terms[$j]['attr'] == 'StorageId' and isset($terms[$j]['val']) ) {
$StorageArea = new Storage( $terms[$j]['val'] ); $StorageArea = new Storage($terms[$j]['val']);
break;
} }
} // end foreach remaining term } // end foreach remaining term
if ( ! $StorageArea ) $StorageArea = new Storage(); if ( ! $StorageArea ) $StorageArea = new Storage();
@ -1211,8 +1212,8 @@ function parseFilter( &$filter, $saveToSession=false, $querySep='&amp;' ) {
// 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 // 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 ) { if ( ! $StorageArea ) {
for ( $j = $i; $j < count($terms); $j++ ) { for ( $j = $i; $j < count($terms); $j++ ) {
if ( isset($terms[$i]['attr']) and $terms[$i]['attr'] == 'StorageId' ) { if ( isset($terms[$i]['attr']) and $terms[$i]['attr'] == 'StorageId' and isset($terms[$j]['val']) ) {
$StorageArea = new Storage( $terms[$i]['val'] ); $StorageArea = new Storage($terms[$i]['val']);
} }
} // end foreach remaining term } // end foreach remaining term
} // end no StorageArea found yet } // end no StorageArea found yet
@ -1298,8 +1299,10 @@ function parseFilter( &$filter, $saveToSession=false, $querySep='&amp;' ) {
$filter['query'] .= $querySep.urlencode("filter[Query][terms][$i][op]").'='.urlencode($terms[$i]['op']); $filter['query'] .= $querySep.urlencode("filter[Query][terms][$i][op]").'='.urlencode($terms[$i]['op']);
$filter['fields'] .= "<input type=\"hidden\" name=\"filter[Query][terms][$i][op]\" value=\"".htmlspecialchars($terms[$i]['op'])."\"/>\n"; $filter['fields'] .= "<input type=\"hidden\" name=\"filter[Query][terms][$i][op]\" value=\"".htmlspecialchars($terms[$i]['op'])."\"/>\n";
$filter['query'] .= $querySep.urlencode("filter[Query][terms][$i][val]").'='.urlencode($terms[$i]['val']); if ( isset($terms[$i]['val']) ) {
$filter['fields'] .= "<input type=\"hidden\" name=\"filter[Query][terms][$i][val]\" value=\"".htmlspecialchars($terms[$i]['val'])."\"/>\n"; $filter['query'] .= $querySep.urlencode("filter[Query][terms][$i][val]").'='.urlencode($terms[$i]['val']);
$filter['fields'] .= "<input type=\"hidden\" name=\"filter[Query][terms][$i][val]\" value=\"".htmlspecialchars($terms[$i]['val'])."\"/>\n";
}
} // end foreach term } // end foreach term
if ( isset($terms[$i]['cbr']) ) { if ( isset($terms[$i]['cbr']) ) {
$filter['query'] .= $querySep.urlencode("filter[Query][terms][$i][cbr]").'='.urlencode($terms[$i]['cbr']); $filter['query'] .= $querySep.urlencode("filter[Query][terms][$i][cbr]").'='.urlencode($terms[$i]['cbr']);