Added option in massive delete alerts to show alerts on disabled modules

Former-commit-id: 2ee8db665f9e3ae657887e61e4b99dccd2e6e3a9
This commit is contained in:
Luis Calvo 2019-04-30 10:29:42 +02:00
parent 5d6bd31786
commit e9e24505fe
2 changed files with 18 additions and 2 deletions

View File

@ -31,6 +31,7 @@ require_once $config['homedir'].'/include/functions_users.php';
if (is_ajax()) {
$get_agents = (bool) get_parameter('get_agents');
$recursion = (int) get_parameter('recursion');
$disabled_modules = (int) get_parameter('disabled_modules');
if ($get_agents) {
$id_group = (int) get_parameter('id_group');
@ -44,12 +45,18 @@ if (is_ajax()) {
$groups = [$id_group];
}
if ($disabled_modules == 0) {
$filter['tagente_modulo.disabled'] = '<> 1';
} else {
unset($filter['tagente_modulo.disabled']);
}
$agents_alerts = [];
foreach ($groups as $group) {
$agents_alerts_one_group = alerts_get_agents_with_alert_template(
$id_alert_template,
$group,
false,
$filter,
[
'tagente.alias',
'tagente.id_agente',
@ -253,6 +260,11 @@ $table->data[1][1] = html_print_select_groups(
'',
$id_alert_template == 0
);
$table->data[0][2] = __('Show alerts on disabled modules');
$table->data[0][3] = html_print_checkbox('disabled_modules', 1, false, true, false);
$table->data[1][2] = __('Group recursion');
$table->data[1][3] = html_print_checkbox('recursion', 1, false, true, false);
@ -360,6 +372,7 @@ $(document).ready (function () {
"get_agents" : 1,
"id_group" : this.value,
"recursion" : $("#checkbox-recursion").is(":checked") ? 1 : 0,
"disabled_modules" : $("#checkbox-disabled_modules").is(":checked") ? 1 : 0,
"id_alert_template" : $("#id_alert_template").val(),
// Add a key prefix to avoid auto sorting in js object conversion
"keys_prefix" : "_"
@ -387,6 +400,10 @@ $(document).ready (function () {
$("#modules_selection_mode").change (function() {
$("#id_agents").trigger('change');
});
$("#checkbox-disabled_modules").click(function () {
$("#id_group").trigger("change");
});
});
/* ]]> */
</script>

View File

@ -1913,7 +1913,6 @@ function alerts_get_agents_with_alert_template($id_alert_template, $id_group, $f
$filter[] = 'tagente_modulo.id_agente_modulo = talert_template_modules.id_agent_module';
$filter[] = 'tagente_modulo.id_agente = tagente.id_agente';
$filter['id_alert_template'] = $id_alert_template;
$filter['tagente_modulo.disabled'] = '<> 1';
$filter['delete_pending'] = '<> 1';
if (empty($id_agents)) {