diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e057884c1a..7e511e98b6 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2011-03-07 Miguel de Dios + + * include/functions_reporting.php: added the SQL query with correct + date operations for PostgreSQL. + 2011-03-07 Miguel de Dios * include/functions_db.php, godmode/admin_access_logs.php: changes for the diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 4a0562a815..938662befe 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -586,9 +586,18 @@ function get_group_stats ($id_group = 0) { foreach ($id_group as $group){ - $data["agents_unknown"] += get_db_sql ("SELECT COUNT(*) - FROM tagente - WHERE id_grupo = $group AND disabled = 0 AND ultimo_contacto < NOW() - (intervalo * 2)"); + switch ($config["dbtype"]) { + case "mysql": + $data["agents_unknown"] += get_db_sql ("SELECT COUNT(*) + FROM tagente + WHERE id_grupo = $group AND disabled = 0 AND ultimo_contacto < NOW() - (intervalo * 2)"); + break; + case "postgresql": + $data["agents_unknown"] += get_db_sql ("SELECT COUNT(*) + FROM tagente + WHERE id_grupo = $group AND disabled = 0 AND ceil(date_part('epoch', ultimo_contacto)) < ceil(date_part('epoch', NOW())) - (intervalo * 2)"); + break; + } $data["total_agents"] += get_db_sql ("SELECT COUNT(*) FROM tagente WHERE id_grupo = $group AND disabled = 0");