TPDT-283
* Adapted the powershell to connect to the central with a dedicated sql login * reverted script 9_Update_FTPLogin_Central to the original version * script 9_Update_FTPLogin_Central is executed on the central directly with a dedicated login * reverted scripts 20_update_system_site_centrale.sql and 21_update_point_of_sale_centrale.sql to work locally only * scripts scripts 20_update_system_site_centrale.sql and 21_update_point_of_sale_centrale.sql are executed on the cenrtal with a specific login and on the local instance * when fetching the mac addresses, only take up interfaces in account and group the results by mac addresses, to avoid virtual mac addresses duplicate causing an error
This commit is contained in:
@@ -1,67 +1,46 @@
|
||||
/*=============================================================================
|
||||
|
||||
Update the ftp password in system_site_transfert table on the central from a pharmacy, for this pharmacy
|
||||
|
||||
Parameters
|
||||
----------------------
|
||||
|
||||
|
||||
Context
|
||||
----------------------
|
||||
This script is run in a pharmacy, during the preparation / migration of the pharmacy
|
||||
|
||||
Creation : 07.03.2024 / TSC
|
||||
Modifications:
|
||||
|
||||
=============================================================================*/
|
||||
IF EXISTS ( SELECT 1
|
||||
FROM [ARIZONACASH].[Arizona].[dbo].[System_site] SS
|
||||
JOIN [ARIZONACASH].[Arizona].[dbo].[System_site_transfer] SST
|
||||
ON [SST].[SST_dest_system_site] = [SS].[System_site_ID]
|
||||
WHERE [SS].[SS_server_name] = '$fqdn'
|
||||
AND [SST].[SST_bmc_task] = 109)
|
||||
IF EXISTS ( SELECT 1
|
||||
FROM [Arizona].[dbo].[System_site] SS
|
||||
JOIN [Arizona].[dbo].[System_site_transfer] SST
|
||||
ON SST.SST_dest_system_site = SS.System_site_ID
|
||||
WHERE SS.SS_server_name = '$fqdn'
|
||||
AND SST.SST_bmc_task = 109)
|
||||
BEGIN
|
||||
|
||||
UPDATE [ARIZONACASH].[Arizona].[dbo].[System_site_transfer]
|
||||
SET [SST_connection_info] = '<ConnectionInfos><Ftp username="centralinfra\svc-APH-trans" pwd="$ftppass"/></ConnectionInfos>'
|
||||
FROM [ARIZONACASH].[Arizona].[dbo].[System_site] SS
|
||||
JOIN [ARIZONACASH].[Arizona].[dbo].[System_site_transfer] SST
|
||||
ON [SST].[SST_dest_system_site] = [SS].[System_site_ID]
|
||||
WHERE [SS].[SS_server_name] = '$fqdn';
|
||||
|
||||
UPDATE [Arizona].[dbo].[System_site_transfer]
|
||||
SET SST_connection_info = '<ConnectionInfos><Ftp username="centralinfra\svc-APH-trans" pwd="$ftppass"/></ConnectionInfos>'
|
||||
FROM [Arizona].[dbo].[System_site] SS
|
||||
JOIN [Arizona].[dbo].[System_site_transfer] SST
|
||||
ON SST.SST_dest_system_site = SS.System_site_ID
|
||||
WHERE SS.SS_server_name = '$fqdn';
|
||||
END;
|
||||
ELSE
|
||||
BEGIN
|
||||
|
||||
IF EXISTS ( SELECT 1
|
||||
FROM [ARIZONACASH].Arizona.[dbo].[System_site]
|
||||
WHERE [SS_server_name] = '$fqdn')
|
||||
BEGIN
|
||||
|
||||
UPDATE [ARIZONACASH].Arizona.[dbo].[Bmc_ID_counter]
|
||||
SET [BMCID_last_number] = ( SELECT [BMCID_last_number] + 1
|
||||
FROM [ARIZONACASH].Arizona.[dbo].[Bmc_ID_counter]
|
||||
WHERE [BMCID_key] = 'system_site_transfer')
|
||||
FROM [ARIZONACASH].Arizona.[dbo].[Bmc_ID_counter]
|
||||
WHERE [BMCID_key] = 'system_site_transfer';
|
||||
|
||||
INSERT INTO [ARIZONACASH].[Arizona].[dbo].[System_site_transfer] ([System_site_transfer_ID],
|
||||
[SST_source_system_site],
|
||||
[SST_dest_system_site],
|
||||
[SST_bmc_task],
|
||||
[SST_transfer_type],
|
||||
[SST_VGUID],
|
||||
[SST_master_ID],
|
||||
[SST_connection_info],
|
||||
[SST_start_date],
|
||||
[SST_end_date])
|
||||
VALUES (( SELECT [BMCID_last_number]
|
||||
FROM [ARIZONACASH].Arizona.[dbo].[Bmc_ID_counter]
|
||||
WHERE [BMCID_key] = 'system_site_transfer'), 102, ( SELECT [System_site_ID]
|
||||
FROM [ARIZONACASH].Arizona.[dbo].[System_site]
|
||||
WHERE [SS_server_name] = '$fqdn'), 109, 1, DEFAULT,
|
||||
NULL, '<ConnectionInfos><Ftp username="centralinfra\svc-APH-trans" pwd="$ftppass"/></ConnectionInfos>',
|
||||
(SELECT CONVERT(CHAR(10), GETDATE(), 126)), NULL);
|
||||
|
||||
END;
|
||||
END;
|
||||
IF EXISTS ( SELECT 1
|
||||
FROM Arizona.dbo.System_site
|
||||
WHERE SS_server_name = '$fqdn')
|
||||
BEGIN
|
||||
UPDATE Arizona.dbo.Bmc_ID_counter
|
||||
SET BMCID_last_number = ( SELECT BMCID_last_number + 1
|
||||
FROM Arizona.dbo.Bmc_ID_counter
|
||||
WHERE BMCID_key = 'system_site_transfer')
|
||||
FROM Arizona.dbo.Bmc_ID_counter
|
||||
WHERE BMCID_key = 'system_site_transfer';
|
||||
INSERT INTO [Arizona].[dbo].[System_site_transfer] ([System_site_transfer_ID],
|
||||
[SST_source_system_site],
|
||||
[SST_dest_system_site],
|
||||
[SST_bmc_task],
|
||||
[SST_transfer_type],
|
||||
[SST_VGUID],
|
||||
[SST_master_ID],
|
||||
[SST_connection_info],
|
||||
[SST_start_date],
|
||||
[SST_end_date])
|
||||
VALUES (( SELECT BMCID_last_number
|
||||
FROM Arizona.dbo.Bmc_ID_counter
|
||||
WHERE BMCID_key = 'system_site_transfer'), 102, ( SELECT System_site_ID
|
||||
FROM Arizona.dbo.System_site
|
||||
WHERE SS_server_name = '$fqdn'), 109, 1,
|
||||
DEFAULT, NULL,
|
||||
'<ConnectionInfos><Ftp username="centralinfra\svc-APH-trans" pwd="$ftppass"/></ConnectionInfos>',
|
||||
(SELECT CONVERT(CHAR(10), GETDATE(), 126)), NULL);
|
||||
END;
|
||||
END;
|
||||
Reference in New Issue
Block a user