Merge branch 'ent-6253-10593-Cambiar-option-ANY-de-las-bulk-operatiosn-por-ALL' into 'develop'
fixed errors in massive operations See merge request artica/pandorafms!3451
This commit is contained in:
commit
e955bc7b96
|
@ -67,10 +67,30 @@ if ($add) {
|
|||
$modules = get_parameter('module');
|
||||
$modules_id = [];
|
||||
if (!empty($modules)) {
|
||||
$modules_id = [];
|
||||
|
||||
foreach ($modules as $module) {
|
||||
foreach ($id_agents as $id_agent) {
|
||||
$module_id = modules_get_agentmodule_id($module, $id_agent);
|
||||
$modules_id[] = $module_id['id_agente_modulo'];
|
||||
if ($module == '0') {
|
||||
// Get all modules of agent.
|
||||
$agent_modules = db_get_all_rows_filter(
|
||||
'tagente_modulo',
|
||||
['id_agente' => $id_agent],
|
||||
'id_agente_modulo'
|
||||
);
|
||||
|
||||
$agent_modules_id = array_map(
|
||||
function ($field) {
|
||||
return $field['id_agente_modulo'];
|
||||
},
|
||||
$agent_modules
|
||||
);
|
||||
|
||||
$modules_id = array_merge($modules_id, $agent_modules_id);
|
||||
} else {
|
||||
$module_id = modules_get_agentmodule_id($module, $id_agent);
|
||||
$modules_id[] = $module_id['id_agente_modulo'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,15 +106,31 @@ function process_manage_add($id_alert_template, $id_agents, $module_names)
|
|||
return false;
|
||||
}
|
||||
|
||||
$modules_id = [];
|
||||
|
||||
foreach ($module_names as $module) {
|
||||
foreach ($id_agents as $id_agent) {
|
||||
$module_id = modules_get_agentmodule_id($module, $id_agent);
|
||||
$modules_id[] = $module_id['id_agente_modulo'];
|
||||
}
|
||||
}
|
||||
if ($module == '0') {
|
||||
// Get all modules of agent.
|
||||
$agent_modules = db_get_all_rows_filter(
|
||||
'tagente_modulo',
|
||||
['id_agente' => $id_agent],
|
||||
'id_agente_modulo'
|
||||
);
|
||||
|
||||
if (count($module_names) == 1 && $module_names[0] == '0') {
|
||||
$modules_id = agents_common_modules($id_agents, false, true);
|
||||
$agent_modules_id = array_map(
|
||||
function ($field) {
|
||||
return $field['id_agente_modulo'];
|
||||
},
|
||||
$agent_modules
|
||||
);
|
||||
|
||||
$modules_id = array_merge($modules_id, $agent_modules_id);
|
||||
} else {
|
||||
$module_id = modules_get_agentmodule_id($module, $id_agent);
|
||||
$modules_id[] = $module_id['id_agente_modulo'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$conttotal = 0;
|
||||
|
|
|
@ -66,10 +66,29 @@ if ($delete) {
|
|||
$modules = (array) get_parameter('module');
|
||||
$modules_id = [];
|
||||
if (!empty($modules)) {
|
||||
$modules_id = [];
|
||||
foreach ($modules as $module) {
|
||||
foreach ($id_agents as $id_agent) {
|
||||
$module_id = modules_get_agentmodule_id($module, $id_agent);
|
||||
$modules_id[] = $module_id['id_agente_modulo'];
|
||||
if ($module == '0') {
|
||||
// Get all modules of agent.
|
||||
$agent_modules = db_get_all_rows_filter(
|
||||
'tagente_modulo',
|
||||
['id_agente' => $id_agent],
|
||||
'id_agente_modulo'
|
||||
);
|
||||
|
||||
$agent_modules_id = array_map(
|
||||
function ($field) {
|
||||
return $field['id_agente_modulo'];
|
||||
},
|
||||
$agent_modules
|
||||
);
|
||||
|
||||
$modules_id = array_merge($modules_id, $agent_modules_id);
|
||||
} else {
|
||||
$module_id = modules_get_agentmodule_id($module, $id_agent);
|
||||
$modules_id[] = $module_id['id_agente_modulo'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -450,7 +450,7 @@ $table->data['form_modules_2'][1] = html_print_select(
|
|||
'',
|
||||
false,
|
||||
'width:100%'
|
||||
);
|
||||
).' '.__('Select all modules').' '.html_print_checkbox('select_all_modules', 1, false, true, false, '', false, "class='static'");
|
||||
|
||||
$table->data['form_modules_2'][2] = __('When select modules');
|
||||
$table->data['form_modules_2'][2] .= '<br>';
|
||||
|
@ -522,7 +522,8 @@ $table->data['form_agents_3'][1] = html_print_select(
|
|||
'',
|
||||
false,
|
||||
'width:100%'
|
||||
);
|
||||
).' '.__('Select all agents').' '.html_print_checkbox('select_all_agents', 1, false, true, false, '', false, "class='static'");
|
||||
|
||||
$table->data['form_agents_3'][2] = __('When select agents');
|
||||
$table->data['form_agents_3'][2] .= '<br>';
|
||||
$table->data['form_agents_3'][2] .= html_print_select(
|
||||
|
@ -588,6 +589,44 @@ if ($selection_mode == 'modules') {
|
|||
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
|
||||
|
||||
$(document).ready (function () {
|
||||
$("#checkbox-select_all_modules").change(function() {
|
||||
if( $('#checkbox-select_all_modules').prop('checked')) {
|
||||
$("#module_name option").prop('selected', 'selected');
|
||||
$("#module_name").trigger('change');
|
||||
} else {
|
||||
$("#module_name option").prop('selected', false);
|
||||
$("#module_name").trigger('change');
|
||||
}
|
||||
});
|
||||
|
||||
$("#module_name").change(function() {
|
||||
var options_length = $("#module_name option").length;
|
||||
var options_selected_length = $("#module_name option:selected").length;
|
||||
|
||||
if (options_selected_length < options_length) {
|
||||
$('#checkbox-select_all_modules').prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
$("#checkbox-select_all_agents").change(function() {
|
||||
if( $('#checkbox-select_all_agents').prop('checked')) {
|
||||
$("#id_agents option").prop('selected', 'selected');
|
||||
$("#id_agents").trigger('change');
|
||||
} else {
|
||||
$("#id_agents option").prop('selected', false);
|
||||
$("#id_agents").trigger('change');
|
||||
}
|
||||
});
|
||||
|
||||
$("#id_agents").change(function() {
|
||||
var options_length = $("#id_agents option").length;
|
||||
var options_selected_length = $("#id_agents option:selected").length;
|
||||
|
||||
if (options_selected_length < options_length) {
|
||||
$('#checkbox-select_all_agents').prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
$("#id_agents").change(agent_changed_by_multiple_agents);
|
||||
$("#module_name").change(module_changed_by_multiple_modules);
|
||||
|
||||
|
@ -680,7 +719,7 @@ $(document).ready (function () {
|
|||
$('#groups_select').val(-1);
|
||||
}
|
||||
|
||||
$('input[type=checkbox]').change (
|
||||
$('input[type=checkbox]').not(".static").change (
|
||||
function () {
|
||||
if (this.id == "checkbox-force_type") {
|
||||
if (this.checked) {
|
||||
|
|
|
@ -406,7 +406,8 @@ $table->data['form_modules_2'][1] = html_print_select(
|
|||
true,
|
||||
true,
|
||||
true
|
||||
);
|
||||
).' '.__('Select all modules').' '.html_print_checkbox('select_all_modules', 1, false, true, false, '', false, "class='static'");
|
||||
|
||||
$table->data['form_modules_2'][2] = __('When select modules');
|
||||
$table->data['form_modules_2'][2] .= '<br>';
|
||||
$table->data['form_modules_2'][2] .= html_print_select(
|
||||
|
@ -491,7 +492,7 @@ $table->data['form_agents_3'][1] = html_print_select(
|
|||
true,
|
||||
true,
|
||||
false
|
||||
);
|
||||
).' '.__('Select all agents').' '.html_print_checkbox('select_all_agents', 1, false, true, false, '', false, "class='static'");
|
||||
|
||||
$table->data['form_agents_3'][2] = __('When select agents');
|
||||
$table->data['form_agents_3'][2] .= '<br>';
|
||||
|
@ -1212,7 +1213,45 @@ $(document).ready (function () {
|
|||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#checkbox-select_all_modules").change(function() {
|
||||
if( $('#checkbox-select_all_modules').prop('checked')) {
|
||||
$("#module_name option").prop('selected', 'selected');
|
||||
$("#module_name").trigger('change');
|
||||
} else {
|
||||
$("#module_name option").prop('selected', false);
|
||||
$("#module_name").trigger('change');
|
||||
}
|
||||
});
|
||||
|
||||
$("#module_name").change(function() {
|
||||
var options_length = $("#module_name option").length;
|
||||
var options_selected_length = $("#module_name option:selected").length;
|
||||
|
||||
if (options_selected_length < options_length) {
|
||||
$('#checkbox-select_all_modules').prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
$("#checkbox-select_all_agents").change(function() {
|
||||
if( $('#checkbox-select_all_agents').prop('checked')) {
|
||||
$("#id_agents option").prop('selected', 'selected');
|
||||
$("#id_agents").trigger('change');
|
||||
} else {
|
||||
$("#id_agents option").prop('selected', false);
|
||||
$("#id_agents").trigger('change');
|
||||
}
|
||||
});
|
||||
|
||||
$("#id_agents").change(function() {
|
||||
var options_length = $("#id_agents option").length;
|
||||
var options_selected_length = $("#id_agents option:selected").length;
|
||||
|
||||
if (options_selected_length < options_length) {
|
||||
$('#checkbox-select_all_agents').prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
$("#text-custom_ip_target").hide();
|
||||
|
||||
$("#id_agents").change(agent_changed_by_multiple_agents);
|
||||
|
@ -1463,7 +1502,7 @@ $(document).ready (function () {
|
|||
$('#groups_select').val(-1);
|
||||
}
|
||||
|
||||
$('input[type=checkbox]').change (
|
||||
$('input[type=checkbox]').not(".static").change (
|
||||
function () {
|
||||
if (this.id == "checkbox-force_type") {
|
||||
if (this.checked) {
|
||||
|
|
Loading…
Reference in New Issue