diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php old mode 100755 new mode 100644 index 95ed29bf9f..99ee78849d --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -1900,6 +1900,12 @@ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3) { return; } } + // Check if agent exists + $check_id_agent = db_get_value ('id_agente', 'tagente', 'id_agente', $other['data'][0]); + if (!$check_id_agent) { + returnError('error_update_data_module', __('Error updating network module. Id_agent doesn\'t exists.')); + return; + } } $network_module_fields = array('id_agente', @@ -2097,6 +2103,12 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3) { return; } } + // Check if agent exists + $check_id_agent = db_get_value ('id_agente', 'tagente', 'id_agente', $other['data'][0]); + if (!$check_id_agent) { + returnError('error_update_data_module', __('Error updating plugin module. Id_agent doesn\'t exists.')); + return; + } } $plugin_module_fields = array('id_agente', @@ -2416,6 +2428,12 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3) { return; } } + // Check if agent exists + $check_id_agent = db_get_value ('id_agente', 'tagente', 'id_agente', $other['data'][0]); + if (!$check_id_agent) { + returnError('error_update_data_module', __('Error updating data module. Id_agent doesn\'t exists.')); + return; + } } $data_module_fields = array('id_agente', @@ -2673,6 +2691,12 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) { return; } } + // Check if agent exists + $check_id_agent = db_get_value ('id_agente', 'tagente', 'id_agente', $other['data'][0]); + if (!$check_id_agent) { + returnError('error_update_data_module', __('Error updating snmp module. Id_agent doesn\'t exists.')); + return; + } } # SNMP version 3