fixed bug in modules massive deletion to avoid deletion of modules with the same name in distinct agents regardless of their status when module status filter has been applied

This commit is contained in:
alejandro-campos 2018-07-24 13:04:31 +02:00
parent 99773177dd
commit e4b74cffc8

View File

@ -52,6 +52,8 @@ function process_manage_delete ($module_name, $id_agents, $module_status = 'all'
global $config; global $config;
$status_module = (int) get_parameter ('status_module');
if (empty ($module_name)) { if (empty ($module_name)) {
ui_print_error_message(__('No module selected')); ui_print_error_message(__('No module selected'));
return false; return false;
@ -212,8 +214,10 @@ function process_manage_delete ($module_name, $id_agents, $module_status = 'all'
} }
} }
else { else {
$modules = agents_get_modules ($id_agents, 'id_agente_modulo', if ($status_module != -1) // If module status filter has been applied
sprintf('nombre IN ("%s")', implode('","',$module_name)), true); $modules = agents_get_modules ($id_agents, 'id_agente_modulo', sprintf('nombre IN ("%s") AND id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_estado where estado = %s OR utimestamp=0 )', implode('","',$module_name), $status_module), true);
else
$modules = agents_get_modules ($id_agents, 'id_agente_modulo', sprintf('nombre IN ("%s")', implode('","',$module_name)), true);
} }
} }