diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php old mode 100755 new mode 100644 index 95ef87da7d..4b293696df --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -1906,6 +1906,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', @@ -2103,6 +2109,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', @@ -2422,6 +2434,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', @@ -2679,6 +2697,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