Fixed the data retrieving with oracle databases

This commit is contained in:
Alejandro Gallardo Escobar 2015-05-14 17:57:59 +02:00
parent b00c424af4
commit eb965ff7da
1 changed files with 31 additions and 12 deletions

View File

@ -411,6 +411,10 @@ class Tree {
ta.fired_count, ta.normal_count, ta.warning_count, ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count, ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet'; ta.total_count, ta.quiet';
$group_by_fields = 'ta.id_agente, ta.nombre,
ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$order_fields = 'ta.nombre ASC, ta.id_agente ASC'; $order_fields = 'ta.nombre ASC, ta.id_agente ASC';
$sql = "SELECT $columns $sql = "SELECT $columns
@ -425,6 +429,7 @@ class Tree {
$group_acl $group_acl
$agent_search_filter $agent_search_filter
$agent_status_filter $agent_status_filter
GROUP BY $group_by_fields
ORDER BY $order_fields"; ORDER BY $order_fields";
} }
else { else {
@ -464,7 +469,6 @@ class Tree {
WHERE tam.disabled = 0 WHERE tam.disabled = 0
AND tam.id_agente = $parent AND tam.id_agente = $parent
$module_search_filter $module_search_filter
GROUP BY tam.id_agente_modulo
ORDER BY $order_fields"; ORDER BY $order_fields";
break; break;
} }
@ -523,6 +527,7 @@ class Tree {
} }
$columns = 'tt.id_tag AS id, tt.name AS name'; $columns = 'tt.id_tag AS id, tt.name AS name';
$group_by_fields = 'tt.id_tag, tt.name';
$order_fields = 'tt.name ASC, tt.id_tag ASC'; $order_fields = 'tt.name ASC, tt.id_tag ASC';
// Tags SQL // Tags SQL
@ -543,7 +548,7 @@ class Tree {
$agent_search_filter $agent_search_filter
$agent_status_filter $agent_status_filter
$tag_filter $tag_filter
GROUP BY tt.id_tag GROUP BY $group_by_fields
ORDER BY $order_fields"; ORDER BY $order_fields";
} }
// Counters SQL // Counters SQL
@ -570,6 +575,10 @@ class Tree {
ta.fired_count, ta.normal_count, ta.warning_count, ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count, ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet'; ta.total_count, ta.quiet';
$group_by_fields = 'ta.id_agente, ta.nombre,
ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$order_fields = 'ta.nombre ASC, ta.id_agente ASC'; $order_fields = 'ta.nombre ASC, ta.id_agente ASC';
$sql = "SELECT $columns $sql = "SELECT $columns
@ -586,7 +595,7 @@ class Tree {
$group_acl $group_acl
$agent_search_filter $agent_search_filter
$agent_status_filter $agent_status_filter
GROUP BY ta.id_agente GROUP BY $group_by_fields
ORDER BY $order_fields"; ORDER BY $order_fields";
} }
break; break;
@ -611,7 +620,6 @@ class Tree {
WHERE tam.disabled = 0 WHERE tam.disabled = 0
AND tam.id_agente = $parent AND tam.id_agente = $parent
$module_search_filter $module_search_filter
GROUP BY tam.id_agente_modulo
ORDER BY $order_fields"; ORDER BY $order_fields";
break; break;
} }
@ -632,6 +640,7 @@ class Tree {
case 'os': case 'os':
if (empty($rootID) || $rootID == -1) { if (empty($rootID) || $rootID == -1) {
$columns = 'tos.id_os AS id, tos.name AS name, tos.icon_name AS os_icon'; $columns = 'tos.id_os AS id, tos.name AS name, tos.icon_name AS os_icon';
$group_by_fields = 'tos.id_os, tos.name, tos.icon_name';
$order_fields = 'tos.icon_name ASC, tos.id_os ASC'; $order_fields = 'tos.icon_name ASC, tos.id_os ASC';
// OS SQL // OS SQL
@ -645,7 +654,7 @@ class Tree {
$agent_status_filter $agent_status_filter
$group_acl $group_acl
$modules_join $modules_join
GROUP BY tos.id_os GROUP BY $group_by_fields
ORDER BY $order_fields"; ORDER BY $order_fields";
} }
// Counters SQL // Counters SQL
@ -666,6 +675,10 @@ class Tree {
ta.fired_count, ta.normal_count, ta.warning_count, ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count, ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet'; ta.total_count, ta.quiet';
$group_by_fields = 'ta.id_agente, ta.nombre,
ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$order_fields = 'ta.nombre ASC, ta.id_agente ASC'; $order_fields = 'ta.nombre ASC, ta.id_agente ASC';
$sql = "SELECT $columns $sql = "SELECT $columns
@ -676,7 +689,7 @@ class Tree {
$group_acl $group_acl
$agent_search_filter $agent_search_filter
$agent_status_filter $agent_status_filter
GROUP BY ta.id_agente GROUP BY $group_by_fields
ORDER BY $order_fields"; ORDER BY $order_fields";
} }
break; break;
@ -702,7 +715,6 @@ class Tree {
WHERE tam.disabled = 0 WHERE tam.disabled = 0
$agent_filter $agent_filter
$module_search_filter $module_search_filter
GROUP BY tam.id_agente_modulo
ORDER BY $order_fields"; ORDER BY $order_fields";
break; break;
} }
@ -723,6 +735,7 @@ class Tree {
case 'module_group': case 'module_group':
if (empty($rootID) || $rootID == -1) { if (empty($rootID) || $rootID == -1) {
$columns = 'tmg.id_mg AS id, tmg.name AS name'; $columns = 'tmg.id_mg AS id, tmg.name AS name';
$group_by_fields = 'tmg.id_mg, tmg.name';
$order_fields = 'tmg.name ASC, tmg.id_mg ASC'; $order_fields = 'tmg.name ASC, tmg.id_mg ASC';
// Module groups SQL // Module groups SQL
@ -740,7 +753,7 @@ class Tree {
$group_acl $group_acl
$agent_search_filter $agent_search_filter
$agent_status_filter $agent_status_filter
GROUP BY tmg.id_mg GROUP BY $group_by_fields
ORDER BY $order_fields"; ORDER BY $order_fields";
} }
// Counters SQL // Counters SQL
@ -765,6 +778,10 @@ class Tree {
ta.fired_count, ta.normal_count, ta.warning_count, ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count, ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet'; ta.total_count, ta.quiet';
$group_by_fields = 'ta.id_agente, ta.nombre,
ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$order_fields = 'ta.nombre ASC, ta.id_agente ASC'; $order_fields = 'ta.nombre ASC, ta.id_agente ASC';
$sql = "SELECT $columns $sql = "SELECT $columns
@ -779,7 +796,7 @@ class Tree {
$group_acl $group_acl
$agent_search_filter $agent_search_filter
$agent_status_filter $agent_status_filter
GROUP BY ta.id_agente GROUP BY $group_by_fields
ORDER BY $order_fields"; ORDER BY $order_fields";
} }
break; break;
@ -805,7 +822,6 @@ class Tree {
$agent_filter $agent_filter
$module_group_filter $module_group_filter
$module_search_filter $module_search_filter
GROUP BY tam.id_agente_modulo
ORDER BY $order_fields"; ORDER BY $order_fields";
break; break;
} }
@ -867,6 +883,10 @@ class Tree {
ta.fired_count, ta.normal_count, ta.warning_count, ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count, ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet'; ta.total_count, ta.quiet';
$group_by_fields = 'ta.id_agente, ta.nombre,
ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$order_fields = 'ta.nombre ASC, ta.id_agente ASC'; $order_fields = 'ta.nombre ASC, ta.id_agente ASC';
$symbols = ' !"#$%&\'()*+,./:;<=>?@[\\]^{|}~'; $symbols = ' !"#$%&\'()*+,./:;<=>?@[\\]^{|}~';
@ -891,7 +911,7 @@ class Tree {
$group_acl $group_acl
$agent_search_filter $agent_search_filter
$agent_status_filter $agent_status_filter
GROUP BY ta.id_agente GROUP BY $group_by_fields
ORDER BY $order_fields"; ORDER BY $order_fields";
} }
break; break;
@ -936,7 +956,6 @@ class Tree {
$module_name_filter $module_name_filter
$module_group_filter $module_group_filter
$module_search_filter $module_search_filter
GROUP BY tam.id_agente_modulo
ORDER BY $order_fields"; ORDER BY $order_fields";
break; break;
} }