From 3220217ec8a37dd81aec22c17bdc656bb414944b Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 21 Oct 2020 18:31:10 +0200 Subject: [PATCH] exclude branch from select_for_Groups given group_id --- pandora_console/include/functions_html.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 092044765c..0bdf773977 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -428,7 +428,7 @@ function html_print_select_style($fields, $name, $selected='', $style='', $scrip * @param boolean $disabled Disabled or enabled. * @param boolean $style CSS inline style. * @param string $option_style CSS inline style in array format. - * @param array $id_group Groups to be manually added. + * @param integer $id_group Exclude group branch from id_group. * @param string $keys_field Field to be used as array key, (id). * @param boolean $strict_user Strict. * @param array $delete_groups Remove groups from select. @@ -500,6 +500,15 @@ function html_print_select_groups( $name = 'group_select'.$idcounter[$name]; } + if ($id_group !== null) { + $children = groups_get_children($id_group); + foreach ($children as $child) { + $delete_groups[] = $child['id_grupo']; + } + + $delete_groups[] = $id_group; + } + $fields = []; // Preload selector. if (is_array($selected) === false) {