2011-02-15 Miguel de Dios <miguel.dedios@artica.es>

* 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



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3849 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-02-15 14:20:45 +00:00
parent 8344455eee
commit f224001e35
3 changed files with 28 additions and 5 deletions

View File

@ -1,3 +1,14 @@
2011-02-15 Miguel de Dios <miguel.dedios@artica.es>
* 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 <juanmanuel.ramon@artica.es>
* operation/agentes/estado_monitores.php: Fixed a mistake replacing "<img"

View File

@ -108,9 +108,13 @@ $table->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');

View File

@ -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 (