Merge pull request #3069 from ZoneMinder/iconnor_ajax_event_changes

Join Monitors as M as well in total and totalNotFiltered queries
This commit is contained in:
Andrew Bauer 2020-11-02 15:13:48 -06:00 committed by GitHub
commit 532053888d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -223,9 +223,9 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim
$data['rows'] = $rows; $data['rows'] = $rows;
# totalNotFiltered must equal total, except when either search bar has been used # 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) ) { 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 { } else {
$data['total'] = $data['totalNotFiltered']; $data['total'] = $data['totalNotFiltered'];
} }