<cfif form.Type EQ "Patch">
	<cfinclude template="patch_15.0.03.cfm">
</cfif>

<cfquery datasource="#application.config.DSN#">
IF EXISTS(SELECT * FROM AppSetting WHERE Name = 'MAPSAPI')
BEGIN
	UPDATE [dbo].[AppSetting] SET Value = '3'
	WHERE Name = 'MAPSAPI'
END



IF EXISTS(SELECT * FROM AppSetting WHERE Name = 'DEFAULTLATLNG')
BEGIN
	declare 
		@lat varchar(50), 
		@lng varchar(50) 

		select @lng = SUBSTRING(value,(PATINDEX('%,%', value)+1),(LEN(value)-PATINDEX('%,%', value))), @lat = SUBSTRING(value,0,PATINDEX('%,%', value)) from [dbo].[AppSetting] where Name = 'DEFAULTLATLNG'

		declare @lnglat varchar(50)
		set @lnglat = @lng +',' + @lat

		IF NOT EXISTS(SELECT * FROM [dbo].[AppSetting] WHERE Name = 'DEFAULTLNGLAT')
			BEGIN
				
				INSERT INTO [dbo].[AppSetting]
					([Name]
					,[Value])
				VALUES
					('DEFAULTLNGLAT'
					, @lnglat)
			END
		ELSE
			BEGIN
				UPDATE [dbo].[AppSetting] SET Value = @lnglat
				WHERE Name = 'DEFAULTLNGLAT'
			END
END
</cfquery>