Fixed "agents with templates" box in bulk alert actions add. Ticket#3087
This commit is contained in:
parent
3f068fdefa
commit
54e0f25947
|
@ -72,6 +72,9 @@ if (is_ajax ()) {
|
|||
$privilege = (string) get_parameter ('privilege', '');
|
||||
// Is is possible add keys prefix to avoid auto sorting in js object conversion
|
||||
$keys_prefix = (string) get_parameter ('keys_prefix', '');
|
||||
// This attr is for the operation "bulk alert accions add", it controls the query that take the agents
|
||||
// from db
|
||||
$add_alert_bulk_op = get_parameter ('add_alert_bulk_op', false);
|
||||
// Ids of agents to be include in the SQL clause as id_agent IN ()
|
||||
$filter_agents_json = (string) get_parameter ('filter_agents_json', '');
|
||||
$status_agents = (int)get_parameter('status_agents', AGENT_STATUS_ALL);
|
||||
|
@ -113,10 +116,10 @@ if (is_ajax ()) {
|
|||
}
|
||||
|
||||
if ( $id_group == 0 && $privilege != '') {
|
||||
$groups = users_get_groups ($config["id_user"], $privilege, false);
|
||||
// if group ID doesn't matter and $privilege is specified (like 'AW'),
|
||||
// retruns all agents that current user has $privilege privilege for.
|
||||
$agents = agents_get_group_agents(
|
||||
array_keys (users_get_groups ($config["id_user"], $privilege, false)),$filter,"none",false,$recursion);
|
||||
$agents = agents_get_group_agents(array_keys($groups), $filter, "none", false, $recursion, false, '|', $add_alert_bulk_op);
|
||||
}
|
||||
else {
|
||||
$agents = agents_get_group_agents($id_group, $filter, "none",
|
||||
|
|
|
@ -220,6 +220,7 @@ $(document).ready (function () {
|
|||
$("#id_group").pandoraSelectGroupAgent ({
|
||||
agentSelect: "select#id_agents",
|
||||
privilege: "AW",
|
||||
add_alert_bulk_op: true,
|
||||
recursion: function() {return recursion},
|
||||
filter_agents_json: filter_agents_json,
|
||||
callbackPost: function () {
|
||||
|
|
|
@ -805,7 +805,7 @@ function agents_common_modules ($id_agent, $filter = false, $indexed = true, $ge
|
|||
* @return array An array with all agents in the group or an empty array
|
||||
*/
|
||||
function agents_get_group_agents ($id_group = 0, $search = false,
|
||||
$case = "lower", $noACL = false, $childGroups = false, $serialized = false, $separator = '|') {
|
||||
$case = "lower", $noACL = false, $childGroups = false, $serialized = false, $separator = '|', $add_alert_bulk_op = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -902,6 +902,10 @@ function agents_get_group_agents ($id_group = 0, $search = false,
|
|||
unset($search['status']);
|
||||
}
|
||||
|
||||
if (isset($search['id_agente'])) {
|
||||
$filter['id_agente'] = $search['id_agente'];
|
||||
}
|
||||
|
||||
if (is_metaconsole() && isset($search['id_server'])) {
|
||||
$filter['id_tmetaconsole_setup'] = $search['id_server'];
|
||||
|
||||
|
@ -912,12 +916,13 @@ function agents_get_group_agents ($id_group = 0, $search = false,
|
|||
|
||||
unset ($search["id_server"]);
|
||||
}
|
||||
|
||||
if (!$add_alert_bulk_op) {
|
||||
// Add the rest of the filter from the search array
|
||||
foreach ($search as $key => $value) {
|
||||
$filter[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$filter['disabled'] = 0;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
"filter_agents_json" : config.filter_agents_json,
|
||||
"disabled" : config.disabled ? 1 : 0,
|
||||
"status_agents" : config.status_agents,
|
||||
"add_alert_bulk_op" : config.add_alert_bulk_op,
|
||||
"privilege" : config.privilege,
|
||||
// Add a key prefix to avoid auto sorting in js object conversion
|
||||
"keys_prefix" : "_"
|
||||
|
|
Loading…
Reference in New Issue