From cc765b5f85517feb568c4aa7811831d9047fedc3 Mon Sep 17 00:00:00 2001 From: Trevor Robinson Date: Fri, 22 Nov 2024 18:32:17 +0100 Subject: [PATCH] [SmarterMail100] Add defaultdomainhostname property to existing SM100 providers --- SolidCP/Database/update_db.sql | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/SolidCP/Database/update_db.sql b/SolidCP/Database/update_db.sql index 326f419c8..0736610a9 100644 --- a/SolidCP/Database/update_db.sql +++ b/SolidCP/Database/update_db.sql @@ -20341,8 +20341,29 @@ END GO --SmarterMail100 Support for new options -IF NOT EXISTS (SELECT * FROM [dbo].[ServiceDefaultProperties] WHERE [ProviderID] = '67' AND [PropertyName] = N'DefaultDomainHostName') +IF NOT EXISTS (SELECT * FROM [dbo].[ServiceDefaultProperties] WHERE [ProviderID] = '67' AND [PropertyName] = N'defaultdomainhostname') BEGIN -INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (67, N'DefaultDomainHostName', N'mail.[DOMAIN_NAME]') +INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (67, N'defaultdomainhostname', N'mail.[DOMAIN_NAME]') +END +GO + +-- Add defaultdomainhostname property to existing SM100 providers +IF NOT EXISTS (Select * from [ServiceProperties] INNER JOIN Services ON ServiceProperties.ServiceID=Services.ServiceID Where Services.ProviderID = 67 AND ServiceProperties.PropertyName = N'defaultdomainhostname') +BEGIN +DECLARE service_cursor CURSOR FOR SELECT ServiceId FROM Services WHERE ProviderID = 67 +DECLARE @ServiceID INT +OPEN service_cursor +FETCH NEXT FROM service_cursor INTO @ServiceID +WHILE @@FETCH_STATUS = 0 +BEGIN + BEGIN + INSERT [dbo].[ServiceProperties] ([ServiceID], [PropertyName], [PropertyValue]) VALUES (@ServiceID, N'defaultdomainhostname', N'mail.[DOMAIN_NAME]') + END + + FETCH NEXT FROM service_cursor INTO @ServiceID +END + +CLOSE service_cursor +DEALLOCATE service_cursor END GO \ No newline at end of file