mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
Added recursion to delete modules children warning
This commit is contained in:
parent
5d0826f412
commit
0458f4357e
@ -1640,13 +1640,13 @@ if (check_login()) {
|
|||||||
$children_selected = false;
|
$children_selected = false;
|
||||||
} else {
|
} else {
|
||||||
foreach ($parent_modules as $parent) {
|
foreach ($parent_modules as $parent) {
|
||||||
$child_modules = get_children_module($parent_modules, ['nombre', 'id_agente_modulo']);
|
$child_modules = get_children_module($parent_modules, ['nombre', 'id_agente_modulo'], true);
|
||||||
if ((bool) $child_modules === false) {
|
if ((bool) $child_modules === false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($child_modules as $child) {
|
foreach ($child_modules as $child) {
|
||||||
$module_exist = in_array($child['id_agente_modulo'], $children_selected);
|
$module_exist = in_array($child['id_agente_modulo'], $parent_modules);
|
||||||
$child_exist = in_array($child, $children_selected);
|
$child_exist = in_array($child, $children_selected);
|
||||||
|
|
||||||
if ($module_exist === false && $child_exist === false) {
|
if ($module_exist === false && $child_exist === false) {
|
||||||
|
@ -3986,9 +3986,10 @@ function recursive_get_dt_from_modules_tree(&$f_modules, $modules, $deep)
|
|||||||
* Get the module data from a children
|
* Get the module data from a children
|
||||||
*
|
*
|
||||||
* @param integer $id_module Id module
|
* @param integer $id_module Id module
|
||||||
|
* @param boolean $recursive Recursive children search.
|
||||||
* @return array Children module data
|
* @return array Children module data
|
||||||
*/
|
*/
|
||||||
function get_children_module($id_module, $fields=false)
|
function get_children_module($id_module, $fields=false, $recursion=false)
|
||||||
{
|
{
|
||||||
$children_module_data = db_get_all_rows_filter(
|
$children_module_data = db_get_all_rows_filter(
|
||||||
'tagente_modulo',
|
'tagente_modulo',
|
||||||
@ -3996,6 +3997,17 @@ function get_children_module($id_module, $fields=false)
|
|||||||
$fields
|
$fields
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($children_module_data !== false && $recursion === true) {
|
||||||
|
foreach ($children_module_data as $child) {
|
||||||
|
$niece = get_children_module($child['id_agente_modulo'], $fields, false);
|
||||||
|
if ((bool) $niece === false) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
$children_module_data = array_merge($children_module_data, $niece);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $children_module_data;
|
return $children_module_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user