AG71A11 ;IHS/OIT/NKD - Patient Registration 7.1 PATCH 11 ENVIRONMENT CHECK/PRE/POST INSTALL ; FEBRUARY 10, 2014
;;7.1;PATIENT REGISTRATION;**11**;AUG 25, 2005;Build 1
;
I '$G(DUZ) W !,"DUZ UNDEFINED OR 0." D SORRY(2) Q
;
I '$L($G(DUZ(0))) W !,"DUZ(0) UNDEFINED OR NULL." D SORRY(2) Q
;
S X=$P(^VA(200,DUZ,0),U)
W !!,$$CJ^XLFSTR("Hello, "_$P(X,",",2)_" "_$P(X,","),IOM)
W !!,$$CJ^XLFSTR("Checking Environment for "_$P($T(+2),";",4)_" V "_$P($T(+2),";",3)_$S($L($P($T(+2),";",5))>4:" Patch "_$P($T(+2),";",5),1:"")_".",IOM),!
;
I $$VCHK("XU","8.0",2)
I $$VCHK("DI","22.0",2)
I $$PCHK("AG*7.1*10",2)
I $$VCHK2("AVA","93.2.22",2)
I $$VCHK2("AUPN","99.1.23",2)
;
I $G(XPDQUIT) W !,$$CJ^XLFSTR("FIX IT! Before Proceeding.",IOM),!!,*7,*7,*7 Q
;
W !!,$$CJ^XLFSTR("ENVIRONMENT OK.",IOM)
;
Q
;
SORRY(X) ;
KILL DIFQ
S XPDQUIT=X
W *7,!,$$CJ^XLFSTR("Sorry....FIX IT!",IOM)
Q
;
VCHK(AGPRE,AGVER,AGQUIT) ; Check version level
;
NEW AGV
S AGV=$$VERSION^XPDUTL(AGPRE)
W !,$$CJ^XLFSTR("Need at least "_AGPRE_" v "_AGVER_"....."_AGPRE_" v "_AGV_" Present",IOM)
I AGV<AGVER KILL DIFQ S XPDQUIT=AGQUIT D SORRY(AGQUIT) Q 0
Q 1
VCHK2(AGPRE,AGVER,AGQUIT) ; Check patch level
NEW AGV
S AGV=$$VERSION^XPDUTL(AGPRE)
S PTCH=+$$LAST(AGPRE,AGV) S:PTCH=-1 DPTCH="" S:PTCH'=-1 DPTCH="."_PTCH
W !,$$CJ^XLFSTR("Need at least "_AGPRE_" v "_AGVER_"....."_AGPRE_" v "_AGV_DPTCH_" Present",IOM)
I (AGV<($P(AGVER,".",1,2))) KILL DIFQ S XPDQUIT=AGQUIT D SORRY(AGQUIT) Q 0
I (AGV=$P(AGVER,".",1,2))&(PTCH<$P(AGVER,".",3)) KILL DIFQ S XPDQUIT=AGQUIT D SORRY(AGQUIT) Q 0
Q 1
PCHK(AGPAT,AGQUIT) ; Check specific patch
N AGP
S AGP=$$PATCH^XPDUTL(AGPAT)
W !,$$CJ^XLFSTR("Patch "_AGPAT_" is "_$S(AGP<1:"*NOT* ",1:"")_"installed.",IOM)
I 'AGP KILL DIFQ S XPDQUIT=AGQUIT D SORRY(AGQUIT) Q 0
Q 1
LAST(PKG,VER) ; EP - returns last patch applied for a Package, PATCH^DATE
; Patch includes Seq # if Released
N PKGIEN,VERIEN,LATEST,PATCH,SUBIEN
I $G(VER)="" S VER=$$VERSION^XPDUTL(PKG) Q:'VER -1
S PKGIEN=$O(^DIC(9.4,"C",PKG,"")) Q:'PKGIEN -1
S VERIEN=$O(^DIC(9.4,PKGIEN,22,"B",VER,"")) Q:'VERIEN -1
S LATEST=-1,PATCH=-1,SUBIEN=0
F S SUBIEN=$O(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN)) Q:SUBIEN'>0 D
. I $P(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN,0),U,2)>LATEST S LATEST=$P(^(0),U,2),PATCH=$P(^(0),U)
. I $P(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN,0),U,2)=LATEST,$P(^(0),U)>PATCH S PATCH=$P(^(0),U)
Q PATCH_U_LATEST
;
POST ; EP FR KIDS
; UPDATE ALL PT ELIGIBILITY SEX FIELDS
N AGPATDFN
S AGPATDFN=0 F S AGPATDFN=$O(^DPT(AGPATDFN)) Q:'AGPATDFN D
. Q:'$D(^DPT(AGPATDFN,0))
. Q:'$D(^AUPNPAT(AGPATDFN,0))
. Q:$P($G(^AUPNPAT(AGPATDFN,0)),U,1)'=AGPATDFN
. D SEXELIG^AGUTL(AGPATDFN)
;
Q
AG71A11 ;IHS/OIT/NKD - Patient Registration 7.1 PATCH 11 ENVIRONMENT CHECK/PRE/POST INSTALL ; FEBRUARY 10, 2014
+1 ;;7.1;PATIENT REGISTRATION;**11**;AUG 25, 2005;Build 1
+2 ;
+3 IF '$GET(DUZ)
WRITE !,"DUZ UNDEFINED OR 0."
DO SORRY(2)
QUIT
+4 ;
+5 IF '$LENGTH($GET(DUZ(0)))
WRITE !,"DUZ(0) UNDEFINED OR NULL."
DO SORRY(2)
QUIT
+6 ;
+7 SET X=$PIECE(^VA(200,DUZ,0),U)
+8 WRITE !!,$$CJ^XLFSTR("Hello, "_$PIECE(X,",",2)_" "_$PIECE(X,","),IOM)
+9 WRITE !!,$$CJ^XLFSTR("Checking Environment for "_$PIECE($TEXT(+2),";",4)_" V "_$PIECE($TEXT(+2),";",3)_$SELECT($LENGTH($PIECE($TEXT(+2),";",5))>4:" Patch "_$PIECE($TEXT(+2),";",5),1:"")_".",IOM),!
+10 ;
+11 IF $$VCHK("XU","8.0",2)
+12 IF $$VCHK("DI","22.0",2)
+13 IF $$PCHK("AG*7.1*10",2)
+14 IF $$VCHK2("AVA","93.2.22",2)
+15 IF $$VCHK2("AUPN","99.1.23",2)
+16 ;
+17 IF $GET(XPDQUIT)
WRITE !,$$CJ^XLFSTR("FIX IT! Before Proceeding.",IOM),!!,*7,*7,*7
QUIT
+18 ;
+19 WRITE !!,$$CJ^XLFSTR("ENVIRONMENT OK.",IOM)
+20 ;
+21 QUIT
+22 ;
SORRY(X) ;
+1 KILL DIFQ
+2 SET XPDQUIT=X
+3 WRITE *7,!,$$CJ^XLFSTR("Sorry....FIX IT!",IOM)
+4 QUIT
+5 ;
VCHK(AGPRE,AGVER,AGQUIT) ; Check version level
+1 ;
+2 NEW AGV
+3 SET AGV=$$VERSION^XPDUTL(AGPRE)
+4 WRITE !,$$CJ^XLFSTR("Need at least "_AGPRE_" v "_AGVER_"....."_AGPRE_" v "_AGV_" Present",IOM)
+5 IF AGV<AGVER
KILL DIFQ
SET XPDQUIT=AGQUIT
DO SORRY(AGQUIT)
QUIT 0
+6 QUIT 1
VCHK2(AGPRE,AGVER,AGQUIT) ; Check patch level
+1 NEW AGV
+2 SET AGV=$$VERSION^XPDUTL(AGPRE)
+3 SET PTCH=+$$LAST(AGPRE,AGV)
IF PTCH=-1
SET DPTCH=""
IF PTCH'=-1
SET DPTCH="."_PTCH
+4 WRITE !,$$CJ^XLFSTR("Need at least "_AGPRE_" v "_AGVER_"....."_AGPRE_" v "_AGV_DPTCH_" Present",IOM)
+5 IF (AGV<($PIECE(AGVER,".",1,2)))
KILL DIFQ
SET XPDQUIT=AGQUIT
DO SORRY(AGQUIT)
QUIT 0
+6 IF (AGV=$PIECE(AGVER,".",1,2))&(PTCH<$PIECE(AGVER,".",3))
KILL DIFQ
SET XPDQUIT=AGQUIT
DO SORRY(AGQUIT)
QUIT 0
+7 QUIT 1
PCHK(AGPAT,AGQUIT) ; Check specific patch
+1 NEW AGP
+2 SET AGP=$$PATCH^XPDUTL(AGPAT)
+3 WRITE !,$$CJ^XLFSTR("Patch "_AGPAT_" is "_$SELECT(AGP<1:"*NOT* ",1:"")_"installed.",IOM)
+4 IF 'AGP
KILL DIFQ
SET XPDQUIT=AGQUIT
DO SORRY(AGQUIT)
QUIT 0
+5 QUIT 1
LAST(PKG,VER) ; EP - returns last patch applied for a Package, PATCH^DATE
+1 ; Patch includes Seq # if Released
+2 NEW PKGIEN,VERIEN,LATEST,PATCH,SUBIEN
+3 IF $GET(VER)=""
SET VER=$$VERSION^XPDUTL(PKG)
IF 'VER
QUIT -1
+4 SET PKGIEN=$ORDER(^DIC(9.4,"C",PKG,""))
IF 'PKGIEN
QUIT -1
+5 SET VERIEN=$ORDER(^DIC(9.4,PKGIEN,22,"B",VER,""))
IF 'VERIEN
QUIT -1
+6 SET LATEST=-1
SET PATCH=-1
SET SUBIEN=0
+7 FOR
SET SUBIEN=$ORDER(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN))
IF SUBIEN'>0
QUIT
Begin DoDot:1
+8 IF $PIECE(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN,0),U,2)>LATEST
SET LATEST=$PIECE(^(0),U,2)
SET PATCH=$PIECE(^(0),U)
+9 IF $PIECE(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN,0),U,2)=LATEST
IF $PIECE(^(0),U)>PATCH
SET PATCH=$PIECE(^(0),U)
End DoDot:1
+10 QUIT PATCH_U_LATEST
+11 ;
POST ; EP FR KIDS
+1 ; UPDATE ALL PT ELIGIBILITY SEX FIELDS
+2 NEW AGPATDFN
+3 SET AGPATDFN=0
FOR
SET AGPATDFN=$ORDER(^DPT(AGPATDFN))
IF 'AGPATDFN
QUIT
Begin DoDot:1
+4 IF '$DATA(^DPT(AGPATDFN,0))
QUIT
+5 IF '$DATA(^AUPNPAT(AGPATDFN,0))
QUIT
+6 IF $PIECE($GET(^AUPNPAT(AGPATDFN,0)),U,1)'=AGPATDFN
QUIT
+7 DO SEXELIG^AGUTL(AGPATDFN)
End DoDot:1
+8 ;
+9 QUIT