diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index d80b159706..688dc50b27 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2011-02-15 Miguel de Dios + + * include/functions_db.php: added in function "get_agent_modules" the + default value null for get modules of agents in user's group. + + * godmode/massive/massive_delete_modules.php: fixed the select of modules + now get only the modules of agents in user's group and now you can delete + and view correcly the modules with acent or other not ascii characters. + + Fixes: #3182143 and #3175722 + 2011-02-15 Juan Manuel Ramon * operation/agentes/estado_monitores.php: Fixed a mistake replacing "size[1] = '85%'; $table->data = array (); $table->data[0][0] = __('Modules'); -$modules = array (); -$modules = get_db_all_rows_filter ('tagente_modulo', false, 'DISTINCT(nombre)'); -$table->data[0][1] = print_select (index_array ($modules, 'nombre', 'nombre'), + +$modules = get_agent_modules(); +$modulesSelect = array(); +foreach ($modules as $module) { + $modulesSelect[$module] = $module; +} +$table->data[0][1] = print_select($modulesSelect, 'module_name', $module_name, false, __('Select'), '', true); $table->data[1][0] = __('Group'); diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index ef26f3da07..1a43297a75 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -664,7 +664,7 @@ function get_agentmodule_is_init ($id_agentmodule) { /** * Get all the modules in an agent. If an empty list is passed it will select all * - * @param mixed Agent id to get modules. It can also be an array of agent id's. + * @param mixed Agent id to get modules. It can also be an array of agent id's, by default is null and this mean that use the ids of agents in user's groups. * @param mixed Array, comma delimited list or singular value of rows to * select. If nothing is specified, nombre will be selected. A special * character "*" will select all the values. @@ -688,9 +688,17 @@ $modules = get_agent_modules ($id_agent, '*', 'disabled = 0 AND history_data = 0 * @return array An array with all modules in the agent. * If multiple rows are selected, they will be in an array */ -function get_agent_modules ($id_agent, $details = false, $filter = false, $indexed = true, $get_not_init_modules = true) { +function get_agent_modules ($id_agent = null, $details = false, $filter = false, $indexed = true, $get_not_init_modules = true) { global $config; + if ($id_agent === null) { + //Extract the agents of group user. + $groups = get_user_groups(false, 'AR', false); + $id_groups = array_keys($groups); + + $id_agent = get_db_sql("SELECT id_agente FROM tagente WHERE id_grupo IN (" . implode(',', $id_groups) . ")"); + } + $id_agent = safe_int ($id_agent, 1); $where = " WHERE (