mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Fixed secondary groups in alerts details
This commit is contained in:
parent
f7940908c2
commit
5c54afe673
@ -966,12 +966,12 @@ function agents_get_group_agents (
|
|||||||
$filter['order'] = 'alias';
|
$filter['order'] = 'alias';
|
||||||
|
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole()) {
|
||||||
$table_name = 'tmetaconsole_agent LEFT JOIN tmetaconsole_agent_secondary_group ON ta.id_agente = tasg.id_agent';
|
$table_name = 'tmetaconsole_agent ta LEFT JOIN tmetaconsole_agent_secondary_group tasg ON ta.id_agente = tasg.id_agent';
|
||||||
|
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'id_tagente AS id_agente',
|
'ta.id_tagente AS id_agente',
|
||||||
'alias',
|
'alias',
|
||||||
'id_tmetaconsole_setup AS id_server'
|
'ta.id_tmetaconsole_setup AS id_server'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -50,7 +50,10 @@ function alerts_get_alerts($id_group = 0, $free_search = "", $status = "all", $s
|
|||||||
|
|
||||||
$id_groups = array_keys($groups);
|
$id_groups = array_keys($groups);
|
||||||
|
|
||||||
$group_query = " AND t3.id_grupo IN (" . implode(',', $id_groups) . ") ";
|
$group_query = " AND (
|
||||||
|
t3.id_grupo IN (" . implode(',', $id_groups) . ")
|
||||||
|
OR tasg.id_group IN (" . implode(',', $id_groups) . ")
|
||||||
|
)";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$group_query = "";
|
$group_query = "";
|
||||||
@ -1792,9 +1795,12 @@ function get_group_alerts($id_group, $filter = '', $options = false,
|
|||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
WHERE delete_pending = 0
|
WHERE delete_pending = 0
|
||||||
AND id_agente IN (SELECT id_agente
|
AND id_agente IN (SELECT id_agente
|
||||||
FROM tagente
|
FROM tagente ta
|
||||||
|
LEFT JOIN tagent_secondary_group tasg
|
||||||
|
ON ta.id_agente = tasg.id_agent
|
||||||
WHERE
|
WHERE
|
||||||
id_grupo IN (' . implode(',', $id_group) . '))';
|
id_grupo IN (' . implode(',', $id_group) . ')
|
||||||
|
OR id_group IN (' . implode(',', $id_group) . '))';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1861,6 +1867,8 @@ function get_group_alerts($id_group, $filter = '', $options = false,
|
|||||||
ON talert_template_modules.id_agent_module = t2.id_agente_modulo
|
ON talert_template_modules.id_agent_module = t2.id_agente_modulo
|
||||||
INNER JOIN tagente t3
|
INNER JOIN tagente t3
|
||||||
ON t2.id_agente = t3.id_agente
|
ON t2.id_agente = t3.id_agente
|
||||||
|
LEFT JOIN tagent_secondary_group tasg
|
||||||
|
ON tasg.id_agent = t2.id_agente
|
||||||
INNER JOIN talert_templates t4
|
INNER JOIN talert_templates t4
|
||||||
ON talert_template_modules.id_alert_template = t4.id
|
ON talert_template_modules.id_alert_template = t4.id
|
||||||
WHERE id_agent_module in (%s) %s %s %s",
|
WHERE id_agent_module in (%s) %s %s %s",
|
||||||
|
@ -187,77 +187,37 @@ if ($alert_validate) {
|
|||||||
enterprise_hook('open_meta_frame');
|
enterprise_hook('open_meta_frame');
|
||||||
|
|
||||||
if ($free_search != '') {
|
if ($free_search != '') {
|
||||||
switch ($config["dbtype"]) {
|
$whereAlertSimple = 'AND (' .
|
||||||
case "mysql":
|
'id_alert_template IN (
|
||||||
$whereAlertSimple = 'AND (' .
|
SELECT id
|
||||||
'id_alert_template IN (
|
FROM talert_templates
|
||||||
SELECT id
|
WHERE name LIKE "%' . $free_search . '%") OR ' .
|
||||||
FROM talert_templates
|
'id_alert_template IN (
|
||||||
WHERE name LIKE "%' . $free_search . '%") OR ' .
|
SELECT id
|
||||||
'id_alert_template IN (
|
FROM talert_templates
|
||||||
SELECT id
|
WHERE id_alert_action IN (
|
||||||
FROM talert_templates
|
SELECT id
|
||||||
WHERE id_alert_action IN (
|
FROM talert_actions
|
||||||
SELECT id
|
WHERE name LIKE "%' . $free_search . '%")) OR ' .
|
||||||
FROM talert_actions
|
'talert_template_modules.id IN (
|
||||||
WHERE name LIKE "%' . $free_search . '%")) OR ' .
|
SELECT id_alert_template_module
|
||||||
'talert_template_modules.id IN (
|
FROM talert_template_module_actions
|
||||||
SELECT id_alert_template_module
|
WHERE id_alert_action IN (
|
||||||
FROM talert_template_module_actions
|
SELECT id
|
||||||
WHERE id_alert_action IN (
|
FROM talert_actions
|
||||||
SELECT id
|
WHERE name LIKE "%' . $free_search . '%")) OR ' .
|
||||||
FROM talert_actions
|
'id_agent_module IN (
|
||||||
WHERE name LIKE "%' . $free_search . '%")) OR ' .
|
SELECT id_agente_modulo
|
||||||
'id_agent_module IN (
|
FROM tagente_modulo
|
||||||
SELECT id_agente_modulo
|
WHERE nombre LIKE "%' . $free_search . '%") OR ' .
|
||||||
FROM tagente_modulo
|
'id_agent_module IN (
|
||||||
WHERE nombre LIKE "%' . $free_search . '%") OR ' .
|
SELECT id_agente_modulo
|
||||||
'id_agent_module IN (
|
FROM tagente_modulo
|
||||||
SELECT id_agente_modulo
|
WHERE id_agente IN (
|
||||||
FROM tagente_modulo
|
SELECT id_agente
|
||||||
WHERE id_agente IN (
|
FROM tagente
|
||||||
SELECT id_agente
|
WHERE nombre LIKE "%' . $free_search . '%") OR alias LIKE "%' . $free_search . '%")' .
|
||||||
FROM tagente
|
')';
|
||||||
WHERE nombre LIKE "%' . $free_search . '%") OR alias LIKE "%' . $free_search . '%")' .
|
|
||||||
')';
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "postgresql":
|
|
||||||
case "oracle":
|
|
||||||
$whereAlertSimple = 'AND (' .
|
|
||||||
'id_alert_template IN (
|
|
||||||
SELECT id
|
|
||||||
FROM talert_templates
|
|
||||||
WHERE name LIKE \'%' . $free_search . '%\') OR ' .
|
|
||||||
'id_alert_template IN (
|
|
||||||
SELECT id
|
|
||||||
FROM talert_templates
|
|
||||||
WHERE id_alert_action IN (
|
|
||||||
SELECT id
|
|
||||||
FROM talert_actions
|
|
||||||
WHERE name LIKE \'%' . $free_search . '%\')) OR ' .
|
|
||||||
'talert_template_modules.id IN (
|
|
||||||
SELECT id_alert_template_module
|
|
||||||
FROM talert_template_module_actions
|
|
||||||
WHERE id_alert_action IN (
|
|
||||||
SELECT id
|
|
||||||
FROM talert_actions
|
|
||||||
WHERE name LIKE \'%' . $free_search . '%\')) OR ' .
|
|
||||||
'id_agent_module IN (
|
|
||||||
SELECT id_agente_modulo
|
|
||||||
FROM tagente_modulo
|
|
||||||
WHERE nombre LIKE \'%' . $free_search . '%\') OR ' .
|
|
||||||
'id_agent_module IN (
|
|
||||||
SELECT id_agente_modulo
|
|
||||||
FROM tagente_modulo
|
|
||||||
WHERE id_agente IN (
|
|
||||||
SELECT id_agente
|
|
||||||
FROM tagente
|
|
||||||
WHERE nombre LIKE \'%' . $free_search . '%\' OR alias LIKE \'%' . $free_search . '%\'))' .
|
|
||||||
')';
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$whereAlertSimple = '';
|
$whereAlertSimple = '';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user