Fixed problems with total events in list of events. Ticket: #4243

This commit is contained in:
m-lopez-f 2016-12-13 13:10:28 +01:00
parent 1b166f9701
commit 3ccb068e09
1 changed files with 4 additions and 19 deletions

View File

@ -814,32 +814,17 @@ if ($group_rep == 0) {
$sql = "SELECT COUNT(id_evento) $sql = "SELECT COUNT(id_evento)
FROM $event_table FROM $event_table
WHERE 1=1 $sql_post"; WHERE 1=1 $sql_post";
$total_events = (int) db_get_sql ($sql);
} }
elseif ($group_rep == 1) { elseif ($group_rep == 1) {
switch ($config["dbtype"]) { $total_events = events_get_events_grouped($sql_post, false,
case "mysql": false, $meta, $history, true, false);
case "postgresql":
$sql = "SELECT COUNT(1)
FROM (SELECT 1
FROM $event_table
WHERE 1=1 $sql_post
GROUP BY evento, id_agentmodule) t";
break;
case "oracle":
$sql = "SELECT COUNT(1)
FROM (SELECT 1
FROM $event_table
WHERE 1=1 $sql_post
GROUP BY to_char(evento), id_agentmodule) t";
break;
}
} }
elseif ($group_rep == 2) { elseif ($group_rep == 2) {
$sql = "SELECT COUNT(*) FROM (select id_agente as total from $event_table WHERE id_agente > 0 $sql = "SELECT COUNT(*) FROM (select id_agente as total from $event_table WHERE id_agente > 0
$sql_post GROUP BY id_agente ORDER BY id_agente ) AS t"; $sql_post GROUP BY id_agente ORDER BY id_agente ) AS t";
}
$total_events = (int) db_get_sql ($sql); $total_events = (int) db_get_sql ($sql);
}
if (empty ($result)) { if (empty ($result)) {
$result = array (); $result = array ();