exclude branch from select_for_Groups given group_id

This commit is contained in:
fbsanchez 2020-10-21 18:31:10 +02:00
parent 7bd7d190c5
commit 3220217ec8
1 changed files with 10 additions and 1 deletions

View File

@ -428,7 +428,7 @@ function html_print_select_style($fields, $name, $selected='', $style='', $scrip
* @param boolean $disabled Disabled or enabled. * @param boolean $disabled Disabled or enabled.
* @param boolean $style CSS inline style. * @param boolean $style CSS inline style.
* @param string $option_style CSS inline style in array format. * @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 string $keys_field Field to be used as array key, (id).
* @param boolean $strict_user Strict. * @param boolean $strict_user Strict.
* @param array $delete_groups Remove groups from select. * @param array $delete_groups Remove groups from select.
@ -500,6 +500,15 @@ function html_print_select_groups(
$name = 'group_select'.$idcounter[$name]; $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 = []; $fields = [];
// Preload selector. // Preload selector.
if (is_array($selected) === false) { if (is_array($selected) === false) {