--RM: Added Sept 7 2006 to clear duplicate settings
select * into RM_W_CustomUserSettings from W_CustomUserSettings 
go
delete W_CustomUserSettings 
go
insert into W_CustomUserSettings select distinct * from RM_W_CustomUserSettings
go
drop table RM_W_CustomUserSettings 
go
--exec dbo.M_SetViewPermission	--Mover to view.sql EN - 00399 Run for every DB upgrade
--Set Permission
--Do not process for WinRecs. Some Hospital do not like it
if User_Id( N'WinRecs') is not null
begin
    exec('exec sp_revokedbaccess N''WinRecs''')
    exec('sp_grantdbaccess N''WinRecs'', N''WinRecs''')
    exec('sp_addrolemember N''db_datareader'', N''winrecs''')
    exec('sp_dropsrvrolemember ''WinRecs'', ''sysadmin''')
end
GO
--RM: End

truncate table U_ResourceStrings
go
bulk insert U_ResourceStrings  from '<path>U_ResourceStrings.txt' with ( fieldterminator = '|', rowterminator = '\n' ) 
go
update U_ResourceStrings set StringE = 'Report Files (*.rpt)|*.rpt|', StringF = 'Fichiers de rapport (*.rpt)|*.rpt|' where RecordID = 1267
go
update U_ResourceStrings set StringE = 'All Files (*.*)|*.*|', StringF = 'Tous les fichiers (*.*)|*.*|' where RecordID = 1271
go
truncate table MG_Messages
go
bulk insert MG_Messages  from '<path>MG_Messages.txt' with ( fieldterminator = '|', rowterminator = '\n' ) 
go
truncate table MG_MessageFields
go
bulk insert MG_MessageFields  from '<path>MG_MessageFields.txt' with ( fieldterminator = '|', rowterminator = '\n' ) 
go
-- This needs to be in every update. This message has carriage returns and the Bulk insert caks out because of them.
if not exists (select * from dbo.MG_Messages where MessageKey = 'Q000082')
    insert into dbo.MG_Messages(MessageKey, MessageType, MessageText, ResponseType, CIHIErrorKey, MessageTextE, MessageTextF)
    values('Q000082',  1, 
'Before processing the request, we must complete the current transaction on the screen. 
    Yes - Proceed to completion, then process request
    No  - Cancel current transaction and process request only
    Cancel - Continue to process current transaction

If Yes, Loan/Transfer transaction will stop at record above one with request and Return/Mass Move will include chart requested.', 3, null,
'Before processing the request, we must complete the current transaction on the screen. 
    Yes - Proceed to completion, then process request
    No  - Cancel current transaction and process request only
    Cancel - Continue to process current transaction

If Yes, Loan/Transfer transaction will stop at record above one with request and Return/Mass Move will include chart requested.',
'Avant de traiter la demande, nous devons accomplir la transaction courante sur l''écran. 
    Oui - procédez à l''accomplissement, traitent alors la demande 
    Non - décommandez la demande courante de transaction et de processus seulement
    Annulation - continuez à traiter la transaction courante

Si oui, la transaction de Loan/Transfer s''arrêtera au disque au-dessus d''un avec la demande et le mouvement de Return/Mass inclura le diagramme demandé.'
)
else
Update  MG_Messages
set MessageType = 1, 
    MessageText = 'Before processing the request, we must complete the current transaction on the screen. 
    Yes - Proceed to completion, then process request
    No  - Cancel current transaction and process request only
    Cancel - Continue to process current transaction

If Yes, Loan/Transfer transaction will stop at record above one with request and Return/Mass Move will include chart requested.', 
ResponseType = 3, 
CIHIErrorKey = null,
MessageTextE = 'Before processing the request, we must complete the current transaction on the screen. 
    Yes - Proceed to completion, then process request
    No  - Cancel current transaction and process request only
    Cancel - Continue to process current transaction

If Yes, Loan/Transfer transaction will stop at record above one with request and Return/Mass Move will include chart requested.',
MessageTextF = 'Avant de traiter la demande, nous devons accomplir la transaction courante sur l''écran. 
    Oui - procédez à l''accomplissement, traitent alors la demande 
    Non - décommandez la demande courante de transaction et de processus seulement
    Annulation - continuez à traiter la transaction courante

Si oui, la transaction de Loan/Transfer s''arrêtera au disque au-dessus d''un avec la demande et le mouvement de Return/Mass inclura le diagramme demandé.'
where MessageKey = 'Q000082'
go
-- This needs to be in every update. This message has carriage returns and the Bulk insert caks out because of them.
if not exists (select * from dbo.MG_Messages where MessageKey = 'W000029')
    insert into dbo.MG_Messages(MessageKey, MessageType, MessageText, ResponseType, CIHIErrorKey, MessageTextE, MessageTextF)
    values('W000029',  1, 
'You have selected the Cancel function.  
Do you wish to erase all data entered into this record since the last save?"  

[Yes]  - this will reload the record as it presently does;  
[No]  - this will return the user to "status quo" before they hit the F8 Cancel key.', 2, null, '','')
else
Update  MG_Messages
set MessageText = 'You have selected the Cancel function.  
Do you wish to erase all data entered into this record since the last save?"  

[Yes]  - this will reload the record as it presently does;  
[No]  - this will return the user to "status quo" before they hit the F8 Cancel key.'
where MessageKey = 'W000029'
GO
----------------------------------------------Special for this version --------------------------------------------------------------------------
