XPDIJ1 ;SFISC/RSD - Cont. of Install Job ;11/13/97 09:12
;;8.0;KERNEL;**1005**;FEB 09, 1999
;;8.0;KERNEL;**41,68**;Jul 10, 1995
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,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)
;the $T is there only for installing patch 41 to prevent a noline error
;check that Package file has entry
I $T(PKGADD^XPDIP)]"" S Y=$$PKGADD^XPDIP
I '$$CHK(11) D
.D BMES^XPDUTL(" Install Started for "_XPDNM_" : "),STMP(11)
.;update status and installed by fields
.S XPD(9.7,XPDA_",",.02)=2,XPD(9.7,XPDA_",",9)=DUZ
.D FILE^DIE("","XPD")
E D BMES^XPDUTL(" Install Restarted for "_XPDNM_" at "_$$HTE^XLFDT($H))
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.")
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.")
;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.")
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.")
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
I $L(XPDIST) 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
XPDIJ1 ;SFISC/RSD - Cont. of Install Job ;11/13/97 09:12
+1 ;;8.0;KERNEL;**1005**;FEB 09, 1999
+2 ;;8.0;KERNEL;**41,68**;Jul 10, 1995
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,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 ;the $T is there only for installing patch 41 to prevent a noline error
+10 ;check that Package file has entry
+11 IF $TEXT(PKGADD^XPDIP)]""
SET Y=$$PKGADD^XPDIP
+12 IF '$$CHK(11)
Begin DoDot:1
+13 DO BMES^XPDUTL(" Install Started for "_XPDNM_" : ")
DO STMP(11)
+14 ;update status and installed by fields
+15 SET XPD(9.7,XPDA_",",.02)=2
SET XPD(9.7,XPDA_",",9)=DUZ
+16 DO FILE^DIE("","XPD")
End DoDot:1
+17 IF '$TEST
DO BMES^XPDUTL(" Install Restarted for "_XPDNM_" at "_$$HTE^XLFDT($HOROLOG))
+18 IF '$$CHK(12)
Begin DoDot:1
+19 DO BMES^XPDUTL(" Installing Routines:")
DO SETTOT^XPDID(9.8)
DO RTN^XPDIJ(XPDA)
DO STMP(12)
End DoDot:1
+20 IF '$TEST
DO BMES^XPDUTL(" Routines already installed.")
+21 SET XPDCP="INI"
+22 ;check if pre-install has completed
+23 IF '$$VERCP^XPDUTL("XPD PREINSTALL COMPLETED")
Begin DoDot:1
+24 ;setup XPDQUES array with pre-install questions/answers
+25 DO QUES^XPDIQ("PRE")
+26 ;XPDCHECK=ien of current checkpoint, (0)=name of checkpoint
+27 ;XPDCP="INI"-pre install or "INIT"-post install
+28 ;loop thru check points starting with INSTALL STARTED
+29 SET XPDCHECK=1
+30 FOR
SET XPDCHECK=$ORDER(^XPD(9.7,XPDA,"INI",XPDCHECK))
IF 'XPDCHECK
QUIT
SET XPD=^(XPDCHECK,0)
Begin DoDot:2
+31 ;if there is no call back, quit
+32 IF $GET(^XPD(9.7,XPDA,"INI",XPDCHECK,1))=""
QUIT
SET XPDRTN=^(1)
+33 ;check if checkpoint has been completed
+34 IF $PIECE(XPD,U,2)
QUIT
+35 IF XPDCHECK=2
DO BMES^XPDUTL(" Running Pre-Install Routine: "_XPDRTN)
+36 ;zero the progress bar
+37 IF $DATA(XPDIDVT)
SET XPDIDTOT=0
DO UPDATE^XPDID(0)
+38 DO @XPDRTN
+39 ;write message and abort if developer wants
+40 IF $DATA(XPDABORT)
DO BMES^XPDUTL("Install ** ABORTED ** in Pre-Install program")
QUIT
+41 SET %=$$COMCP^XPDUTL(XPDCHECK)
End DoDot:2
IF $DATA(XPDABORT)
QUIT
+42 IF $DATA(XPDABORT)
QUIT
+43 ;complete pre-init check point
+44 SET %=$$COMCP^XPDUTL("XPD PREINSTALL COMPLETED")
End DoDot:1
IF $DATA(XPDABORT)
QUIT
+45 IF '$TEST
DO BMES^XPDUTL(" Pre-Install already finished.")
+46 ;build XPDQUES arrays for all of the FM Files
+47 DO QUES^XPDIQ("XPF")
+48 ;check the last file and see if it's already installed
+49 SET XPD=$GET(^(+$ORDER(^XPD(9.7,XPDA,4,"A"),-1),0))
+50 IF '$PIECE(XPD,U,2)
IF $DATA(^XTMP("XPDI",XPDA,"FIA"))
Begin DoDot:1
+51 DO BMES^XPDUTL(" Installing Data Dictionaries: ")
DO SETTOT^XPDID(4)
DO FIA^XPDIK
DO MES^XPDUTL(" "_$$HTE^XLFDT($HOROLOG))
End DoDot:1
+52 IF '$TEST
DO BMES^XPDUTL(" Data Dictionaries already installed.")
+53 SET %=+$ORDER(^XTMP("XPDI",XPDA,"DATA",""),-1)
SET XPD=$GET(^XPD(9.7,XPDA,4,%,0))
+54 IF '$PIECE(XPD,U,3)
IF %
Begin DoDot:1
+55 DO BMES^XPDUTL(" Installing Data: ")
DO DAT^XPDIK
DO MES^XPDUTL(" "_$$HTE^XLFDT($HOROLOG))
End DoDot:1
+56 IF '$TEST
DO BMES^XPDUTL(" Data already installed.")
+57 SET (%,XPD)=""
+58 FOR
SET %=+$ORDER(^XPD(9.7,XPDA,"KRN",%))
IF '%
QUIT
SET XPD=$GET(^(%,0))
IF '$PIECE(XPD,U,2)
QUIT
+59 IF '$PIECE(XPD,U,2)
IF $DATA(^XTMP("XPDI",XPDA,"KRN"))
Begin DoDot:1
+60 DO BMES^XPDUTL(" Installing PACKAGE COMPONENTS: ")
DO KRN^XPDIK
DO MES^XPDUTL(" "_$$HTE^XLFDT($HOROLOG))
End DoDot:1
+61 IF '$TEST
DO BMES^XPDUTL(" PACKAGE COMPONENTS already installed.")
+62 SET XPDCP="INIT"
+63 ;check if post-install has completed
+64 IF '$$VERCP^XPDUTL("XPD POSTINSTALL COMPLETED")
Begin DoDot:1
+65 ;setup XPDQUES array with post-install questions/answers
+66 DO QUES^XPDIQ("POS")
+67 ;loop thru check points starting with INSTALL STARTED
+68 SET XPDCHECK=1
+69 FOR
SET XPDCHECK=$ORDER(^XPD(9.7,XPDA,"INIT",XPDCHECK))
IF 'XPDCHECK
QUIT
SET XPD=^(XPDCHECK,0)
Begin DoDot:2
+70 ;if there is no call back, quit
+71 IF $GET(^XPD(9.7,XPDA,"INIT",XPDCHECK,1))=""
QUIT
SET XPDRTN=^(1)
+72 ;quit if checkpoint has completed time
+73 IF $PIECE(XPD,U,2)
QUIT
+74 IF XPDCHECK=2
DO BMES^XPDUTL(" Running Post-Install Routine: "_XPDRTN)
+75 ;zero the progress bar
+76 IF $DATA(XPDIDVT)
SET XPDIDTOT=0
DO UPDATE^XPDID(0)
+77 DO @XPDRTN
+78 ;write message and abort if developer wants
+79 IF $DATA(XPDABORT)
DO BMES^XPDUTL("Install ** ABORTED ** in Post-Install program")
QUIT
+80 SET %=$$COMCP^XPDUTL(XPDCHECK)
End DoDot:2
IF $DATA(XPDABORT)
QUIT
+81 IF $DATA(XPDABORT)
QUIT
+82 ;complete post-init check point
+83 SET %=$$COMCP^XPDUTL("XPD POSTINSTALL COMPLETED")
End DoDot:1
IF $DATA(XPDABORT)
QUIT
+84 IF '$TEST
DO BMES^XPDUTL(" Post-Install already finished.")
+85 ;move routines to install file & Routine file
+86 DO BMES^XPDUTL(" Updating Routine file...")
DO SETTOT^XPDID(9.8)
DO RTN^XPDIP
+87 ;XPDIST is flag for site tracking^A/B install message, it is set in PKG^XPDIP
+88 ;install Package file, OERR parameter multiple, and Build file
+89 SET XPDIST=""
DO BMES^XPDUTL(" Updating KIDS files...")
DO PKG^XPDIP
+90 DO BMES^XPDUTL(" "_XPDNM_" Installed. ")
DO STMP(17)
+91 ;sends install messages
+92 IF $LENGTH(XPDIST)
SET %=$$EN^XPDIST(XPDA,XPDIST)
DO BMES^XPDUTL(" "_$PIECE("NO ",U,'$PIECE(%,"#",2))_"Install Message sent "_%)
+93 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