From 5047c28157fef1581609acd74f2af0db4cebf9dd Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Sat, 31 Oct 2020 11:26:29 -0500 Subject: [PATCH] attempt to fix totalnotfiltered --- web/ajax/events.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/web/ajax/events.php b/web/ajax/events.php index 200416f92..1f8e71f1a 100644 --- a/web/ajax/events.php +++ b/web/ajax/events.php @@ -222,9 +222,14 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim } $data['rows'] = $rows; - # 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 ' .$table. ' AS E'. ($filter->sql() ? ' WHERE '.$filter->sql():''), 'Total'); - #$data['total'] = count($rows); + # 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'); + if ( $search != '' || count($advsearch) ) { + $data['total'] = dbFetchOne('SELECT count(*) AS Total FROM ' .$table. ' AS E'.$where , 'Total', $wherevalues); + } else { + $data['total'] = $data['totalNotFiltered']; + } + return $data; } ?>