Merge branch 'ent-6580-bug-en-la-edicion-de-grupos-asignando-como-padre-a-si-mismo' into 'develop'

exclude branch from select_for_Groups given group_id

See merge request artica/pandorafms!3550
This commit is contained in:
Daniel Rodriguez 2020-10-28 11:19:05 +01:00
commit fa9f4bca95
2 changed files with 19 additions and 2 deletions

View File

@ -168,7 +168,15 @@ if ($id_group) {
}
} else {
$table->data[2][1] = '<div class="w250px inline">';
$table->data[2][1] .= html_print_select_groups(false, 'AR', true, 'id_parent', $id_parent, '', '', '', true);
$table->data[2][1] .= html_print_input(
[
'type' => 'select_groups',
'name' => 'id_parent',
'selected' => $id_parent,
'return' => true,
'returnAllGroup' => true,
]
);
$table->data[2][1] .= '</div>';
}

View File

@ -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 !== false) {
$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) {