2011-03-07 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_reporting.php: added the SQL query with correct
	date operations for PostgreSQL.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4065 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-03-07 18:24:15 +00:00
parent f8cf58d769
commit 5dff4cd13a
2 changed files with 17 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php: added the SQL query with correct
date operations for PostgreSQL.
2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_db.php, godmode/admin_access_logs.php: changes for the

View File

@ -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");