MHV1P2 ;WAS/GPM - My HealtheVet Install Utility Routine ; 2/2/08 12:35pm
;;1.0;My HealtheVet;**2**;Aug 23, 2005;Build 22
;;Per VHA Directive 2004-038, this routine should not be modified.
;
; Integration Agreements:
; 10141 : BMES^XPDUTL
; : MES^XPDUTL
; 3552 : PARAM^HLCS2
;
ENV ;
Q
;
PRE ; Pre-init routine
; Turn on MHV Application Logging, add a log entry for the start
; of the patch install.
D LOGON
D LOG^MHVUL2(XPDNM,"PRE-INIT","S","TRACE")
Q
;
POST ; Post-init routine
; Add a log entry for the post init, and turn off logging.
D LOG^MHVUL2(XPDNM,"POST-INIT BEGIN","S","TRACE")
;
D BMES^XPDUTL(" Updating MHVVA logical link")
I '$$UPDLINK D
. D BMES^XPDUTL(" *** Update to MHVVA logical link failed.")
. D MES^XPDUTL(" Please update the MHVVA logical link manually.")
. D MES^XPDUTL(" The DNS DOMAIN field shoud be 'MHV.DOMAIN.EXT'")
. D MES^XPDUTL(" The AUTOSTART field should be 'Enabled'")
. D MES^XPDUTL(" No other fields should be changed.")
. D MES^XPDUTL(" If you need help with this please consult the HL7 System Manager")
. D MES^XPDUTL(" Guide, or log a Remedy Ticket.")
. Q
;
I '$$LOGCHK D
. D LOG^MHVUL2("LOG CHECK","FAILED","S","TRACE")
. D BMES^XPDUTL(" *** An HL7 message was processed by MHV during installation.")
. D MES^XPDUTL(" Please check your error trap. If you find an error in an MHV")
. D MES^XPDUTL(" routine, please log a remedy ticket.")
. Q
D LOG^MHVUL2(XPDNM,"POST-INIT END","S","TRACE")
D LOGOFF
D RESET^MHVUL2
Q
;
LOGON ; Turn on MHV application logging
N UPDATE,SUCCESS
D BMES^XPDUTL(" Turning on MHV Application Logging")
S UPDATE("STATE")=1
S UPDATE("DELETE")=$$HTFM^XLFDT($H+60)
S UPDATE("LEVEL")="DEBUG"
D LOGSET^MHVUL1(.SUCCESS,.UPDATE)
Q
;
LOGOFF ; Turn off MHV application logging
N SUCCESS
D BMES^XPDUTL(" Turning off MHV Application Logging")
D LOGOFF^MHVUL1(.SUCCESS)
Q
;
LOGCHK() ; Check for log entries during patch installation
N DTM,PREDTM,J,FLAG
S PREDTM=$G(^TMP("MHV7LOG",$J))
Q:PREDTM="" 1
S DTM=$O(^XTMP("MHV7LOG",2,""))
I DTM'="",DTM<PREDTM Q 0
S J="",FLAG=0
F S J=$O(^XTMP("MHV7LOG",2,PREDTM,J)) Q:J="" I J'=$J S FLAG=1 Q
I FLAG Q 0
Q 1
;
UPDLINK() ; Update Logical Link
N FDA,ERR,IEN
;
D LOG^MHVUL2("UPDATE LOGICAL LINK","BEGIN","S","TRACE")
S ERR=""
S IEN=$$FIND1^DIC(870,"","X","MHVVA","B","","ERR")
I 'IEN D Q 0
. I '$G(ERR("DIERR")) S ERR("DIERR",1,"TEXT",1)="NOT FOUND"
. S ERR=$G(ERR("DIERR",1))_"^"_$G(ERR("DIERR",1,"TEXT",1))
. D LOG^MHVUL2("UPDATE FAILED",ERR,"S","ERROR")
. Q
;
S ERR=""
S IEN=IEN_","
I $P($$PARAM^HLCS2,U,3)="P" D
. S FDA(870,IEN,.08)="MHV.DOMAIN.EXT"
. S FDA(870,IEN,4.5)=1
. S FDA(870,IEN,400.01)="127.0.0.1"
. S FDA(870,IEN,400.02)=5410
. Q
E D
. S FDA(870,IEN,.08)=""
. S FDA(870,IEN,4.5)=0
. S FDA(870,IEN,400.01)=""
. S FDA(870,IEN,400.02)=""
. Q
D UPDATE^DIE("","FDA","","ERR")
I $G(ERR("DIERR")) D Q 0
. S ERR=$G(ERR("DIERR",1))_"^"_$G(ERR("DIERR",1,"TEXT",1))
. D LOG^MHVUL2("UPDATE FAILED",ERR,"S","ERROR")
. Q
;
I '$$CHKLINK(.ERR) D Q 0
. D LOG^MHVUL2("CHECK FAILED",ERR,"S","ERROR")
. Q
;
D LOG^MHVUL2("UPDATE LOGICAL LINK","SUCCESS","S","TRACE")
Q 1
;
CHKLINK(ERR) ; Check Logical Link
N ARY,IEN
;
K ERR
S ERR=""
I $P($$PARAM^HLCS2,U,3)'="P" Q 1
S IEN=$$FIND1^DIC(870,"","X","MHVVA","B","","ERR")
I 'IEN S ERR="DOES NOT EXIST" Q 0
S IEN=IEN_","
D GETS^DIQ(870,IEN,".08;4.5;400.01;400.02","","ARY","ERR")
I $G(ERR("DIERR")) S ERR=$G(ERR("DIERR",1))_"^"_$G(ERR("DIERR",1,"TEXT",1)) Q 0
I $G(ARY(870,IEN,.08))'="MHV.DOMAIN.EXT" S ERR="DNS DOMAIN NOT UPDATED" Q 0
I $G(ARY(870,IEN,4.5))'="Enabled" S ERR="AUTOSTART NOT ENABLED" Q 0
I $G(ARY(870,IEN,400.01))'="127.0.0.1" S ERR="INCORRECT IP ADDRESS" Q 0
I $G(ARY(870,IEN,400.02))'=5410 S ERR="INCORRECT TCP PORT" Q 0
Q 1
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMHV1P2 4006 printed Dec 13, 2024@02:15:29 Page 2
MHV1P2 ;WAS/GPM - My HealtheVet Install Utility Routine ; 2/2/08 12:35pm
+1 ;;1.0;My HealtheVet;**2**;Aug 23, 2005;Build 22
+2 ;;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 ; Integration Agreements:
+5 ; 10141 : BMES^XPDUTL
+6 ; : MES^XPDUTL
+7 ; 3552 : PARAM^HLCS2
+8 ;
ENV ;
+1 QUIT
+2 ;
PRE ; Pre-init routine
+1 ; Turn on MHV Application Logging, add a log entry for the start
+2 ; of the patch install.
+3 DO LOGON
+4 DO LOG^MHVUL2(XPDNM,"PRE-INIT","S","TRACE")
+5 QUIT
+6 ;
POST ; Post-init routine
+1 ; Add a log entry for the post init, and turn off logging.
+2 DO LOG^MHVUL2(XPDNM,"POST-INIT BEGIN","S","TRACE")
+3 ;
+4 DO BMES^XPDUTL(" Updating MHVVA logical link")
+5 IF '$$UPDLINK
Begin DoDot:1
+6 DO BMES^XPDUTL(" *** Update to MHVVA logical link failed.")
+7 DO MES^XPDUTL(" Please update the MHVVA logical link manually.")
+8 DO MES^XPDUTL(" The DNS DOMAIN field shoud be 'MHV.DOMAIN.EXT'")
+9 DO MES^XPDUTL(" The AUTOSTART field should be 'Enabled'")
+10 DO MES^XPDUTL(" No other fields should be changed.")
+11 DO MES^XPDUTL(" If you need help with this please consult the HL7 System Manager")
+12 DO MES^XPDUTL(" Guide, or log a Remedy Ticket.")
+13 QUIT
End DoDot:1
+14 ;
+15 IF '$$LOGCHK
Begin DoDot:1
+16 DO LOG^MHVUL2("LOG CHECK","FAILED","S","TRACE")
+17 DO BMES^XPDUTL(" *** An HL7 message was processed by MHV during installation.")
+18 DO MES^XPDUTL(" Please check your error trap. If you find an error in an MHV")
+19 DO MES^XPDUTL(" routine, please log a remedy ticket.")
+20 QUIT
End DoDot:1
+21 DO LOG^MHVUL2(XPDNM,"POST-INIT END","S","TRACE")
+22 DO LOGOFF
+23 DO RESET^MHVUL2
+24 QUIT
+25 ;
LOGON ; Turn on MHV application logging
+1 NEW UPDATE,SUCCESS
+2 DO BMES^XPDUTL(" Turning on MHV Application Logging")
+3 SET UPDATE("STATE")=1
+4 SET UPDATE("DELETE")=$$HTFM^XLFDT($HOROLOG+60)
+5 SET UPDATE("LEVEL")="DEBUG"
+6 DO LOGSET^MHVUL1(.SUCCESS,.UPDATE)
+7 QUIT
+8 ;
LOGOFF ; Turn off MHV application logging
+1 NEW SUCCESS
+2 DO BMES^XPDUTL(" Turning off MHV Application Logging")
+3 DO LOGOFF^MHVUL1(.SUCCESS)
+4 QUIT
+5 ;
LOGCHK() ; Check for log entries during patch installation
+1 NEW DTM,PREDTM,J,FLAG
+2 SET PREDTM=$GET(^TMP("MHV7LOG",$JOB))
+3 if PREDTM=""
QUIT 1
+4 SET DTM=$ORDER(^XTMP("MHV7LOG",2,""))
+5 IF DTM'=""
IF DTM<PREDTM
QUIT 0
+6 SET J=""
SET FLAG=0
+7 FOR
SET J=$ORDER(^XTMP("MHV7LOG",2,PREDTM,J))
if J=""
QUIT
IF J'=$JOB
SET FLAG=1
QUIT
+8 IF FLAG
QUIT 0
+9 QUIT 1
+10 ;
UPDLINK() ; Update Logical Link
+1 NEW FDA,ERR,IEN
+2 ;
+3 DO LOG^MHVUL2("UPDATE LOGICAL LINK","BEGIN","S","TRACE")
+4 SET ERR=""
+5 SET IEN=$$FIND1^DIC(870,"","X","MHVVA","B","","ERR")
+6 IF 'IEN
Begin DoDot:1
+7 IF '$GET(ERR("DIERR"))
SET ERR("DIERR",1,"TEXT",1)="NOT FOUND"
+8 SET ERR=$GET(ERR("DIERR",1))_"^"_$GET(ERR("DIERR",1,"TEXT",1))
+9 DO LOG^MHVUL2("UPDATE FAILED",ERR,"S","ERROR")
+10 QUIT
End DoDot:1
QUIT 0
+11 ;
+12 SET ERR=""
+13 SET IEN=IEN_","
+14 IF $PIECE($$PARAM^HLCS2,U,3)="P"
Begin DoDot:1
+15 SET FDA(870,IEN,.08)="MHV.DOMAIN.EXT"
+16 SET FDA(870,IEN,4.5)=1
+17 SET FDA(870,IEN,400.01)="127.0.0.1"
+18 SET FDA(870,IEN,400.02)=5410
+19 QUIT
End DoDot:1
+20 IF '$TEST
Begin DoDot:1
+21 SET FDA(870,IEN,.08)=""
+22 SET FDA(870,IEN,4.5)=0
+23 SET FDA(870,IEN,400.01)=""
+24 SET FDA(870,IEN,400.02)=""
+25 QUIT
End DoDot:1
+26 DO UPDATE^DIE("","FDA","","ERR")
+27 IF $GET(ERR("DIERR"))
Begin DoDot:1
+28 SET ERR=$GET(ERR("DIERR",1))_"^"_$GET(ERR("DIERR",1,"TEXT",1))
+29 DO LOG^MHVUL2("UPDATE FAILED",ERR,"S","ERROR")
+30 QUIT
End DoDot:1
QUIT 0
+31 ;
+32 IF '$$CHKLINK(.ERR)
Begin DoDot:1
+33 DO LOG^MHVUL2("CHECK FAILED",ERR,"S","ERROR")
+34 QUIT
End DoDot:1
QUIT 0
+35 ;
+36 DO LOG^MHVUL2("UPDATE LOGICAL LINK","SUCCESS","S","TRACE")
+37 QUIT 1
+38 ;
CHKLINK(ERR) ; Check Logical Link
+1 NEW ARY,IEN
+2 ;
+3 KILL ERR
+4 SET ERR=""
+5 IF $PIECE($$PARAM^HLCS2,U,3)'="P"
QUIT 1
+6 SET IEN=$$FIND1^DIC(870,"","X","MHVVA","B","","ERR")
+7 IF 'IEN
SET ERR="DOES NOT EXIST"
QUIT 0
+8 SET IEN=IEN_","
+9 DO GETS^DIQ(870,IEN,".08;4.5;400.01;400.02","","ARY","ERR")
+10 IF $GET(ERR("DIERR"))
SET ERR=$GET(ERR("DIERR",1))_"^"_$GET(ERR("DIERR",1,"TEXT",1))
QUIT 0
+11 IF $GET(ARY(870,IEN,.08))'="MHV.DOMAIN.EXT"
SET ERR="DNS DOMAIN NOT UPDATED"
QUIT 0
+12 IF $GET(ARY(870,IEN,4.5))'="Enabled"
SET ERR="AUTOSTART NOT ENABLED"
QUIT 0
+13 IF $GET(ARY(870,IEN,400.01))'="127.0.0.1"
SET ERR="INCORRECT IP ADDRESS"
QUIT 0
+14 IF $GET(ARY(870,IEN,400.02))'=5410
SET ERR="INCORRECT TCP PORT"
QUIT 0
+15 QUIT 1
+16 ;