NobGit
public nobgit read

NobMail

Based on mailcow: dockerized

Languages

Repository composition by tracked source files.

PHP
PHP 49% JavaScript 35% HTML 9% CSS 4% Shell 2% Python 1% Lua 0% Perl 0% Ruby 0% SCSS 0%
Create file Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git

Commit

[Web] fix datatables ssp queries

cc3adbe7
FreddleSpl0it <[email protected]> 2 years, 6 months ago
data/web/inc/lib/ssp.class.php | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Diff

diff --git a/data/web/inc/lib/ssp.class.php b/data/web/inc/lib/ssp.class.php
index 503f9b29..ea6109ac 100644
--- a/data/web/inc/lib/ssp.class.php
+++ b/data/web/inc/lib/ssp.class.php
@@ -291,13 +291,14 @@ class SSP {
 			 FROM `$table` AS `$tablesAS`
 			 $join
 			 $where
+			 GROUP BY `{$tablesAS}`.`{$primaryKey}`
 			 $order
 			 $limit"
 		);
 
 		// Data set length after filtering
 		$resFilterLength = self::sql_exec( $db, $bindings,
-			"SELECT COUNT(`{$tablesAS}`.`{$primaryKey}`)
+			"SELECT COUNT(DISTINCT `{$tablesAS}`.`{$primaryKey}`)
 			 FROM   `$table` AS `$tablesAS`
 			 $join
 			 $where"
@@ -411,12 +412,11 @@ class SSP {
 
 		// Data set length after filtering
 		$resFilterLength = self::sql_exec( $db, $bindings,
-			"SELECT COUNT(`{$tablesAS}`.`{$primaryKey}`)
+			"SELECT COUNT(DISTINCT `{$tablesAS}`.`{$primaryKey}`)
 			 FROM   `$table` AS `$tablesAS`
 			 $join
 			 $join_filter
-			 $where
-			 GROUP BY `{$tablesAS}`.`{$primaryKey}`"
+			 $where"
 		);
 		$recordsFiltered = (isset($resFilterLength[0])) ? $resFilterLength[0][0] : 0;
 
@@ -424,10 +424,9 @@ class SSP {
 		$resTotalLength = self::sql_exec( $db, $bindings,
 			"SELECT COUNT(`{$tablesAS}`.`{$primaryKey}`)
 			 FROM   `$table` AS `$tablesAS`
-      $join
-      $join_filter
-      $where
-      GROUP BY `{$tablesAS}`.`{$primaryKey}`"
+			 $join
+			 $join_filter
+			 $where"
 		);
 		$recordsTotal = (isset($resTotalLength[0])) ? $resTotalLength[0][0] : 0;