BCCD1E00 ;GDIT/HS/GCD-Pre-Install Environment Check; 18 Apr 2013 12:51 PM
;;1.0;CCDA;;Feb 21, 2014
;
; Run pre-install checks
N VERSION,EXEC,ROLES,OK,BMWDT,BMWRV
;
; Verify that BMW classes exist and we have the correct version.
S BMWRV="01/02/2014" ; Required version
S BMWDT=$G(^BMW("fm2class","GenDate"))
I BMWDT="" D BMES^XPDUTL("Cannot retrieve BMW version") S XPDQUIT=2 I 1
E I '$$DTCMP(BMWDT,BMWRV) D BMES^XPDUTL("BMW version "_BMWRV_" or higher required. Current version: "_BMWDT) S XPDQUIT=2
;
; Add code to check for Ensemble version greater or equal to 2012
S VERSION=$$VERSION^%ZOSV
I VERSION<2012.2 D BMES^XPDUTL("Ensemble 2012.2 or later is required!") S XPDQUIT=2
;
; Check for EHR 1.1 patch 13 by checking for one of its constituent patches
I '$$PATCH^XPDUTL("BEHO*1.1*001010") D BMES^XPDUTL("EHR patch 13 is required.") S XPDQUIT=2
;
; Check for C32 1.0 patch 4 iff C32 is installed
I $$VERSION^XPDUTL("BJMD")="1.0",'$$PATCH^XPDUTL("BJMD*1.0*4") D BMES^XPDUTL("C32 patch 4 is required.") S XPDQUIT=2
;
; Verify that installer has proper roles
S EXEC="S ROLES=$roles" X EXEC
S ROLES=","_ROLES_",",U="^"
I ROLES'[",%All," D BMES^XPDUTL("Your Ensemble account MUST have ""%All"" role to proceed") S XPDQUIT=2
;
; Verify the presence of the following two packages
I '$D(^DD(52.0113)) D BMES^XPDUTL("The package that added Medication Instructions to Prescriptions") D BMES^XPDUTL("file is not installed") S XPDQUIT=2
I '$D(^DD(50,9999999.145)) D BMES^XPDUTL("The package that added DISPENSE UNIT NCPDP CODE field to Drug") D BMES^XPDUTL("file is not installed") S XPDQUIT=2
;
; Verify that installation has Long Strings enabled
S EXEC="S OK=($SYSTEM.SYS.MaxLocalLength()>3600000)" X EXEC
I 'OK D BMES^XPDUTL("Long Strings are not enabled. Ensemble is not configured correctly.") S XPDQUIT=2
;
Q ;
Q
;
; Compare two dates in MM/DD/YYYY format. Return 1 if DT1 is equal to or later than DT2.
; The second space piece (i.e., the time) for each date is ignored.
DTCMP(DT1,DT2) ;
I $G(DT1)=""!($G(DT2)="") Q ""
N DATE1,DATE2
S DATE1=$P(DT1," "),DATE2=$P(DT2," ")
; Parse dates
S DATE1("Y")=$P(DATE1,"/",3),DATE1("M")=$P(DATE1,"/"),DATE1("D")=$P(DATE1,"/",2)
S DATE2("Y")=$P(DATE2,"/",3),DATE2("M")=$P(DATE2,"/"),DATE2("D")=$P(DATE2,"/",2)
; Compare years
I DATE1("Y")<DATE2("Y") Q 0
I DATE1("Y")>DATE2("Y") Q 1
; Years are equal, so compare months
I DATE1("M")<DATE2("M") Q 0
I DATE1("M")>DATE2("M") Q 1
; Years and months are equal, so compare days
I DATE1("D")<DATE2("D") Q 0
Q 1
BCCD1E00 ;GDIT/HS/GCD-Pre-Install Environment Check; 18 Apr 2013 12:51 PM
+1 ;;1.0;CCDA;;Feb 21, 2014
+2 ;
+3 ; Run pre-install checks
+4 NEW VERSION,EXEC,ROLES,OK,BMWDT,BMWRV
+5 ;
+6 ; Verify that BMW classes exist and we have the correct version.
+7 ; Required version
SET BMWRV="01/02/2014"
+8 SET BMWDT=$GET(^BMW("fm2class","GenDate"))
+9 IF BMWDT=""
DO BMES^XPDUTL("Cannot retrieve BMW version")
SET XPDQUIT=2
IF 1
+10 IF '$TEST
IF '$$DTCMP(BMWDT,BMWRV)
DO BMES^XPDUTL("BMW version "_BMWRV_" or higher required. Current version: "_BMWDT)
SET XPDQUIT=2
+11 ;
+12 ; Add code to check for Ensemble version greater or equal to 2012
+13 SET VERSION=$$VERSION^%ZOSV
+14 IF VERSION<2012.2
DO BMES^XPDUTL("Ensemble 2012.2 or later is required!")
SET XPDQUIT=2
+15 ;
+16 ; Check for EHR 1.1 patch 13 by checking for one of its constituent patches
+17 IF '$$PATCH^XPDUTL("BEHO*1.1*001010")
DO BMES^XPDUTL("EHR patch 13 is required.")
SET XPDQUIT=2
+18 ;
+19 ; Check for C32 1.0 patch 4 iff C32 is installed
+20 IF $$VERSION^XPDUTL("BJMD")="1.0"
IF '$$PATCH^XPDUTL("BJMD*1.0*4")
DO BMES^XPDUTL("C32 patch 4 is required.")
SET XPDQUIT=2
+21 ;
+22 ; Verify that installer has proper roles
+23 SET EXEC="S ROLES=$roles"
XECUTE EXEC
+24 SET ROLES=","_ROLES_","
SET U="^"
+25 IF ROLES'[",%All,"
DO BMES^XPDUTL("Your Ensemble account MUST have ""%All"" role to proceed")
SET XPDQUIT=2
+26 ;
+27 ; Verify the presence of the following two packages
+28 IF '$DATA(^DD(52.0113))
DO BMES^XPDUTL("The package that added Medication Instructions to Prescriptions")
DO BMES^XPDUTL("file is not installed")
SET XPDQUIT=2
+29 IF '$DATA(^DD(50,9999999.145))
DO BMES^XPDUTL("The package that added DISPENSE UNIT NCPDP CODE field to Drug")
DO BMES^XPDUTL("file is not installed")
SET XPDQUIT=2
+30 ;
+31 ; Verify that installation has Long Strings enabled
+32 SET EXEC="S OK=($SYSTEM.SYS.MaxLocalLength()>3600000)"
XECUTE EXEC
+33 IF 'OK
DO BMES^XPDUTL("Long Strings are not enabled. Ensemble is not configured correctly.")
SET XPDQUIT=2
+34 ;
Q ;
+1 QUIT
+2 ;
+3 ; Compare two dates in MM/DD/YYYY format. Return 1 if DT1 is equal to or later than DT2.
+4 ; The second space piece (i.e., the time) for each date is ignored.
DTCMP(DT1,DT2) ;
+1 IF $GET(DT1)=""!($GET(DT2)="")
QUIT ""
+2 NEW DATE1,DATE2
+3 SET DATE1=$PIECE(DT1," ")
SET DATE2=$PIECE(DT2," ")
+4 ; Parse dates
+5 SET DATE1("Y")=$PIECE(DATE1,"/",3)
SET DATE1("M")=$PIECE(DATE1,"/")
SET DATE1("D")=$PIECE(DATE1,"/",2)
+6 SET DATE2("Y")=$PIECE(DATE2,"/",3)
SET DATE2("M")=$PIECE(DATE2,"/")
SET DATE2("D")=$PIECE(DATE2,"/",2)
+7 ; Compare years
+8 IF DATE1("Y")<DATE2("Y")
QUIT 0
+9 IF DATE1("Y")>DATE2("Y")
QUIT 1
+10 ; Years are equal, so compare months
+11 IF DATE1("M")<DATE2("M")
QUIT 0
+12 IF DATE1("M")>DATE2("M")
QUIT 1
+13 ; Years and months are equal, so compare days
+14 IF DATE1("D")<DATE2("D")
QUIT 0
+15 QUIT 1