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

AG71A11.m

Go to the documentation of this file.
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