BCDMPRE ; IHS/OIT/MKK -- BCDM Version 1.0 ENVIRONMENT/POST INSTALL ROUTINE;JUL 16, 2008 3:19 PM
;;1.0;IHS CHRONIC DISEASE MANAGEMENT;;JUN 29, 2010
;
PRECHK ; EP
D BMES^XPDUTL("Beginning of Pre Check.")
NEW CP ; Current Patch
NEW LINE2 ; Second line of THIS Routine
NEW RPMS ; RPMS module being patched
NEW RPMSVER ; Version of RPMS module being patched
NEW STR ; String -- used as an array for messages.
NEW LASTPTCH ; Last Patch of Lab
NEW LSTPISTS ; Last Patch Install Status
NEW WOTERR ; Array of errors detected
;
S LINE2=$T(+2)
;
; Check for Cache environment
I $$UP^XLFSTR($$VERSION^%ZOSV(1))'["CACHE" D SORRY("NOT A CACHE ENVIRONMENT.") Q
;
; Current Patch
S CP=+$TR($P(LINE2,";",5),"*")
;
; Last Patch
S LASTPTCH=CP-1
I LASTPTCH<1 S LASTPTCH=0
;
; RPMS Module
S RPMS=$P(LINE2,";",4)
;
; Version of RPMS module being patched
S RPMSVER=$P(LINE2,";",3)
;
S XPDNOQUE="NO QUE" ; No Queuing Allowed
;
; The following line prevents the "Disable Options..." and "Move
; Routines..." questions from being asked during the install.
I $G(XPDENV)=1 S (XPDDIQ("XPZ1"),XPDDIQ("XPZ2"))=0
I $G(XPDENV)=1 S (XPDDIQ("XPZ1"),XPDDIQ("XPZ2"))=0
F X="XPO1","XPZ1","XPZ2","XPI1" S XPDDIQ(X)=0
;
S XPDABORT=0 ; KIDS install Flag
;
USERID ; CHECK FOR USER ID
I '$G(DUZ) D SORRY("DUZ UNDEFINED OR 0.",,,CP) Q
;
I '$L($G(DUZ(0))) D SORRY("DUZ(0) UNDEFINED OR NULL.",,,CP) Q
;
D HOME^%ZIS ; IO Defaults
D DTNOLF^DICRW ; Set DT variable without Doing a Line Feed
;
S X=$P($G(^VA(200,DUZ,0)),U)
I $G(X) D SORRY("Installer cannot be identified!",,,CP) Q
;
D OKAY("Pre Check complete.",5)
;
LETSGO ; USER IDENTIFIED -- LET'S GO
D BMES^XPDUTL("Hello, "_$P(X,",",2)_" "_$P(X,","))
;
FILEMAN ; CHECK FOR FILEMAN 22.0
D NEEDIT("DI","22.0",,.WOTERR)
;
KERNEL ; CHECK FOR KERNEL 8.0 & PATCH 1013
D NEEDIT("XU","8.0",1013,.WOTERR)
;
MAILMAN ; CHECK FOR MAILMAN 7.1
D NEEDIT("XM","7.1",,.WOTERR)
;
GIS ; CHECK FOR GIS 3.01 Patch 14
D NEEDIT("GIS","3.01",14,.WOTERR)
;
AUPN ; CHECK FOR AUPN 99.1 & PATCH 20
D NEEDIT("AUPN","99.1",20,.WOTERR)
;
AICD ; CHECK FOR AICD 3.51 & PATCH 7
D NEEDIT("AICD","3.51",7,.WOTERR)
;
AUT ; CHECK FOR AUT 98.1 & PATCH 16
D NEEDIT("AUT","98.1",16,.WOTERR)
;
BJPC ; CHECK FOR BJPC 2.0 & Patch 4
D NEEDIT("BJPC","2.0",4,.WOTERR)
;
ENVOK ; ENVIRONMENT OK
I XPDABORT<1 D BMES^XPDUTL("ENVIRONMENT OK.")
;
I XPDABORT>0 D SORRYEND(.WOTERR)
;
Q
;
BACKUP ; EP
D BACKUPS(0)
Q
;
POST ; EP -- POST INSTALL
NEW CP ; Current Patch
S CP=$TR($P($T(+2),";",5),"*")
;
D ALLDONE(CP) ; Complete Message
;
; Store # of times installation occurred as well as person & date/time
D ENDINSTL(CP)
;
Q
;
DEBUG ; Debugging node for environment checker
NEW DEBUG
S DEBUG="YES"
D PRECHK
Q
;
NEEDIT(MODULE,VERSION,PATCH,WOTERR,CP) ; EP
; Generic "Find RPMS Module's Version and (perhaps) Patch number"
;
; NOTE: The MODULE variable MUST be the PREFIX name
; from the PACKAGE file (9.4).
;
NEW NAME ; NAME of RPMS Module
NEW PTR ; PoinTeR to PACKAGE file
NEW HEREYAGO ; Array to store returned values from FIND^DIC
NEW STR1,STR2 ; Temporary Strings
;
; Use FileMan API to get information
D FIND^DIC(9.4,"","","",MODULE,"","C","","","HEREYAGO")
S PTR=$G(HEREYAGO("DILIST",2,1))
S NAME=$G(HEREYAGO("DILIST",1,1))
I $G(NAME)="" S NAME=MODULE
;
S X=$$VERSION^XPDUTL(MODULE) ; Get the Version
D BMES^XPDUTL("Need at least "_NAME_" "_VERSION)
I X<VERSION D Q
. S WOTERR(MODULE,NAME,VERSION)=""
. S STR1="Need "_NAME_" "_VERSION_" & "_NAME_" "_X_" found!"
. I $L(STR1)<58 D SORRY(STR1)
. I $L(STR1)>57 D
.. S STR1="Need "_NAME_" "_VERSION_" & "
.. S STR2=NAME_" "_X_" found!"
.. D SORRY(STR1,,STR2)
;
D OKAY(NAME_" "_X_" found.")
;
I $G(PATCH)="" Q ; If no Patch check, just exit
;
D BMES^XPDUTL(" Need "_NAME_" "_VERSION_" Patch "_PATCH_".")
S X=$$PATCH^XPDUTL(MODULE_"*"_VERSION_"*"_PATCH)
I X'=1 D Q
. S WOTERR(MODULE,NAME,VERSION)=$G(PATCH)
. S STR1=NAME_" "_VERSION_" Patch "_PATCH_" WAS NOT installed!"
. I $L(STR1)<58 D SORRY(STR1)
. I $L(STR1)>57 D
.. S STR1=NAME_" "_VERSION
.. S STR2="Patch "_PATCH_" WAS NOT installed!"
.. D SORRY(STR1,,STR2)
;
D OKAY(NAME_" "_VERSION_" Patch "_PATCH_" found.",10)
;
Q
;
SORRY(MSG,MODE,MSG2,CP) ; EP
; Error Message routine. It will send an ALERT and a MailMan message
; to the people who are assigned to the LMI Mail group (if it exists).
;
; The STR array is built so that the error/warning message will
; also appear on the INSTALL LOG via the D BMES^XPDUTL(.STR) call.
;
NEW MESSAGE
I $G(MODE)'["NONFATAL" D
. S MESSAGE="Install Aborting due to the following Systems Environment issue:"
. S XPDABORT=1 ; Fatal Error Flag Set
;
I $G(MODE)["NONFATAL" S MESSAGE="*** WARNING *** WARNING *** WARNING ***"
;
K DIFQ
;
NEW STR,LINECNT
S LINECNT=1
D ADDLINE($TR($J("",65)," ","*"),.LINECNT) ; Row of asterisks
D ADDLINE(" ",.LINECNT)
D ADDLINE($$CJ^XLFSTR("Site: "_$$LOC^XBFUNC,65),.LINECNT)
D ADDLINE(" ",.LINECNT)
D ADDLINE($$CJ^XLFSTR(MESSAGE,65),.LINECNT)
D ADDLINE(" ",.LINECNT)
D ADDLINE($$CJ^XLFSTR(">>> "_MSG_" <<<",65),.LINECNT)
I $D(MSG2) D ADDLINE($$CJ^XLFSTR(">>> "_MSG2_" <<<",65),.LINECNT)
D ADDLINE(" ",.LINECNT)
;
I $G(MODE)["NONFATAL" D ADDLINE($$CJ^XLFSTR(MESSAGE,65),.LINECNT)
;
I $G(MODE)'["NONFATAL" D
. D ADDLINE($$CJ^XLFSTR("Please print/capture this screen and",65),.LINECNT)
. D ADDLINE($$CJ^XLFSTR("notify the Support Center at",65),.LINECNT)
. D ADDLINE(" ",.LINECNT)
. D ADDLINE($$CJ^XLFSTR("1-888-830-7280.",65),.LINECNT)
. D ADDLINE(" ",.LINECNT)
;
D ADDLINE($TR($J("",65)," ","*"),.LINECNT) ; Row of asterisks
D ADDLINE(" ",.LINECNT)
;
D BMES^XPDUTL(.STR) ; Display the message
;
; If Debugging, just exit -- Don't send e-mail nor alert
I $G(DEBUG)="YES" Q
;
I $G(MODE)'="NONFATAL" D Q
. D SNDALERT(RPMS_" Version "_RPMSVER_" >> FATAL >> "_MSG)
. D SENDMAIL(RPMS_" Version "_RPMSVER_" Install FATAL Error")
;
I $G(MODE)="NONFATAL" D
. D SNDALERT(RPMS_" Version "_RPMSVER_" - "_MODE_" - "_MSG)
. D SENDMAIL(RPMS_" Version "_RPMSVER_" Install NONFATAL Error")
Q
;
SNDALERT(ALERTMSG) ; EP
; Send alert to LMI group
S XQAMSG=ALERTMSG
S XQA("G.LMI")=""
D SETUP^XQALERT
K XQA,XQAMSG
Q
;
SENDMAIL(MAILMSG) ; EP
; Send MailMan E-mail to LMI group -- message is in the STR array
K XMY
S XMY("G.LMI")="" ; Group
S %DT="T"
S X="NOW"
D ^%DT
D DD^LRX
S LRBLNOW=Y
;
S XMSUB=MAILMSG
S XMTEXT="STR("
S XMDUZ=$P($G(^VA(200,DUZ,0)),U)
;
D ^XMD ; Send the MailMan e-mail
;
K X,XMDUZ,XMSUB,XMTEXT,Y ; Cleanup
Q
;
SORRYEND(WOTERR,CP) ; EP
; Output a listing of ALL the errors detected during
; the environment check. The STR array will be
; displayed by the BMES^XPDUTL call.
;
NEW STR,MODULE,NAME,VERSION,PATCH,LINECNT,TMP
;
D SORRYHED
;
; Add ALL the errors detected to the STR array
S (MODULE,NAME,VERSION)=""
F S MODULE=$O(WOTERR(MODULE)) Q:MODULE="" D
. F S NAME=$O(WOTERR(MODULE,NAME)) Q:NAME="" D
.. F S VERSION=$O(WOTERR(MODULE,NAME,VERSION)) Q:VERSION="" D
... D ADDMESG
;
D SORRYFIN
;
D BMES^XPDUTL(.STR) ; Display the message in the STR array
;
Q
;
SORRYHED ; EP
; "Header" of Final Fatal Message
S LINECNT=1
D ADDLINE(" ",.LINECNT)
D ADDLINE($TR($J("",65)," ","*"),.LINECNT)
D ADDLINE(" ",.LINECNT)
D ADDLINE($$CJ^XLFSTR("Systems Environment Error Detected",65),.LINECNT)
D ADDLINE($$CJ^XLFSTR("KIDS build will be deleted",65),.LINECNT)
D ADDLINE(" ",.LINECNT)
D ADDLINE($$CJ^XLFSTR("Modules with Version or Patch errors",65),.LINECNT)
D ADDLINE(" ",.LINECNT)
Q
;
SORRYFIN ; EP
; "Fin" of Final Fatal Message
D ADDLINE($$CJ^XLFSTR("Re-Installation will be necessary.",65),.LINECNT)
D ADDLINE(" ",.LINECNT)
D ADDLINE($$CJ^XLFSTR("If assistance is needed, please call 1-888-830-7280.",65),.LINECNT)
D ADDLINE(" ",.LINECNT)
D ADDLINE($TR($J("",65)," ","*"),.LINECNT)
D ADDLINE(" ",.LINECNT)
Q
;
ADDMESG ; EP
; Add to the STR array
S PATCH=$G(WOTERR(MODULE,NAME,VERSION))
D ADDLINE($$CJ^XLFSTR(NAME_" ("_MODULE_")",65),.LINECNT)
;
S TMP="Version:"_VERSION
I $G(PATCH)'="" S TMP=TMP_" Patch:"_$G(PATCH)
;
D ADDLINE($$CJ^XLFSTR(TMP,65),.LINECNT)
D ADDLINE(" ",.LINECNT)
Q
;
ADDLINE(ASTR,LC) ; EP
; Add a line to the STR array
I $G(ASTR)="" S ASTR=" "
S STR(LC)=ASTR
S LC=LC+1
Q
;
OKAY(MSG,TAB) ; EP
; Write out "OKAY" message
NEW MESSAGE
I $G(TAB)="" S TAB=5
S MESSAGE=$J("",TAB)_MSG_" OK."
D MES^XPDUTL(MESSAGE)
Q
;
BACKUPS(CURPATCH) ; EP - CHECK TO CONFIRM BACKUPS HAVE BEEN DONE
D BMES^XPDUTL("BACKUPS Check Next.")
;
W !!
D ^XBFMK ; Clear all FileMan variables
S DIR(0)="Y"
S DIR("B")="NO"
S DIR("A")="Has a SUCCESSFUL system backup been performed??"
D ^DIR
;
; IF and ONLY IF backups not confirmed, send NONFATAL alert & e-mail.
I $D(DIRUT)!($G(Y)=0) D Q
. D SORRY("Please perform a successful backup before continuing!!","NONFATAL")
;
; User stated Backup has been Done, so display message.
S STR="BACKUPS CONFIRMED BY "_$P($G(^VA(200,DUZ,0)),U)_" ("_DUZ_") "
S STR=STR_$$UP^XLFSTR($$HTE^XLFDT($H,"MP"))
D TABMESG(STR,,". OK.","YES")
;
; Store backup confirmation person & date/time
NEW RPMS,RPMSVER ; Package & Version
NEW CP,BCKUPCNT ; Current Patch,Backup count
;
S RPMS=$P($T(+2),";",4) ; RPMS Module
S RPMSVER=$P($T(+2),";",3) ; Version of RPMS module
;
S CP=+$G(CURPATCH)
;
S BCKUPCNT=1+$O(^BCDMINST(RPMS,RPMSVER,+$G(CP),"BACKUP CONFIRMED BY",""),-1)
S ^BCDMINST(RPMS,RPMSVER,CP,"BACKUP CONFIRMED BY",BCKUPCNT,+$G(DUZ))=$P($G(^VA(200,DUZ,0)),U)
S ^BCDMINST(RPMS,RPMSVER,CP,"BACKUP CONFIRMED BY",BCKUPCNT,+$G(DUZ),"DATE/TIME")=$$UP^XLFSTR($$HTE^XLFDT($H,"MP"))
;
Q
;
TABMESG(MSG,TAB,TAIL,XTRALINE) ; EP
; Generic message output WITH blank line BEFORE messsage & TAB
NEW MESSAGE
I $G(TAB)="" S TAB=5
S MESSAGE=$J("",TAB)_MSG
I $G(TAIL)'="" S MESSAGE=MESSAGE_TAIL
D BMES^XPDUTL(MESSAGE)
I $D(XTRALINE) D MES^XPDUTL(" ") ; Write Blank line AFTER message, also
Q
;
; Generic message output WITHOUT blank line BEFORE messsage & TAB
NEW MESSAGE
I $G(TAB)="" S TAB=5
S MESSAGE=$J("",TAB)_MSG
I $G(TAIL)'="" S MESSAGE=MESSAGE_" "_TAIL
D MES^XPDUTL(MESSAGE)
Q
;
ALLDONE(CURPATCH) ; EP
; Complete Message
NEW LINE2,LINECNT,MSG,RPMS,RPMSVER,STR
;
S LINE2=$T(+2)
;
; RPMS Module
S RPMS=$P(LINE2,";",4)
;
; Version of RPMS module
S RPMSVER=$P(LINE2,";",3)
;
S MSG=RPMS_" Version "_RPMSVER_" INSTALL complete."
;
I $G(CURPATCH)'="" S MSG=RPMS_" Version "_RPMSVER_" Patch "_CURPATCH_" INSTALL complete."
;
K STR
S LINECNT=1
D ADDLINE($TR($J("",65)," ","*"),.LINECNT) ; Row of asterisks
D ADDLINE(" ",.LINECNT)
D ADDLINE($$CJ^XLFSTR("Site: "_$$LOC^XBFUNC,65),.LINECNT)
D ADDLINE(" ",.LINECNT)
D ADDLINE($$CJ^XLFSTR(MSG,65),.LINECNT)
D ADDLINE(" ",.LINECNT)
D ADDLINE($TR($J("",65)," ","*"),.LINECNT)
D ADDLINE(" ",.LINECNT)
;
D BMES^XPDUTL(.STR) ; Display the message
;
I $G(DEBUG)="YES" Q
;
D SNDALERT(MSG)
D SENDMAIL(MSG)
;
Q
;
ENDINSTL(CURPATCH) ; EP
; Procedure that stores information into the ^BCDMINSTL global
; regarding # of times instllation occurred as well as the
; person who is installaing and the date/time of the install.
;
NEW INSTCNT,LINE2,MSG,CP,RPMS,RPMSVER
;
S LINE2=$T(+2)
;
S RPMS=$P(LINE2,";",4) ; RPMS Module
;
S RPMSVER=$P(LINE2,";",3) ; Version of RPMS module
;
S CP=+$G(CURPATCH) ; Current Patch Number
;
; Installation count
S INSTCNT=1+$O(^BCDMINST(RPMS,RPMSVER,CP,"INSTALLED BY",""),-1)
;
S ^BCDMINST(RPMS,RPMSVER,CP,"INSTALLED BY",INSTCNT,+$G(DUZ))=$P($G(^VA(200,+$G(DUZ),0)),U)
S ^BCDMINST(RPMS,RPMSVER,CP,"INSTALLED BY",INSTCNT,+$G(DUZ),"DATE/TIME")=$$UP^XLFSTR($$HTE^XLFDT($H,"MP"))
Q
BCDMPRE ; IHS/OIT/MKK -- BCDM Version 1.0 ENVIRONMENT/POST INSTALL ROUTINE;JUL 16, 2008 3:19 PM
+1 ;;1.0;IHS CHRONIC DISEASE MANAGEMENT;;JUN 29, 2010
+2 ;
PRECHK ; EP
+1 DO BMES^XPDUTL("Beginning of Pre Check.")
+2 ; Current Patch
NEW CP
+3 ; Second line of THIS Routine
NEW LINE2
+4 ; RPMS module being patched
NEW RPMS
+5 ; Version of RPMS module being patched
NEW RPMSVER
+6 ; String -- used as an array for messages.
NEW STR
+7 ; Last Patch of Lab
NEW LASTPTCH
+8 ; Last Patch Install Status
NEW LSTPISTS
+9 ; Array of errors detected
NEW WOTERR
+10 ;
+11 SET LINE2=$TEXT(+2)
+12 ;
+13 ; Check for Cache environment
+14 IF $$UP^XLFSTR($$VERSION^%ZOSV(1))'["CACHE"
DO SORRY("NOT A CACHE ENVIRONMENT.")
QUIT
+15 ;
+16 ; Current Patch
+17 SET CP=+$TRANSLATE($PIECE(LINE2,";",5),"*")
+18 ;
+19 ; Last Patch
+20 SET LASTPTCH=CP-1
+21 IF LASTPTCH<1
SET LASTPTCH=0
+22 ;
+23 ; RPMS Module
+24 SET RPMS=$PIECE(LINE2,";",4)
+25 ;
+26 ; Version of RPMS module being patched
+27 SET RPMSVER=$PIECE(LINE2,";",3)
+28 ;
+29 ; No Queuing Allowed
SET XPDNOQUE="NO QUE"
+30 ;
+31 ; The following line prevents the "Disable Options..." and "Move
+32 ; Routines..." questions from being asked during the install.
+33 IF $GET(XPDENV)=1
SET (XPDDIQ("XPZ1"),XPDDIQ("XPZ2"))=0
+34 IF $GET(XPDENV)=1
SET (XPDDIQ("XPZ1"),XPDDIQ("XPZ2"))=0
+35 FOR X="XPO1","XPZ1","XPZ2","XPI1"
SET XPDDIQ(X)=0
+36 ;
+37 ; KIDS install Flag
SET XPDABORT=0
+38 ;
USERID ; CHECK FOR USER ID
+1 IF '$GET(DUZ)
DO SORRY("DUZ UNDEFINED OR 0.",,,CP)
QUIT
+2 ;
+3 IF '$LENGTH($GET(DUZ(0)))
DO SORRY("DUZ(0) UNDEFINED OR NULL.",,,CP)
QUIT
+4 ;
+5 ; IO Defaults
DO HOME^%ZIS
+6 ; Set DT variable without Doing a Line Feed
DO DTNOLF^DICRW
+7 ;
+8 SET X=$PIECE($GET(^VA(200,DUZ,0)),U)
+9 IF $GET(X)
DO SORRY("Installer cannot be identified!",,,CP)
QUIT
+10 ;
+11 DO OKAY("Pre Check complete.",5)
+12 ;
LETSGO ; USER IDENTIFIED -- LET'S GO
+1 DO BMES^XPDUTL("Hello, "_$PIECE(X,",",2)_" "_$PIECE(X,","))
+2 ;
FILEMAN ; CHECK FOR FILEMAN 22.0
+1 DO NEEDIT("DI","22.0",,.WOTERR)
+2 ;
KERNEL ; CHECK FOR KERNEL 8.0 & PATCH 1013
+1 DO NEEDIT("XU","8.0",1013,.WOTERR)
+2 ;
MAILMAN ; CHECK FOR MAILMAN 7.1
+1 DO NEEDIT("XM","7.1",,.WOTERR)
+2 ;
GIS ; CHECK FOR GIS 3.01 Patch 14
+1 DO NEEDIT("GIS","3.01",14,.WOTERR)
+2 ;
AUPN ; CHECK FOR AUPN 99.1 & PATCH 20
+1 DO NEEDIT("AUPN","99.1",20,.WOTERR)
+2 ;
AICD ; CHECK FOR AICD 3.51 & PATCH 7
+1 DO NEEDIT("AICD","3.51",7,.WOTERR)
+2 ;
AUT ; CHECK FOR AUT 98.1 & PATCH 16
+1 DO NEEDIT("AUT","98.1",16,.WOTERR)
+2 ;
BJPC ; CHECK FOR BJPC 2.0 & Patch 4
+1 DO NEEDIT("BJPC","2.0",4,.WOTERR)
+2 ;
ENVOK ; ENVIRONMENT OK
+1 IF XPDABORT<1
DO BMES^XPDUTL("ENVIRONMENT OK.")
+2 ;
+3 IF XPDABORT>0
DO SORRYEND(.WOTERR)
+4 ;
+5 QUIT
+6 ;
BACKUP ; EP
+1 DO BACKUPS(0)
+2 QUIT
+3 ;
POST ; EP -- POST INSTALL
+1 ; Current Patch
NEW CP
+2 SET CP=$TRANSLATE($PIECE($TEXT(+2),";",5),"*")
+3 ;
+4 ; Complete Message
DO ALLDONE(CP)
+5 ;
+6 ; Store # of times installation occurred as well as person & date/time
+7 DO ENDINSTL(CP)
+8 ;
+9 QUIT
+10 ;
DEBUG ; Debugging node for environment checker
+1 NEW DEBUG
+2 SET DEBUG="YES"
+3 DO PRECHK
+4 QUIT
+5 ;
NEEDIT(MODULE,VERSION,PATCH,WOTERR,CP) ; EP
+1 ; Generic "Find RPMS Module's Version and (perhaps) Patch number"
+2 ;
+3 ; NOTE: The MODULE variable MUST be the PREFIX name
+4 ; from the PACKAGE file (9.4).
+5 ;
+6 ; NAME of RPMS Module
NEW NAME
+7 ; PoinTeR to PACKAGE file
NEW PTR
+8 ; Array to store returned values from FIND^DIC
NEW HEREYAGO
+9 ; Temporary Strings
NEW STR1,STR2
+10 ;
+11 ; Use FileMan API to get information
+12 DO FIND^DIC(9.4,"","","",MODULE,"","C","","","HEREYAGO")
+13 SET PTR=$GET(HEREYAGO("DILIST",2,1))
+14 SET NAME=$GET(HEREYAGO("DILIST",1,1))
+15 IF $GET(NAME)=""
SET NAME=MODULE
+16 ;
+17 ; Get the Version
SET X=$$VERSION^XPDUTL(MODULE)
+18 DO BMES^XPDUTL("Need at least "_NAME_" "_VERSION)
+19 IF X<VERSION
Begin DoDot:1
+20 SET WOTERR(MODULE,NAME,VERSION)=""
+21 SET STR1="Need "_NAME_" "_VERSION_" & "_NAME_" "_X_" found!"
+22 IF $LENGTH(STR1)<58
DO SORRY(STR1)
+23 IF $LENGTH(STR1)>57
Begin DoDot:2
+24 SET STR1="Need "_NAME_" "_VERSION_" & "
+25 SET STR2=NAME_" "_X_" found!"
+26 DO SORRY(STR1,,STR2)
End DoDot:2
End DoDot:1
QUIT
+27 ;
+28 DO OKAY(NAME_" "_X_" found.")
+29 ;
+30 ; If no Patch check, just exit
IF $GET(PATCH)=""
QUIT
+31 ;
+32 DO BMES^XPDUTL(" Need "_NAME_" "_VERSION_" Patch "_PATCH_".")
+33 SET X=$$PATCH^XPDUTL(MODULE_"*"_VERSION_"*"_PATCH)
+34 IF X'=1
Begin DoDot:1
+35 SET WOTERR(MODULE,NAME,VERSION)=$GET(PATCH)
+36 SET STR1=NAME_" "_VERSION_" Patch "_PATCH_" WAS NOT installed!"
+37 IF $LENGTH(STR1)<58
DO SORRY(STR1)
+38 IF $LENGTH(STR1)>57
Begin DoDot:2
+39 SET STR1=NAME_" "_VERSION
+40 SET STR2="Patch "_PATCH_" WAS NOT installed!"
+41 DO SORRY(STR1,,STR2)
End DoDot:2
End DoDot:1
QUIT
+42 ;
+43 DO OKAY(NAME_" "_VERSION_" Patch "_PATCH_" found.",10)
+44 ;
+45 QUIT
+46 ;
SORRY(MSG,MODE,MSG2,CP) ; EP
+1 ; Error Message routine. It will send an ALERT and a MailMan message
+2 ; to the people who are assigned to the LMI Mail group (if it exists).
+3 ;
+4 ; The STR array is built so that the error/warning message will
+5 ; also appear on the INSTALL LOG via the D BMES^XPDUTL(.STR) call.
+6 ;
+7 NEW MESSAGE
+8 IF $GET(MODE)'["NONFATAL"
Begin DoDot:1
+9 SET MESSAGE="Install Aborting due to the following Systems Environment issue:"
+10 ; Fatal Error Flag Set
SET XPDABORT=1
End DoDot:1
+11 ;
+12 IF $GET(MODE)["NONFATAL"
SET MESSAGE="*** WARNING *** WARNING *** WARNING ***"
+13 ;
+14 KILL DIFQ
+15 ;
+16 NEW STR,LINECNT
+17 SET LINECNT=1
+18 ; Row of asterisks
DO ADDLINE($TRANSLATE($JUSTIFY("",65)," ","*"),.LINECNT)
+19 DO ADDLINE(" ",.LINECNT)
+20 DO ADDLINE($$CJ^XLFSTR("Site: "_$$LOC^XBFUNC,65),.LINECNT)
+21 DO ADDLINE(" ",.LINECNT)
+22 DO ADDLINE($$CJ^XLFSTR(MESSAGE,65),.LINECNT)
+23 DO ADDLINE(" ",.LINECNT)
+24 DO ADDLINE($$CJ^XLFSTR(">>> "_MSG_" <<<",65),.LINECNT)
+25 IF $DATA(MSG2)
DO ADDLINE($$CJ^XLFSTR(">>> "_MSG2_" <<<",65),.LINECNT)
+26 DO ADDLINE(" ",.LINECNT)
+27 ;
+28 IF $GET(MODE)["NONFATAL"
DO ADDLINE($$CJ^XLFSTR(MESSAGE,65),.LINECNT)
+29 ;
+30 IF $GET(MODE)'["NONFATAL"
Begin DoDot:1
+31 DO ADDLINE($$CJ^XLFSTR("Please print/capture this screen and",65),.LINECNT)
+32 DO ADDLINE($$CJ^XLFSTR("notify the Support Center at",65),.LINECNT)
+33 DO ADDLINE(" ",.LINECNT)
+34 DO ADDLINE($$CJ^XLFSTR("1-888-830-7280.",65),.LINECNT)
+35 DO ADDLINE(" ",.LINECNT)
End DoDot:1
+36 ;
+37 ; Row of asterisks
DO ADDLINE($TRANSLATE($JUSTIFY("",65)," ","*"),.LINECNT)
+38 DO ADDLINE(" ",.LINECNT)
+39 ;
+40 ; Display the message
DO BMES^XPDUTL(.STR)
+41 ;
+42 ; If Debugging, just exit -- Don't send e-mail nor alert
+43 IF $GET(DEBUG)="YES"
QUIT
+44 ;
+45 IF $GET(MODE)'="NONFATAL"
Begin DoDot:1
+46 DO SNDALERT(RPMS_" Version "_RPMSVER_" >> FATAL >> "_MSG)
+47 DO SENDMAIL(RPMS_" Version "_RPMSVER_" Install FATAL Error")
End DoDot:1
QUIT
+48 ;
+49 IF $GET(MODE)="NONFATAL"
Begin DoDot:1
+50 DO SNDALERT(RPMS_" Version "_RPMSVER_" - "_MODE_" - "_MSG)
+51 DO SENDMAIL(RPMS_" Version "_RPMSVER_" Install NONFATAL Error")
End DoDot:1
+52 QUIT
+53 ;
SNDALERT(ALERTMSG) ; EP
+1 ; Send alert to LMI group
+2 SET XQAMSG=ALERTMSG
+3 SET XQA("G.LMI")=""
+4 DO SETUP^XQALERT
+5 KILL XQA,XQAMSG
+6 QUIT
+7 ;
SENDMAIL(MAILMSG) ; EP
+1 ; Send MailMan E-mail to LMI group -- message is in the STR array
+2 KILL XMY
+3 ; Group
SET XMY("G.LMI")=""
+4 SET %DT="T"
+5 SET X="NOW"
+6 DO ^%DT
+7 DO DD^LRX
+8 SET LRBLNOW=Y
+9 ;
+10 SET XMSUB=MAILMSG
+11 SET XMTEXT="STR("
+12 SET XMDUZ=$PIECE($GET(^VA(200,DUZ,0)),U)
+13 ;
+14 ; Send the MailMan e-mail
DO ^XMD
+15 ;
+16 ; Cleanup
KILL X,XMDUZ,XMSUB,XMTEXT,Y
+17 QUIT
+18 ;
SORRYEND(WOTERR,CP) ; EP
+1 ; Output a listing of ALL the errors detected during
+2 ; the environment check. The STR array will be
+3 ; displayed by the BMES^XPDUTL call.
+4 ;
+5 NEW STR,MODULE,NAME,VERSION,PATCH,LINECNT,TMP
+6 ;
+7 DO SORRYHED
+8 ;
+9 ; Add ALL the errors detected to the STR array
+10 SET (MODULE,NAME,VERSION)=""
+11 FOR
SET MODULE=$ORDER(WOTERR(MODULE))
IF MODULE=""
QUIT
Begin DoDot:1
+12 FOR
SET NAME=$ORDER(WOTERR(MODULE,NAME))
IF NAME=""
QUIT
Begin DoDot:2
+13 FOR
SET VERSION=$ORDER(WOTERR(MODULE,NAME,VERSION))
IF VERSION=""
QUIT
Begin DoDot:3
+14 DO ADDMESG
End DoDot:3
End DoDot:2
End DoDot:1
+15 ;
+16 DO SORRYFIN
+17 ;
+18 ; Display the message in the STR array
DO BMES^XPDUTL(.STR)
+19 ;
+20 QUIT
+21 ;
SORRYHED ; EP
+1 ; "Header" of Final Fatal Message
+2 SET LINECNT=1
+3 DO ADDLINE(" ",.LINECNT)
+4 DO ADDLINE($TRANSLATE($JUSTIFY("",65)," ","*"),.LINECNT)
+5 DO ADDLINE(" ",.LINECNT)
+6 DO ADDLINE($$CJ^XLFSTR("Systems Environment Error Detected",65),.LINECNT)
+7 DO ADDLINE($$CJ^XLFSTR("KIDS build will be deleted",65),.LINECNT)
+8 DO ADDLINE(" ",.LINECNT)
+9 DO ADDLINE($$CJ^XLFSTR("Modules with Version or Patch errors",65),.LINECNT)
+10 DO ADDLINE(" ",.LINECNT)
+11 QUIT
+12 ;
SORRYFIN ; EP
+1 ; "Fin" of Final Fatal Message
+2 DO ADDLINE($$CJ^XLFSTR("Re-Installation will be necessary.",65),.LINECNT)
+3 DO ADDLINE(" ",.LINECNT)
+4 DO ADDLINE($$CJ^XLFSTR("If assistance is needed, please call 1-888-830-7280.",65),.LINECNT)
+5 DO ADDLINE(" ",.LINECNT)
+6 DO ADDLINE($TRANSLATE($JUSTIFY("",65)," ","*"),.LINECNT)
+7 DO ADDLINE(" ",.LINECNT)
+8 QUIT
+9 ;
ADDMESG ; EP
+1 ; Add to the STR array
+2 SET PATCH=$GET(WOTERR(MODULE,NAME,VERSION))
+3 DO ADDLINE($$CJ^XLFSTR(NAME_" ("_MODULE_")",65),.LINECNT)
+4 ;
+5 SET TMP="Version:"_VERSION
+6 IF $GET(PATCH)'=""
SET TMP=TMP_" Patch:"_$GET(PATCH)
+7 ;
+8 DO ADDLINE($$CJ^XLFSTR(TMP,65),.LINECNT)
+9 DO ADDLINE(" ",.LINECNT)
+10 QUIT
+11 ;
ADDLINE(ASTR,LC) ; EP
+1 ; Add a line to the STR array
+2 IF $GET(ASTR)=""
SET ASTR=" "
+3 SET STR(LC)=ASTR
+4 SET LC=LC+1
+5 QUIT
+6 ;
OKAY(MSG,TAB) ; EP
+1 ; Write out "OKAY" message
+2 NEW MESSAGE
+3 IF $GET(TAB)=""
SET TAB=5
+4 SET MESSAGE=$JUSTIFY("",TAB)_MSG_" OK."
+5 DO MES^XPDUTL(MESSAGE)
+6 QUIT
+7 ;
BACKUPS(CURPATCH) ; EP - CHECK TO CONFIRM BACKUPS HAVE BEEN DONE
+1 DO BMES^XPDUTL("BACKUPS Check Next.")
+2 ;
+3 WRITE !!
+4 ; Clear all FileMan variables
DO ^XBFMK
+5 SET DIR(0)="Y"
+6 SET DIR("B")="NO"
+7 SET DIR("A")="Has a SUCCESSFUL system backup been performed??"
+8 DO ^DIR
+9 ;
+10 ; IF and ONLY IF backups not confirmed, send NONFATAL alert & e-mail.
+11 IF $DATA(DIRUT)!($GET(Y)=0)
Begin DoDot:1
+12 DO SORRY("Please perform a successful backup before continuing!!","NONFATAL")
End DoDot:1
QUIT
+13 ;
+14 ; User stated Backup has been Done, so display message.
+15 SET STR="BACKUPS CONFIRMED BY "_$PIECE($GET(^VA(200,DUZ,0)),U)_" ("_DUZ_") "
+16 SET STR=STR_$$UP^XLFSTR($$HTE^XLFDT($HOROLOG,"MP"))
+17 DO TABMESG(STR,,". OK.","YES")
+18 ;
+19 ; Store backup confirmation person & date/time
+20 ; Package & Version
NEW RPMS,RPMSVER
+21 ; Current Patch,Backup count
NEW CP,BCKUPCNT
+22 ;
+23 ; RPMS Module
SET RPMS=$PIECE($TEXT(+2),";",4)
+24 ; Version of RPMS module
SET RPMSVER=$PIECE($TEXT(+2),";",3)
+25 ;
+26 SET CP=+$GET(CURPATCH)
+27 ;
+28 SET BCKUPCNT=1+$ORDER(^BCDMINST(RPMS,RPMSVER,+$GET(CP),"BACKUP CONFIRMED BY",""),-1)
+29 SET ^BCDMINST(RPMS,RPMSVER,CP,"BACKUP CONFIRMED BY",BCKUPCNT,+$GET(DUZ))=$PIECE($GET(^VA(200,DUZ,0)),U)
+30 SET ^BCDMINST(RPMS,RPMSVER,CP,"BACKUP CONFIRMED BY",BCKUPCNT,+$GET(DUZ),"DATE/TIME")=$$UP^XLFSTR($$HTE^XLFDT($HOROLOG,"MP"))
+31 ;
+32 QUIT
+33 ;
TABMESG(MSG,TAB,TAIL,XTRALINE) ; EP
+1 ; Generic message output WITH blank line BEFORE messsage & TAB
+2 NEW MESSAGE
+3 IF $GET(TAB)=""
SET TAB=5
+4 SET MESSAGE=$JUSTIFY("",TAB)_MSG
+5 IF $GET(TAIL)'=""
SET MESSAGE=MESSAGE_TAIL
+6 DO BMES^XPDUTL(MESSAGE)
+7 ; Write Blank line AFTER message, also
IF $DATA(XTRALINE)
DO MES^XPDUTL(" ")
+8 QUIT
+9 ;
+1 ; Generic message output WITHOUT blank line BEFORE messsage & TAB
+2 NEW MESSAGE
+3 IF $GET(TAB)=""
SET TAB=5
+4 SET MESSAGE=$JUSTIFY("",TAB)_MSG
+5 IF $GET(TAIL)'=""
SET MESSAGE=MESSAGE_" "_TAIL
+6 DO MES^XPDUTL(MESSAGE)
+7 QUIT
+8 ;
ALLDONE(CURPATCH) ; EP
+1 ; Complete Message
+2 NEW LINE2,LINECNT,MSG,RPMS,RPMSVER,STR
+3 ;
+4 SET LINE2=$TEXT(+2)
+5 ;
+6 ; RPMS Module
+7 SET RPMS=$PIECE(LINE2,";",4)
+8 ;
+9 ; Version of RPMS module
+10 SET RPMSVER=$PIECE(LINE2,";",3)
+11 ;
+12 SET MSG=RPMS_" Version "_RPMSVER_" INSTALL complete."
+13 ;
+14 IF $GET(CURPATCH)'=""
SET MSG=RPMS_" Version "_RPMSVER_" Patch "_CURPATCH_" INSTALL complete."
+15 ;
+16 KILL STR
+17 SET LINECNT=1
+18 ; Row of asterisks
DO ADDLINE($TRANSLATE($JUSTIFY("",65)," ","*"),.LINECNT)
+19 DO ADDLINE(" ",.LINECNT)
+20 DO ADDLINE($$CJ^XLFSTR("Site: "_$$LOC^XBFUNC,65),.LINECNT)
+21 DO ADDLINE(" ",.LINECNT)
+22 DO ADDLINE($$CJ^XLFSTR(MSG,65),.LINECNT)
+23 DO ADDLINE(" ",.LINECNT)
+24 DO ADDLINE($TRANSLATE($JUSTIFY("",65)," ","*"),.LINECNT)
+25 DO ADDLINE(" ",.LINECNT)
+26 ;
+27 ; Display the message
DO BMES^XPDUTL(.STR)
+28 ;
+29 IF $GET(DEBUG)="YES"
QUIT
+30 ;
+31 DO SNDALERT(MSG)
+32 DO SENDMAIL(MSG)
+33 ;
+34 QUIT
+35 ;
ENDINSTL(CURPATCH) ; EP
+1 ; Procedure that stores information into the ^BCDMINSTL global
+2 ; regarding # of times instllation occurred as well as the
+3 ; person who is installaing and the date/time of the install.
+4 ;
+5 NEW INSTCNT,LINE2,MSG,CP,RPMS,RPMSVER
+6 ;
+7 SET LINE2=$TEXT(+2)
+8 ;
+9 ; RPMS Module
SET RPMS=$PIECE(LINE2,";",4)
+10 ;
+11 ; Version of RPMS module
SET RPMSVER=$PIECE(LINE2,";",3)
+12 ;
+13 ; Current Patch Number
SET CP=+$GET(CURPATCH)
+14 ;
+15 ; Installation count
+16 SET INSTCNT=1+$ORDER(^BCDMINST(RPMS,RPMSVER,CP,"INSTALLED BY",""),-1)
+17 ;
+18 SET ^BCDMINST(RPMS,RPMSVER,CP,"INSTALLED BY",INSTCNT,+$GET(DUZ))=$PIECE($GET(^VA(200,+$GET(DUZ),0)),U)
+19 SET ^BCDMINST(RPMS,RPMSVER,CP,"INSTALLED BY",INSTCNT,+$GET(DUZ),"DATE/TIME")=$$UP^XLFSTR($$HTE^XLFDT($HOROLOG,"MP"))
+20 QUIT