mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-12 07:06:57 -04:00
cleanup my totalNotFiltered code. Join Monitors as well as they can be referenced by the filter
This commit is contained in:
1 parent
492e65c2fd
commit
7650e0bf51
1 file changed
+3
-6
+3
-6
@@ -181,8 +181,6 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim
|
||||
if ( $where )
|
||||
$where = ' WHERE '.$where;
|
||||
|
||||
# total has to be the # of available rows. Not sure what totalNotFiltered is actually used for yet.
|
||||
$data['totalNotFiltered'] = $data['total'] = dbFetchOne('SELECT count(*) AS Total FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id'. $where, 'Total', $query['values']);
|
||||
|
||||
$sort = $sort == 'Monitor' ? 'M.Name' : 'E.'.$sort;
|
||||
$col_str = 'E.*, M.Name AS Monitor';
|
||||
@@ -229,15 +227,14 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim
|
||||
}
|
||||
$data['rows'] = $rows;
|
||||
|
||||
if ( 0 ) {
|
||||
# totalNotFiltered must equal total, except when either search bar has been used
|
||||
$data['totalNotFiltered'] = dbFetchOne('SELECT count(*) AS Total FROM ' .$table. ' AS E'. ($filter->sql() ? ' WHERE '.$filter->sql():''), 'Total');
|
||||
$data['totalNotFiltered'] = dbFetchOne(
|
||||
'SELECT count(*) AS Total FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id'. ($filter->sql() ? ' WHERE '.$filter->sql():''), 'Total');
|
||||
if ( $search != '' || count($advsearch) ) {
|
||||
$data['total'] = dbFetchOne('SELECT count(*) AS Total FROM ' .$table. ' AS E'.$where , 'Total', $wherevalues);
|
||||
$data['total'] = dbFetchOne('SELECT count(*) AS Total FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id'.$where , 'Total', $wherevalues);
|
||||
} else {
|
||||
$data['total'] = $data['totalNotFiltered'];
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
?>
|
||||
Reference in new issue
Block a user