XPDIJ1 ;SFISC/RSD - Cont. of Install Job ;05/11/2001 09:07
;;8.0;KERNEL;**41,68,108,200,559**;Jul 10, 1995;Build 5
;Per VHA Directive 2004-038, this routine should not be modified.
IN ;install XPDA
;XPDA=ien of file 9.7, XPDNM=package name
Q:'$D(^XTMP("XPDI",XPDA))!'$D(^XPD(9.7,XPDA,0))
;check if already installed
I $P($G(^XPD(9.7,XPDA,1)),U,3) D BMES^XPDUTL(" "_XPDNM_" Already Installed ") Q
N DIFROM,XPD,XPD0,XPDBLD,XPDCHECK,XPDCP,XPDI,XPDGREF,XPDIST,XPDIDTOT,XPDIDCNT,XPDIDMOD,XPDRTN
;XPDBLD subscript for build entry i.e. ^XTMP("XPDI",XPDA,"BLD",XPDBLD
S DIFROM=$$VER^XPDUTL(XPDNM),XPDBLD=$O(^XTMP("XPDI",XPDA,"BLD",0)),XPDGREF="^XTMP(""XPDI"","_XPDA_",""TEMP"")"
D TITLE^XPDID(XPDNM)
;^XTMP("XPDI",XPDA,"BLD",XPDBLD,6) is set when the msg is loaded. Forum adds this as the last line of the msg.
;add Package file entry if sent, set TEST # & SEQ #
S Y=$$PKGADD^XPDIP,XPD0=^XTMP("XPDI",XPDA,"BLD",XPDBLD,0),Y=$G(^(6)),XPDNM("TST")=$P(Y,U),XPDNM("SEQ")=$P(Y,U,2)
I '$$CHK(11) D
.D BMES^XPDUTL(" Install Started for "_XPDNM_" : "),STMP(11)
.;update status, installed by fields and distribution date
.S XPD(9.7,XPDA_",",.02)=2,XPD(9.7,XPDA_",",9)=DUZ,XPD(9.7,XPDA_",",51)=$P(XPD0,U,4)
.D FILE^DIE("","XPD")
E D BMES^XPDUTL(" Install Restarted for "_XPDNM_" at "_$$HTE^XLFDT($H))
D BMES^XPDUTL("Build Distribution Date: "_$$FMTE^XLFDT($P(XPD0,U,4)))
D RTN Q:$D(XPDABORT)
D PRE Q:$D(XPDABORT)
D FMDATA Q:$D(XPDABORT)
D COMP Q:$D(XPDABORT)
D POST:$G(XPDT("MASTER"))'=XPDA
Q ;Finshed
;
RTN I '$$CHK(12) D
.D BMES^XPDUTL(" Installing Routines:"),SETTOT^XPDID(9.8),RTN^XPDIJ(XPDA),STMP(12)
E D BMES^XPDUTL(" Routines already installed.")
Q
;
PRE S XPDCP="INI"
;check if pre-install has completed
I '$$VERCP^XPDUTL("XPD PREINSTALL COMPLETED") D Q:$D(XPDABORT)
.;setup XPDQUES array with pre-install questions/answers
.D QUES^XPDIQ("PRE")
.;XPDCHECK=ien of current checkpoint, (0)=name of checkpoint
.;XPDCP="INI"-pre install or "INIT"-post install
.;loop thru check points starting with INSTALL STARTED
.S XPDCHECK=1
.F S XPDCHECK=$O(^XPD(9.7,XPDA,"INI",XPDCHECK)) Q:'XPDCHECK S XPD=^(XPDCHECK,0) D Q:$D(XPDABORT)
..;if there is no call back, quit
..Q:$G(^XPD(9.7,XPDA,"INI",XPDCHECK,1))="" S XPDRTN=^(1)
..;check if checkpoint has been completed
..Q:$P(XPD,U,2)
..I XPDCHECK=2 D BMES^XPDUTL(" Running Pre-Install Routine: "_XPDRTN)
..;zero the progress bar
..I $D(XPDIDVT) S XPDIDTOT=0 D UPDATE^XPDID(0)
..D @XPDRTN
..;write message and abort if developer wants
..I $D(XPDABORT) D BMES^XPDUTL("Install ** ABORTED ** in Pre-Install program") Q
..S %=$$COMCP^XPDUTL(XPDCHECK)
.Q:$D(XPDABORT)
.;complete pre-init check point
.S %=$$COMCP^XPDUTL("XPD PREINSTALL COMPLETED")
E D BMES^XPDUTL(" Pre-Install already finished.")
Q
;
FMDATA ;build XPDQUES arrays for all of the FM Files
D QUES^XPDIQ("XPF")
;check the last file and see if it's already installed
S XPD=$G(^(+$O(^XPD(9.7,XPDA,4,"A"),-1),0))
I '$P(XPD,U,2) D:$D(^XTMP("XPDI",XPDA,"FIA"))
.D BMES^XPDUTL(" Installing Data Dictionaries: "),SETTOT^XPDID(4),FIA^XPDIK,MES^XPDUTL(" "_$$HTE^XLFDT($H))
E D BMES^XPDUTL(" Data Dictionaries already installed.")
S %=+$O(^XTMP("XPDI",XPDA,"DATA",""),-1),XPD=$G(^XPD(9.7,XPDA,4,%,0))
I '$P(XPD,U,3) D:%
.D BMES^XPDUTL(" Installing Data: "),DAT^XPDIK,MES^XPDUTL(" "_$$HTE^XLFDT($H))
E D BMES^XPDUTL(" Data already installed.")
Q
;
COMP S (%,XPD)=""
F S %=+$O(^XPD(9.7,XPDA,"KRN",%)) Q:'% S XPD=$G(^(%,0)) Q:'$P(XPD,U,2)
I '$P(XPD,U,2) D:$D(^XTMP("XPDI",XPDA,"KRN"))
.D BMES^XPDUTL(" Installing PACKAGE COMPONENTS: "),KRN^XPDIK,MES^XPDUTL(" "_$$HTE^XLFDT($H))
E D BMES^XPDUTL(" PACKAGE COMPONENTS already installed.")
Q
;
POST S XPDCP="INIT"
;check if post-install has completed
I '$$VERCP^XPDUTL("XPD POSTINSTALL COMPLETED") D Q:$D(XPDABORT)
.;setup XPDQUES array with post-install questions/answers
.D QUES^XPDIQ("POS")
.;loop thru check points starting with INSTALL STARTED
.S XPDCHECK=1
.F S XPDCHECK=$O(^XPD(9.7,XPDA,"INIT",XPDCHECK)) Q:'XPDCHECK S XPD=^(XPDCHECK,0) D Q:$D(XPDABORT)
..;if there is no call back, quit
..Q:$G(^XPD(9.7,XPDA,"INIT",XPDCHECK,1))="" S XPDRTN=^(1)
..;quit if checkpoint has completed time
..Q:$P(XPD,U,2)
..I XPDCHECK=2 D BMES^XPDUTL(" Running Post-Install Routine: "_XPDRTN)
..;zero the progress bar
..I $D(XPDIDVT) S XPDIDTOT=0 D UPDATE^XPDID(0)
..D @XPDRTN
..;write message and abort if developer wants
..I $D(XPDABORT) D BMES^XPDUTL("Install ** ABORTED ** in Post-Install program") Q
..S %=$$COMCP^XPDUTL(XPDCHECK)
.Q:$D(XPDABORT)
.;complete post-init check point
.S %=$$COMCP^XPDUTL("XPD POSTINSTALL COMPLETED")
E D BMES^XPDUTL(" Post-Install already finished.")
;move routines to install file & Routine file
D BMES^XPDUTL(" Updating Routine file..."),SETTOT^XPDID(9.8),RTN^XPDIP
;XPDIST is flag for site tracking^A/B install message, it is set in PKG^XPDIP
;install Package file, OERR parameter multiple, and Build file
S XPDIST="" D BMES^XPDUTL(" Updating KIDS files..."),PKG^XPDIP
D BMES^XPDUTL(" "_XPDNM_" Installed. "),STMP(17)
;sends install messages local/forum
S %=$$EN^XPDIST(XPDA,XPDIST) D BMES^XPDUTL(" "_$P("NO ",U,'$P(%,"#",2))_"Install Message sent "_%)
Q
CHK(X) ;check checkpoints in file 9.7, X=field #, returns 1=completed, 0=not completed
Q $$GET1^DIQ(9.7,XPDA_",",X,"I")]""
;
STMP(X) ;timestamp checkpoints in file 9.7, X=field #
N XPD,%
S %=$$NOW^XLFDT,XPD(9.7,XPDA_",",X)=%
D MES^XPDUTL(" "_$$FMTE^XLFDT(%)),FILE^DIE("","XPD")
Q
;
INHIBIT(SET) ;Set/Clear the Inhibit logon field.
N VOL,IEN
F IEN=0:0 S IEN=$O(^%ZIS(14.5,IEN)) Q:IEN'>0 D
. I $P(^%ZIS(14.5,IEN,0),U,11)=1 S VOL(14.5,IEN_",",1)=SET
. Q
D FILE^DIE("","VOL")
Q
XPDIJ1 ;SFISC/RSD - Cont. of Install Job ;05/11/2001 09:07
+1 ;;8.0;KERNEL;**41,68,108,200,559**;Jul 10, 1995;Build 5
+2 ;Per VHA Directive 2004-038, this routine should not be modified.
IN ;install XPDA
+1 ;XPDA=ien of file 9.7, XPDNM=package name
+2 IF '$DATA(^XTMP("XPDI",XPDA))!'$DATA(^XPD(9.7,XPDA,0))
QUIT
+3 ;check if already installed
+4 IF $PIECE($GET(^XPD(9.7,XPDA,1)),U,3)
DO BMES^XPDUTL(" "_XPDNM_" Already Installed ")
QUIT
+5 NEW DIFROM,XPD,XPD0,XPDBLD,XPDCHECK,XPDCP,XPDI,XPDGREF,XPDIST,XPDIDTOT,XPDIDCNT,XPDIDMOD,XPDRTN
+6 ;XPDBLD subscript for build entry i.e. ^XTMP("XPDI",XPDA,"BLD",XPDBLD
+7 SET DIFROM=$$VER^XPDUTL(XPDNM)
SET XPDBLD=$ORDER(^XTMP("XPDI",XPDA,"BLD",0))
SET XPDGREF="^XTMP(""XPDI"","_XPDA_",""TEMP"")"
+8 DO TITLE^XPDID(XPDNM)
+9 ;^XTMP("XPDI",XPDA,"BLD",XPDBLD,6) is set when the msg is loaded. Forum adds this as the last line of the msg.
+10 ;add Package file entry if sent, set TEST # & SEQ #
+11 SET Y=$$PKGADD^XPDIP
SET XPD0=^XTMP("XPDI",XPDA,"BLD",XPDBLD,0)
SET Y=$GET(^(6))
SET XPDNM("TST")=$PIECE(Y,U)
SET XPDNM("SEQ")=$PIECE(Y,U,2)
+12 IF '$$CHK(11)
Begin DoDot:1
+13 DO BMES^XPDUTL(" Install Started for "_XPDNM_" : ")
DO STMP(11)
+14 ;update status, installed by fields and distribution date
+15 SET XPD(9.7,XPDA_",",.02)=2
SET XPD(9.7,XPDA_",",9)=DUZ
SET XPD(9.7,XPDA_",",51)=$PIECE(XPD0,U,4)
+16 DO FILE^DIE("","XPD")
End DoDot:1
+17 IF '$TEST
DO BMES^XPDUTL(" Install Restarted for "_XPDNM_" at "_$$HTE^XLFDT($HOROLOG))
+18 DO BMES^XPDUTL("Build Distribution Date: "_$$FMTE^XLFDT($PIECE(XPD0,U,4)))
+19 DO RTN
IF $DATA(XPDABORT)
QUIT
+20 DO PRE
IF $DATA(XPDABORT)
QUIT
+21 DO FMDATA
IF $DATA(XPDABORT)
QUIT
+22 DO COMP
IF $DATA(XPDABORT)
QUIT
+23 IF $GET(XPDT("MASTER"))'=XPDA
DO POST
+24 ;Finshed
QUIT
+25 ;
RTN IF '$$CHK(12)
Begin DoDot:1
+1 DO BMES^XPDUTL(" Installing Routines:")
DO SETTOT^XPDID(9.8)
DO RTN^XPDIJ(XPDA)
DO STMP(12)
End DoDot:1
+2 IF '$TEST
DO BMES^XPDUTL(" Routines already installed.")
+3 QUIT
+4 ;
PRE SET XPDCP="INI"
+1 ;check if pre-install has completed
+2 IF '$$VERCP^XPDUTL("XPD PREINSTALL COMPLETED")
Begin DoDot:1
+3 ;setup XPDQUES array with pre-install questions/answers
+4 DO QUES^XPDIQ("PRE")
+5 ;XPDCHECK=ien of current checkpoint, (0)=name of checkpoint
+6 ;XPDCP="INI"-pre install or "INIT"-post install
+7 ;loop thru check points starting with INSTALL STARTED
+8 SET XPDCHECK=1
+9 FOR
SET XPDCHECK=$ORDER(^XPD(9.7,XPDA,"INI",XPDCHECK))
IF 'XPDCHECK
QUIT
SET XPD=^(XPDCHECK,0)
Begin DoDot:2
+10 ;if there is no call back, quit
+11 IF $GET(^XPD(9.7,XPDA,"INI",XPDCHECK,1))=""
QUIT
SET XPDRTN=^(1)
+12 ;check if checkpoint has been completed
+13 IF $PIECE(XPD,U,2)
QUIT
+14 IF XPDCHECK=2
DO BMES^XPDUTL(" Running Pre-Install Routine: "_XPDRTN)
+15 ;zero the progress bar
+16 IF $DATA(XPDIDVT)
SET XPDIDTOT=0
DO UPDATE^XPDID(0)
+17 DO @XPDRTN
+18 ;write message and abort if developer wants
+19 IF $DATA(XPDABORT)
DO BMES^XPDUTL("Install ** ABORTED ** in Pre-Install program")
QUIT
+20 SET %=$$COMCP^XPDUTL(XPDCHECK)
End DoDot:2
IF $DATA(XPDABORT)
QUIT
+21 IF $DATA(XPDABORT)
QUIT
+22 ;complete pre-init check point
+23 SET %=$$COMCP^XPDUTL("XPD PREINSTALL COMPLETED")
End DoDot:1
IF $DATA(XPDABORT)
QUIT
+24 IF '$TEST
DO BMES^XPDUTL(" Pre-Install already finished.")
+25 QUIT
+26 ;
FMDATA ;build XPDQUES arrays for all of the FM Files
+1 DO QUES^XPDIQ("XPF")
+2 ;check the last file and see if it's already installed
+3 SET XPD=$GET(^(+$ORDER(^XPD(9.7,XPDA,4,"A"),-1),0))
+4 IF '$PIECE(XPD,U,2)
IF $DATA(^XTMP("XPDI",XPDA,"FIA"))
Begin DoDot:1
+5 DO BMES^XPDUTL(" Installing Data Dictionaries: ")
DO SETTOT^XPDID(4)
DO FIA^XPDIK
DO MES^XPDUTL(" "_$$HTE^XLFDT($HOROLOG))
End DoDot:1
+6 IF '$TEST
DO BMES^XPDUTL(" Data Dictionaries already installed.")
+7 SET %=+$ORDER(^XTMP("XPDI",XPDA,"DATA",""),-1)
SET XPD=$GET(^XPD(9.7,XPDA,4,%,0))
+8 IF '$PIECE(XPD,U,3)
IF %
Begin DoDot:1
+9 DO BMES^XPDUTL(" Installing Data: ")
DO DAT^XPDIK
DO MES^XPDUTL(" "_$$HTE^XLFDT($HOROLOG))
End DoDot:1
+10 IF '$TEST
DO BMES^XPDUTL(" Data already installed.")
+11 QUIT
+12 ;
COMP SET (%,XPD)=""
+1 FOR
SET %=+$ORDER(^XPD(9.7,XPDA,"KRN",%))
IF '%
QUIT
SET XPD=$GET(^(%,0))
IF '$PIECE(XPD,U,2)
QUIT
+2 IF '$PIECE(XPD,U,2)
IF $DATA(^XTMP("XPDI",XPDA,"KRN"))
Begin DoDot:1
+3 DO BMES^XPDUTL(" Installing PACKAGE COMPONENTS: ")
DO KRN^XPDIK
DO MES^XPDUTL(" "_$$HTE^XLFDT($HOROLOG))
End DoDot:1
+4 IF '$TEST
DO BMES^XPDUTL(" PACKAGE COMPONENTS already installed.")
+5 QUIT
+6 ;
POST SET XPDCP="INIT"
+1 ;check if post-install has completed
+2 IF '$$VERCP^XPDUTL("XPD POSTINSTALL COMPLETED")
Begin DoDot:1
+3 ;setup XPDQUES array with post-install questions/answers
+4 DO QUES^XPDIQ("POS")
+5 ;loop thru check points starting with INSTALL STARTED
+6 SET XPDCHECK=1
+7 FOR
SET XPDCHECK=$ORDER(^XPD(9.7,XPDA,"INIT",XPDCHECK))
IF 'XPDCHECK
QUIT
SET XPD=^(XPDCHECK,0)
Begin DoDot:2
+8 ;if there is no call back, quit
+9 IF $GET(^XPD(9.7,XPDA,"INIT",XPDCHECK,1))=""
QUIT
SET XPDRTN=^(1)
+10 ;quit if checkpoint has completed time
+11 IF $PIECE(XPD,U,2)
QUIT
+12 IF XPDCHECK=2
DO BMES^XPDUTL(" Running Post-Install Routine: "_XPDRTN)
+13 ;zero the progress bar
+14 IF $DATA(XPDIDVT)
SET XPDIDTOT=0
DO UPDATE^XPDID(0)
+15 DO @XPDRTN
+16 ;write message and abort if developer wants
+17 IF $DATA(XPDABORT)
DO BMES^XPDUTL("Install ** ABORTED ** in Post-Install program")
QUIT
+18 SET %=$$COMCP^XPDUTL(XPDCHECK)
End DoDot:2
IF $DATA(XPDABORT)
QUIT
+19 IF $DATA(XPDABORT)
QUIT
+20 ;complete post-init check point
+21 SET %=$$COMCP^XPDUTL("XPD POSTINSTALL COMPLETED")
End DoDot:1
IF $DATA(XPDABORT)
QUIT
+22 IF '$TEST
DO BMES^XPDUTL(" Post-Install already finished.")
+23 ;move routines to install file & Routine file
+24 DO BMES^XPDUTL(" Updating Routine file...")
DO SETTOT^XPDID(9.8)
DO RTN^XPDIP
+25 ;XPDIST is flag for site tracking^A/B install message, it is set in PKG^XPDIP
+26 ;install Package file, OERR parameter multiple, and Build file
+27 SET XPDIST=""
DO BMES^XPDUTL(" Updating KIDS files...")
DO PKG^XPDIP
+28 DO BMES^XPDUTL(" "_XPDNM_" Installed. ")
DO STMP(17)
+29 ;sends install messages local/forum
+30 SET %=$$EN^XPDIST(XPDA,XPDIST)
DO BMES^XPDUTL(" "_$PIECE("NO ",U,'$PIECE(%,"#",2))_"Install Message sent "_%)
+31 QUIT
CHK(X) ;check checkpoints in file 9.7, X=field #, returns 1=completed, 0=not completed
+1 QUIT $$GET1^DIQ(9.7,XPDA_",",X,"I")]""
+2 ;
STMP(X) ;timestamp checkpoints in file 9.7, X=field #
+1 NEW XPD,%
+2 SET %=$$NOW^XLFDT
SET XPD(9.7,XPDA_",",X)=%
+3 DO MES^XPDUTL(" "_$$FMTE^XLFDT(%))
DO FILE^DIE("","XPD")
+4 QUIT
+5 ;
INHIBIT(SET) ;Set/Clear the Inhibit logon field.
+1 NEW VOL,IEN
+2 FOR IEN=0:0
SET IEN=$ORDER(^%ZIS(14.5,IEN))
IF IEN'>0
QUIT
Begin DoDot:1
+3 IF $PIECE(^%ZIS(14.5,IEN,0),U,11)=1
SET VOL(14.5,IEN_",",1)=SET
+4 QUIT
End DoDot:1
+5 DO FILE^DIE("","VOL")
+6 QUIT