added filter for bulk edition and deletion of modules

This commit is contained in:
alejandro-campos 2020-12-01 15:50:52 +01:00
parent 7e2fc669f7
commit bb32f40da9
2 changed files with 10 additions and 4 deletions

View File

@ -86,7 +86,11 @@ function process_manage_delete($module_name, $id_agents, $module_status='all')
if ($selection_delete_mode == 'agents') {
// We are selecting "any" module for the selecteds agents
if (($module_name[0] == '0') and (is_array($module_name)) and (count($module_name) == 1)) {
$filter_for_module_deletion = false;
if ($status_module != -1) {
$filter_for_module_deletion = sprintf('tagente_modulo.id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_estado where estado = %s OR utimestamp=0 )', $status_module);
} else {
$filter_for_module_deletion = false;
}
} else {
$filter_for_module_deletion = sprintf('tagente_modulo.nombre IN ("%s")', implode('","', $module_name));
}

View File

@ -46,11 +46,13 @@ $update = (bool) get_parameter_post('update');
if ($update) {
$agents_ = '';
$module_status = get_parameter('status_module');
if ($selection_mode == 'modules') {
$agents_ = [];
$force = get_parameter('force_type', false);
$module_status = get_parameter('status_module', null);
if ($agents_select == false) {
$agents_select = [];
@ -1860,7 +1862,7 @@ function disabled_status () {
/* ]]> */
</script>
<?php
function process_manage_edit($module_name, $agents_select=null, $module_status=null, $selection_mode='all')
function process_manage_edit($module_name, $agents_select=null, $module_status='-1', $selection_mode='all')
{
if (is_int($module_name) && $module_name < 0) {
ui_print_error_message(__('No modules selected'));
@ -2150,7 +2152,7 @@ function process_manage_edit($module_name, $agents_select=null, $module_status=n
}
foreach ($modules as $module) {
if ($module_status !== null) {
if ($module_status !== '-1') {
if (modules_is_not_init($module['id_agente_modulo']) === true) {
if ($module_status != AGENT_MODULE_STATUS_NO_DATA && $module_status != AGENT_MODULE_STATUS_NOT_INIT) {
continue;