Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BLRPRE38

BLRPRE38.m

Go to the documentation of this file.
  1. BLRPRE38 ; IHS/MSC/MKK - IHS Lab Patch LR*5.2*1038 Pre/Post Routine ; 17-Dec-2015 15:37 ; MKK
  1. ;;5.2;IHS LABORATORY;**1038**;NOV 01, 1997;Build 6
  1. ;
  1. ENVICHEK ; EP - Environment Checker
  1. NEW BLRVERN,CP,ERRARRAY,ROWSTARS,RPMS,RPMSVER,TODAY,WOTCNT
  1. ;
  1. Q:$$ENVIVARS()="Q"
  1. ;
  1. D ENVHEADR^BLRPRE31(CP,RPMSVER,RPMS),BLANK
  1. ;
  1. D NEEDIT^BLRPRE31(CP,"LR","5.2",1037,.ERRARRAY),BLANK ; Lab Pre-Requisite
  1. ;
  1. I XPDABORT>0 D SORRYEND^BLRPRE33(.ERRARRAY,CP) Q ; ENVIRONMENT HAS ERROR(S)
  1. ;
  1. D BOKAY^BLRPRE31("ENVIRONMENT")
  1. ;
  1. Q
  1. ;
  1. ENVIVARS() ; EP - Setup the Environment variables
  1. D SETEVARS
  1. ;
  1. S TODAY=$$DT^XLFDT
  1. S WOTCNT=$$WOTCNT(BLRVERN)
  1. S ROWSTARS=$TR($J("",65)," ","*") ; Row of asterisks
  1. ;
  1. S ^XTMP(BLRVERN,0)=$$HTFM^XLFDT(+$H+90)_"^"_$$DT^XLFDT_"^IHS Lab Patch "_CPSTR
  1. M ^XTMP(BLRVERN,TODAY,WOTCNT,"DUZ")=DUZ
  1. S ^XTMP(BLRVERN,TODAY,WOTCNT,"BEGIN")=$$NOW^XLFDT
  1. ;
  1. S XUMF=1
  1. ;
  1. I $G(XPDNM)="" D SORRY^BLRPRE31(CP,"XPDNM not defined or 0.") Q "Q"
  1. ;
  1. S RPMS=$P(XPDNM,"*",1) ; RPMS Module
  1. S RPMSVER=$P(XPDNM,"*",2) ; RPMS Version
  1. ;
  1. I +$G(DUZ)<1 D SORRY^BLRPRE31(CP,"DUZ UNDEFINED OR 0.") Q "Q"
  1. I $$GET1^DIQ(200,DUZ,"NAME")="" D SORRY^BLRPRE31(CP,"Installer cannot be identified!") Q "Q"
  1. ;
  1. S XPDNOQUE=1 ; No Queuing Allowed
  1. ;
  1. ; The following line prevents the "Disable Options..." and "Move
  1. ; Routines..." questions from being asked during the install.
  1. F X="XPO1","XPZ1","XPZ2","XPI1" S XPDDIQ(X)=0,XPDDIQ(X,"B")="NO"
  1. ;
  1. S XPDABORT=0 ; KIDS install Flag
  1. ;
  1. D HOME^%ZIS ; Reset/Initialize IO variables
  1. D DTNOLF^DICRW ; Set DT variable without a Line Feed
  1. ;
  1. Q "OK"
  1. ;
  1. PRE ; EP - Ask for confirmation of Backup
  1. NEW BLRVERN,CNT,CP,CPSTR,CRTLINE,DIRASTR,FDAROOT,IEN,IENS,MSGROOT
  1. NEW BCKUPCNT ; Current Patch,Backup count
  1. ;
  1. D SETEVARS
  1. ;
  1. S XUMF=1
  1. ;
  1. D INITSCR
  1. D TITLE^XPDID(CPSTR)
  1. D BLANK,BMES^XPDUTL("Pre-Install of "_BLRVERN_" Begins.")
  1. ;
  1. Q:$$BACKUP()="Q"
  1. ;
  1. D INITSCR
  1. D TITLE^XPDID(CPSTR)
  1. D BLANK,BMES^XPDUTL("Pre-Install of "_BLRVERN_" Continues.")
  1. ;
  1. ; Do Pre-install stuff here.
  1. D SAVEOFF
  1. ;
  1. D FILEDEL
  1. ;
  1. D TABMESG^BLRKIDSU("Pre-Install Processing Ends at "_$$UP^XLFSTR($$HTE^XLFDT($H,"5MPZ"))_".",5)
  1. H 2 ; Pause so user can see the message.
  1. ;
  1. D EXIT^XPDID
  1. Q
  1. ;
  1. BACKUP() ; EP - Confirm Backup
  1. NEW BCKUPCNT,SUCCSTR
  1. ;
  1. D SHOWBOX^BLRGMENU("ATTENTION",10,70)
  1. ;
  1. D ^XBFMK
  1. S DIR(0)="Y"
  1. S DIR("B")="NO"
  1. I $G(IOST)["C-VT" S SUCCSTR=$C(27)_"[1;7;5m"_">> SUCCESSFUL <<"_$C(27)_"[0m"
  1. E S SUCCSTR=">> SUCCESSFUL <<"
  1. S DIR("A")=$J("",10)_"Has a "_SUCCSTR_" backup been performed?"
  1. S DIR("?")="A *NO* answer will abort the install process."
  1. D ^DIR
  1. W !
  1. ;
  1. Q:+$G(Y)'=1 $$NOBACKUP() ; If BACKUP not performed, then ABORT installation.
  1. ;
  1. Q:+$G(DEBUG) $$OKBACKUP() ; DEBUG will *NOT* store Backup Confirmation data.
  1. ;
  1. ; Store backup confirmation person & date/time
  1. S BCKUPCNT=1+$O(^BLRINSTL("LAB PATCH",CP,"BACKUP CONFIRMED BY",0),-1)
  1. S ^BLRINSTL("LAB PATCH",CP,"BACKUP CONFIRMED BY",BCKUPCNT)=$P($G(^VA(200,DUZ,0)),U)
  1. S ^BLRINSTL("LAB PATCH",CP,"BACKUP CONFIRMED BY",BCKUPCNT,"DUZ")=DUZ
  1. S ^BLRINSTL("LAB PATCH",CP,"BACKUP CONFIRMED BY",BCKUPCNT,"DATE/TIME")=$$HTE^XLFDT($H,"5MZ")
  1. ;
  1. Q $$OKBACKUP()
  1. ;
  1. OKBACKUP() ; EP - Backup Confirmed.
  1. D MES^XPDUTL("")
  1. D OKAY^BLRKIDSU("SUCCESSFUL system backup CONFIRMED by: "_$$GET1^DIQ(200,DUZ,"NAME")_".",5)
  1. I +$G(DEBUG) D
  1. . D MES^XPDUTL("")
  1. . D TABMENU^BLRKIDSU("DEBUG will **NOT** Store Backup Confirmation.",10)
  1. ;
  1. H 2 ; Pause to let the user see the message.
  1. Q "OK"
  1. ;
  1. NOBACKUP() ; EP - No backup message
  1. S XPDABORT=1
  1. D PASSMESG^BLRPRE31("ATTENTION")
  1. D TABMESG^BLRKIDSU("SUCCESSFUL system backup has >>> NOT <<< been confirmed.",15)
  1. D TABMESG^BLRKIDSU("Installer: "_$$GET1^DIQ(200,DUZ,"NAME")_" ["_DUZ_"].",25)
  1. D TABMESG^BLRKIDSU("Install Aborting.",15)
  1. H 2 ; Pause to let the user see the message.
  1. Q "Q"
  1. ;
  1. DEBUG ; EP - Debugging Line Label for environment checker
  1. NEW BEGTIME,BLRVERN,CP,CPSTR,DEBUG,ENDTIME,ERRARRAY,LASTLOGI
  1. NEW LRBLNOW,PATCHNUM,PREREQ,QFLG,ROWSTARS,RPMS,RPMSVER,STR
  1. NEW SUCCSTR,TODAY,WHATCNT,WOTCNT,XPDABORT,XPDENV,XPDNM
  1. ;
  1. ; NOTE: DEBUG will not store "Backup" data.
  1. ;
  1. D SETEVARS
  1. ;
  1. W !!
  1. W "Debug Routine ",BLRVERN," Begins:",!!
  1. ;
  1. S DEBUG=1 ; Don't Send Alerts
  1. ;
  1. W !
  1. S XPDNM=CPSTR
  1. S (XPDENV,XPDABORT)=0
  1. ;
  1. D PRE
  1. Q:XPDABORT
  1. ;
  1. W !!!
  1. ;
  1. D ^XBFMK
  1. S DIR(0)="YO"
  1. S DIR("B")="NO"
  1. S DIR("A")="Test Post Install Code"
  1. D ^DIR
  1. ;
  1. D:+$G(Y)=1 POST
  1. ;
  1. W !!,"Debug Routine ",BLRVERN," Ends.",!!
  1. Q
  1. ;
  1. POST ; EP - Post-Install
  1. NEW BLRVERN,CP,CPSTR,PATCHNUM,TODAY,WOTCNT
  1. ;
  1. D EXITKIDG
  1. ;
  1. D SETEVARS
  1. ;
  1. S TODAY=$$DT^XLFDT
  1. S WOTCNT=$$WOTCNT(BLRVERN)
  1. ;
  1. D ADDOPTS ; Add new option to BLRMENU
  1. ;
  1. D ADDPARMS ; Make sure file 90475.7 has PARAMETERS as the .01 field.
  1. ;
  1. D BLANK,BMES^XPDUTL("Laboratory Patch "_CPSTR_" INSTALL complete."),BLANK
  1. ;
  1. Q:+$G(DEBUG)
  1. ;
  1. D POSTMAIL(BLRVERN,CPSTR)
  1. ;
  1. S ^XTMP(BLRVERN,TODAY,WOTCNT,"END")=$$NOW^XLFDT
  1. Q
  1. ;
  1. EXITKIDG ; EP - EXIT KIDS Graphics mode
  1. ; Get out of graphics mode so that any "output" done during this phase
  1. ; of the install process will be printed in the INSTALL file log if the
  1. ; BMES^XPDUTL and MES^XPDUTL procedures are used.
  1. S X=" "
  1. D EXIT^XPDID(X)
  1. D MES^XPDUTL("")
  1. Q
  1. ;
  1. ADDOPTS ; EP - Add new option to BLRMENU
  1. NEW NEWOPT,NEWOPTM,TAB
  1. ;
  1. S TAB=$J("",5)
  1. S NEWOPT="BLR AGE DETAIL Parameter Edit"
  1. S NEWOPTM="POCA"
  1. D OPTADD(NEWOPT,NEWOPTM,TAB)
  1. ;
  1. S NEWOPT="BLR CKD-EPI DELTA CHECK CREATE"
  1. S NEWOPTM="CGFR"
  1. D OPTADD(NEWOPT,NEWOPTM,TAB)
  1. ;
  1. S NEWOPT="BLR CKD-EPI TEST"
  1. S NEWOPTM="TGFR"
  1. D OPTADD(NEWOPT,NEWOPTM,TAB)
  1. ;
  1. Q
  1. ;
  1. OPTADD(NEWOPT,NEWOPTM,TAB) ; EP
  1. D BMES^XPDUTL("Adding '"_NEWOPT_"' option to BLRMENU.")
  1. S X=$$ADD^XPDMENU("BLRMENU",NEWOPT,NEWOPTM)
  1. D:X=1 MES^XPDUTL(TAB_"'"_NEWOPT_"' added to BLRMENU. OK.")
  1. I X'=1 D
  1. . D MES^XPDUTL(TAB_"Error in adding '"_NEWOPT_"' option to BLRMENU.")
  1. . D MES^XPDUTL(TAB_TAB_"Error Message: "_$$UP^XLFSTR($P(X,"^",2)))
  1. ;
  1. D MES^XPDUTL(" ")
  1. Q
  1. ;
  1. ADDPARMS ; EP - Ensure that new file 90475.7 has its .01 field = PARAMETERS
  1. NEW (DEBUG,DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,U,XPARSYS,XQXFLG)
  1. ;
  1. Q:$$GET1^DIQ(90475.7,1,.01)="PARAMETERS" ; If already PARAMETERS, exit
  1. ;
  1. S FDA(90475.7,"1,",.01)="PARAMETERS"
  1. D UPDATE^DIE("ES","FDA",,"ERRS")
  1. I $D(ERRS)<1 D
  1. . D MES^XPDUTL("")
  1. . D OKAY^BLRKIDSU("90475.7 file's .01 field set to 'PARAMETERS'.",5)
  1. Q
  1. ;
  1. SAVEOFF ; EP - Save off all routines being updated by this patch into the ^rBACKUP global.
  1. NEW (DEBUG,DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,U,XPARSYS,XQXFLG)
  1. ;
  1. S BLRVERN=$TR($P($T(+1),";")," ")
  1. ;
  1. I +$G(DEBUG) D Q ; If DEBUG, just print messages & quit
  1. . S TAB=$J("",10)
  1. . D BLANK,OKAY^BLRKIDSU("DEBUG: SAVEOFF^"_BLRVERN,4)
  1. . D BMES^XPDUTL(TAB_"DEBUG does *NOT* Save off routines.")
  1. ;
  1. S PATCH=$P($T(+2),"*",3)
  1. S BUILD="LR*5.2*"_PATCH
  1. S PATCHIEN=+$O(^XPD(9.6,"B",BUILD,"A"),-1) ; Get the most current Patch IEN
  1. Q:PATCHIEN<1 ; If not in BUILD file, skip
  1. ;
  1. D BMES^XPDUTL("Backing up routines.")
  1. S RTN="",(CNT,RTNCNT)=0
  1. F S RTN=$O(^XPD(9.6,PATCHIEN,"KRN",9.8,"NM","B",RTN)) Q:RTN="" D
  1. . S RTNPATCH=+$RE($P($RE($TR($P($G(^ROUTINE(RTN,0,2)),";",5),"*")),","))
  1. . Q:RTNPATCH<1 ; If RTN not in the ^ROUTINE global, skip
  1. . Q:RTNPATCH'<PATCH ; Only versions < this patch
  1. . ;
  1. . S RTNCNT=RTNCNT+1
  1. . K ERRS,RTNA
  1. . F LN=0:1:$G(^ROUTINE(RTN,0,0)) S RTNA(LN)=$G(^ROUTINE(RTN,0,LN))
  1. . S X=$$ROUTINE^%R(RTN_".INT",.RTNA,.ERRS,"CSB")
  1. . S NOW=$H
  1. . S ^BLRINSTL("LAB PATCH",PATCH,"SAVEOFF",NOW)=$$HTE^XLFDT(NOW,"5MZ")
  1. . S ^BLRINSTL("LAB PATCH",PATCH,"SAVEOFF",NOW,RTN)=$S($D(ERRS)>1:"ERRORS",1:"OK")
  1. . I $D(ERRS)'>1 D
  1. .. D OKAY^BLRKIDSU("Routine "_RTN_" backed up.",4)
  1. .. S CNT=CNT+1
  1. ;
  1. I RTNCNT D
  1. . S TAB=$J("",5)
  1. . D BMES^XPDUTL(TAB_RTNCNT_" routines analyzed.")
  1. . D BMES^XPDUTL(TAB_TAB_CNT_" routines backed up.")
  1. Q
  1. ;
  1. ;
  1. ; ========================= UTILITIES FOLLOW ==========================
  1. ;
  1. SETEVARS ; EP - SET standard "Enviroment" VARiables.
  1. S (CP,PATCHNUM)=$P($T(+2),"*",3)
  1. S CPSTR="LR*5.2*"_CP
  1. S BLRVERN=$TR($P($T(+1),";")," ")
  1. Q
  1. ;
  1. BLANK ; EP - Blank Line
  1. D MES^XPDUTL("")
  1. Q
  1. ;
  1. MESCNTR(STR) ; EP - Center a line and use XPDUTL to display it
  1. D MES^XPDUTL($$CJ^XLFSTR(STR,IOM))
  1. Q
  1. ;
  1. WOTCNT(BLRVERN) ; EP - Counter for ^XTMP
  1. NEW CNT,TODAY
  1. ;
  1. S TODAY=$$DT^XLFDT
  1. ;
  1. S CNT=1+$G(^XTMP(BLRVERN,0,TODAY))
  1. S ^XTMP(BLRVERN,0,TODAY)=CNT
  1. Q $TR($J(CNT,3)," ","0")
  1. ;
  1. INITSCR ; EP - Initialize screen. Cloned from INIT^XPDID
  1. N X,XPDSTR
  1. I IO'=IO(0)!(IOST'["C-VT") S XPDIDVT=0 Q
  1. I $T(PREP^XGF)="" S XPDIDVT=0 Q
  1. D PREP^XGF
  1. S XPDIDVT=1,X="IOSTBM",XPDSTR=""
  1. D ENDR^%ZISS
  1. S IOTM=3,IOBM=IOSL-4
  1. W @IOSTBM
  1. D FRAME^XGF(IOTM-2,0,IOTM-2,IOM-1) ; Top line
  1. ; D FRAME^XGF(IOBM+1,0,IOBM+1,IOM-1) ; Bottom line
  1. D IOXY^XGF(IOTM-2,0)
  1. Q
  1. ;
  1. POSTMAIL(BLRVERN,CPSTR) ; EP - Post Install MailMan Message
  1. NEW STR
  1. ;
  1. S STR(1)=" "
  1. S STR(2)=$J("",10)_"POST INSTALL of "_BLRVERN_" Routine."
  1. S STR(3)=" "
  1. S STR(4)=$J("",15)_"Laboratory Patch "_CPSTR_" INSTALL completed."
  1. S STR(5)=" "
  1. ;
  1. Q:+$G(DEBUG) ; No MailMan messages during debugging
  1. ;
  1. ; Send E-Mail to LMI Mail Group & Installer
  1. D MAILALMI^BLRUTIL3("Laboratory Patch "_CPSTR_" INSTALL complete.",.STR,BLRVERN)
  1. ;
  1. Q
  1. ;
  1. ; The following IHS UCUM deletions are necessary because the OVERWRITE flag in KIDS
  1. ; does *NOT* work: any data in the target system will not be overwritten if it's
  1. ; different from the incoming data. (Example: IEN 410 on SandPre.)
  1. FILEDEL ; EP
  1. NEW CNT,IEN
  1. ;
  1. D DISABLE^%NOJRN ; Disable Journaling prior to deletions
  1. ;
  1. W !,?4,"IHS UCUM Deletions"
  1. S IEN=.9999999,CNT=0
  1. F S IEN=$O(^BLRUCUM(IEN)) Q:IEN<1 D
  1. . S CNT=CNT+1
  1. . I CNT#100=0 W "." W:$X>75 !,?4
  1. . D ^XBFMK
  1. . S DIK="^BLRUCUM(",DA=IEN
  1. . Q:$G(DEBUG)="YES" ; If DEBUG set, don't delete anything
  1. . D ^DIK
  1. ;
  1. W !
  1. ;
  1. D ENABLE^%NOJRN ; Restore Journaling
  1. ;
  1. Q