fix searching in snapshots

This commit is contained in:
Isaac Connor 2021-03-12 10:52:23 -05:00
parent b50916e02a
commit 62cfdd8d61
1 changed files with 4 additions and 4 deletions

View File

@ -118,7 +118,7 @@ function queryRequest($search, $advsearch, $sort, $offset, $order, $limit) {
$table = 'Snapshots'; $table = 'Snapshots';
// The names of the dB columns in the events table we are interested in // The names of the dB columns in the events table we are interested in
$columns = array('Id', 'Name', 'Description', 'CreatedDateTime'); $columns = array('Id', 'Name', 'Description', 'CreatedOn');
if ( !in_array($sort, array_merge($columns)) ) { if ( !in_array($sort, array_merge($columns)) ) {
ZM\Error('Invalid sort field: ' . $sort); ZM\Error('Invalid sort field: ' . $sort);
@ -154,7 +154,7 @@ function queryRequest($search, $advsearch, $sort, $offset, $order, $limit) {
$search_filter = new ZM\Filter(); $search_filter = new ZM\Filter();
if (count($snapshot_ids)) if (count($snapshot_ids))
$search_filter = $search_filter->addTerm(array('cnj'=>'and', 'attr'=>'Id', 'op'=>'IN', 'val'=>$snapshot_ids)); $search_filter = $search_filter->addTerm(array('cnj'=>'and', 'attr'=>'Id', 'op'=>'IN', 'val'=>$snapshot_ids, 'tablename'=>'Snapshots'));
// There are two search bars in the log view, normal and advanced // There are two search bars in the log view, normal and advanced
// Making an exuctive decision to ignore the normal search, when advanced search is in use // Making an exuctive decision to ignore the normal search, when advanced search is in use
@ -162,7 +162,7 @@ function queryRequest($search, $advsearch, $sort, $offset, $order, $limit) {
if ( count($advsearch) ) { if ( count($advsearch) ) {
$terms = array(); $terms = array();
foreach ( $advsearch as $col=>$text ) { foreach ( $advsearch as $col=>$text ) {
$terms[] = array('cnj'=>'and', 'attr'=>$col, 'op'=>'LIKE', 'val'=>$text); $terms[] = array('cnj'=>'and', 'attr'=>$col, 'op'=>'LIKE', 'val'=>$text, 'tablename'=>'Snapshots');
} # end foreach col in advsearch } # end foreach col in advsearch
$terms[0]['obr'] = 1; $terms[0]['obr'] = 1;
$terms[count($terms)-1]['cbr'] = 1; $terms[count($terms)-1]['cbr'] = 1;
@ -171,7 +171,7 @@ function queryRequest($search, $advsearch, $sort, $offset, $order, $limit) {
$search = '%' .$search. '%'; $search = '%' .$search. '%';
$terms = array(); $terms = array();
foreach ( $columns as $col ) { foreach ( $columns as $col ) {
$terms[] = array('cnj'=>'or', 'attr'=>$col, 'op'=>'LIKE', 'val'=>$search); $terms[] = array('cnj'=>'or', 'attr'=>$col, 'op'=>'LIKE', 'val'=>$search, 'tablename'=>'Snapshots');
} }
$terms[0]['obr'] = 1; $terms[0]['obr'] = 1;
$terms[0]['cnj'] = 'and'; $terms[0]['cnj'] = 'and';