From 7a1b9f9c1ca76adb11a76a322a81c78082aac617 Mon Sep 17 00:00:00 2001 From: jsatoh Date: Sat, 3 Sep 2011 04:31:36 +0000 Subject: [PATCH] 2011-09-03 Junichi Satoh * godmode/massive/massive_delete_alerts.php, godmode/massive/massive_edit_modules.php, operation/agentes/ver_agente.php: Added group recursion feature, it allows to search agents in child groups. These three changes are contributed by Yusuke Arai. Thanks! git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4896 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 8 ++++++ .../godmode/massive/massive_delete_alerts.php | 27 ++++++++++++++++--- .../godmode/massive/massive_edit_modules.php | 13 ++++++--- .../operation/agentes/ver_agente.php | 13 +++++---- 4 files changed, 48 insertions(+), 13 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e186ae90b5..d9a49b8772 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2011-09-03 Junichi Satoh + + * godmode/massive/massive_delete_alerts.php, + godmode/massive/massive_edit_modules.php, + operation/agentes/ver_agente.php: Added group recursion feature, + it allows to search agents in child groups. These three changes + are contributed by Yusuke Arai. Thanks! + 2011-09-02 Juan Manuel Ramon * install.php: Fixed css style in this view. diff --git a/pandora_console/godmode/massive/massive_delete_alerts.php b/pandora_console/godmode/massive/massive_delete_alerts.php index 9dc2f14f98..02bf6fa820 100644 --- a/pandora_console/godmode/massive/massive_delete_alerts.php +++ b/pandora_console/godmode/massive/massive_delete_alerts.php @@ -31,13 +31,27 @@ require_once ($config['homedir'].'/include/functions_users.php'); if (is_ajax ()) { $get_agents = (bool) get_parameter ('get_agents'); + $recursion = (int) get_parameter ('recursion'); if ($get_agents) { $id_group = (int) get_parameter ('id_group'); $id_alert_template = (int) get_parameter ('id_alert_template'); - $agents_alerts = alerts_get_agents_with_alert_template ($id_alert_template, $id_group, - false, array ('tagente.nombre', 'tagente.id_agente')); + if ($recursion) { + $groups = groups_get_id_recursive($id_group, true); + } + else { + $groups = array($id_group); + } + + $agents_alerts = array(); + foreach( $groups as $group ) { + $agents_alerts_one_group = alerts_get_agents_with_alert_template ($id_alert_template, $group, + false, array ('tagente.nombre', 'tagente.id_agente')); + if (is_array($agents_alerts_one_group)) { + $agents_alerts = array_merge($agents_alerts, $agents_alerts_one_group); + } + } echo json_encode (index_array ($agents_alerts, 'id_agente', 'nombre')); return; @@ -133,8 +147,8 @@ $table->data[0][3] = ''; $table->data[1][0] = __('Group'); $table->data[1][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group, '', '', '', true, false, true, '', $id_alert_template == 0); -$table->data[1][2] = ''; -$table->data[1][3] = ''; +$table->data[1][2] = __('Group recursion'); +$table->data[1][3] = html_print_checkbox ("recursion", 1, false, true, false); $table->data[2][0] = __('Agents'); $table->data[2][0] .= '