diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php
index e315ec3d16..a5df5e31c0 100644
--- a/pandora_console/godmode/agentes/module_manager.php
+++ b/pandora_console/godmode/agentes/module_manager.php
@@ -1283,9 +1283,14 @@ foreach ($modules as $module) {
}
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
+ // Check module relatonships to show warning message.
+ $module_children = json_encode(get_children_module($module['id_agente_modulo'], 'nombre'));
+ $url = htmlentities('index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo']);
+
// Delete module.
- $data[9] = '';
+ $data[9] = '';
+
$data[9] .= html_print_image(
'images/cross.png',
true,
@@ -1394,4 +1399,30 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
window.location = window.location + "&checked=true";
}
}
+
+ function delete_module_warning(children_json, url) {
+ var message = '';
+ var children = JSON.parse(children_json);
+ var ret = false;
+
+ if(children != false) {
+ message += '
' + '' + '';
+ $.each(children, function (key, value) {
+ message += '- ' + value['nombre'] + '
';
+ });
+ message += '
';
+ }
+
+ ret = confirmDialog({
+ title: "",
+ message: message,
+ onAccept: function() {
+ window.location.href = url;
+ }
+ });
+
+ return false;
+
+
+ }
diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php
index e414c64e39..d45b2f19ce 100755
--- a/pandora_console/include/functions_modules.php
+++ b/pandora_console/include/functions_modules.php
@@ -3988,12 +3988,12 @@ function recursive_get_dt_from_modules_tree(&$f_modules, $modules, $deep)
* @param integer $id_module Id module
* @return array Children module data
*/
-function get_children_module($id_module)
+function get_children_module($id_module, $fields=false)
{
- $children_module_data = db_get_all_rows_sql(
- 'SELECT *
- FROM tagente_modulo
- WHERE parent_module_id = '.$id_module
+ $children_module_data = db_get_all_rows_filter(
+ 'tagente_modulo',
+ ['parent_module_id' => $id_module],
+ $fields
);
return $children_module_data;