CIAVIN11 ;MSC/IND/DKM - EHR v1.1 Inits;04-May-2006 08:19;DKM
;;1.1;VUECENTRIC FRAMEWORK;;Sep 30, 2005
;;Copyright 2000-2006, Medsphere Systems Corporation
;=================================================================
EC ;EP - Environment check
Q
PRE ;EP - Preinit
D BMES^XPDUTL("Updating EHR Parameters...")
D CVTPARS("CIA"),CVTPARS("BEH")
Q
POST ;EP - Postinit
W !!!
I $L($$GETLOGIN^CIAVUTIL),$$ASK^CIAU("Do you want to enable VueCentric logins","Y") D
.D SDABORT^CIAVUTIL(,1),BMES^XPDUTL("Application logins have been enabled.")
D:$L($T(^BEHUTIL)) REGMENU^BEHUTIL("CIAV MANAGER",,"FRM")
Q
; Convert parameters by namespace
CVTPARS(NMSP) ;EP
N PARNM,LEN
S PARNM=NMSP,LEN=$L(NMSP)
F S PARNM=$O(^XTV(8989.51,"B",PARNM)) Q:$E(PARNM,1,LEN)'=NMSP D
.D BMES^XPDUTL("Updating parameter "_PARNM_"... "_$$CVTPAR(PARNM))
Q
; Convert PKG entity type to SYS entity type
CVTPAR(PARNM) ;EP
N PARAM,PKGIEN,PKGPRI,PKGVAL,PKGVP,SYSIEN,SYSPRI,SYSVP,SYSVAL,FDA
S PARAM=$S(PARNM=+PARNM:PARNM,1:$$FIND1^DIC(8989.51,,"X",PARNM))
Q:'PARAM!'$D(^XTV(8989.51,PARAM,0)) "Parameter "_PARNM_" not found."
S PKGIEN=+$O(^XTV(8989.51,PARAM,30,"AG","DIC(9.4,",0))
S PKGPRI=-$G(^XTV(8989.51,PARAM,30,PKGIEN,0))
Q:'PKGIEN "Nothing to change."
S SYSIEN=+$O(^XTV(8989.51,PARAM,30,"AG","DIC(4.2,",0))
S SYSPRI=-$G(^XTV(8989.51,PARAM,30,SYSIEN,0))
S SYSVP=$$GETVP(PARAM,"SYS"),PKGVP=$$GETVP(PARAM,"PKG")
Q:'$L(PKGVP) "Cannot determine package."
S PKGVAL=$O(^XTV(8989.5,"AC",PARAM,PKGVP,""))'=""
S SYSVAL=$O(^XTV(8989.5,"AC",PARAM,SYSVP,""))'=""
S FDA=1
I SYSIEN,'SYSVAL D
.S FDA(FDA,8989.513,SYSIEN_","_PARAM_",",.01)="@",SYSIEN=0
S FDA=FDA+1
I SYSVAL,PKGVAL D
.N DELVP,DELIEN,IEN
.I PKGPRI>SYSPRI S DELIEN=SYSIEN,DELVP=SYSVP,SYSIEN=0,SYSVAL=0
.E S DELIEN=PKGIEN,DELVP=PKGVP,PKGIEN=0,PKGVAL=0
.D CHGENT(DELIEN,DELVP,"@","@")
S FDA=FDA+1
I SYSVAL,'PKGVAL D
.S:PKGIEN FDA(FDA,8989.513,PKGIEN_","_PARAM_",",.01)="@",PKGIEN=0
S FDA=FDA+1
I 'SYSIEN,PKGIEN D
.D CHGENT(PKGIEN,PKGVP,4.2,SYSVP)
.S SYSIEN=PKGIEN,SYSVAL=PKGVAL,(PKGIEN,PKGVAL)=0
I $D(FDA) D
.N ERR,LVL
.F LVL=0:0 S LVL=$O(FDA(LVL)) Q:'LVL D
..D UPDATE^DIE(,$NA(FDA(LVL)),,"ERR")
..ZW ERR
Q "OK"
GETVP(PAR,ENT) ;
D ENTDFLT^XPAR1(.ENT)
Q ENT
CHGENT(ENTIEN,ENTVP,ENTVAL,PARVAL) ;
N INST,IEN
S INST=""
S FDA(FDA,8989.513,ENTIEN_","_PARAM_",",$S(ENTVAL="@":.01,1:.02))=ENTVAL
F S INST=$O(^XTV(8989.5,"AC",PARAM,ENTVP,INST)) Q:'$L(INST) D
.F IEN=0:0 S IEN=$O(^XTV(8989.5,"AC",PARAM,ENTVP,INST,IEN)) Q:'IEN D
..S FDA(FDA+.1,8989.5,IEN_",",.01)=PARVAL
Q
CIAVIN11 ;MSC/IND/DKM - EHR v1.1 Inits;04-May-2006 08:19;DKM
+1 ;;1.1;VUECENTRIC FRAMEWORK;;Sep 30, 2005
+2 ;;Copyright 2000-2006, Medsphere Systems Corporation
+3 ;=================================================================
EC ;EP - Environment check
+1 QUIT
PRE ;EP - Preinit
+1 DO BMES^XPDUTL("Updating EHR Parameters...")
+2 DO CVTPARS("CIA")
DO CVTPARS("BEH")
+3 QUIT
POST ;EP - Postinit
+1 WRITE !!!
+2 IF $LENGTH($$GETLOGIN^CIAVUTIL)
IF $$ASK^CIAU("Do you want to enable VueCentric logins","Y")
Begin DoDot:1
+3 DO SDABORT^CIAVUTIL(,1)
DO BMES^XPDUTL("Application logins have been enabled.")
End DoDot:1
+4 IF $LENGTH($TEXT(^BEHUTIL))
DO REGMENU^BEHUTIL("CIAV MANAGER",,"FRM")
+5 QUIT
+6 ; Convert parameters by namespace
CVTPARS(NMSP) ;EP
+1 NEW PARNM,LEN
+2 SET PARNM=NMSP
SET LEN=$LENGTH(NMSP)
+3 FOR
SET PARNM=$ORDER(^XTV(8989.51,"B",PARNM))
IF $EXTRACT(PARNM,1,LEN)'=NMSP
QUIT
Begin DoDot:1
+4 DO BMES^XPDUTL("Updating parameter "_PARNM_"... "_$$CVTPAR(PARNM))
End DoDot:1
+5 QUIT
+6 ; Convert PKG entity type to SYS entity type
CVTPAR(PARNM) ;EP
+1 NEW PARAM,PKGIEN,PKGPRI,PKGVAL,PKGVP,SYSIEN,SYSPRI,SYSVP,SYSVAL,FDA
+2 SET PARAM=$SELECT(PARNM=+PARNM:PARNM,1:$$FIND1^DIC(8989.51,,"X",PARNM))
+3 IF 'PARAM!'$DATA(^XTV(8989.51,PARAM,0))
QUIT "Parameter "_PARNM_" not found."
+4 SET PKGIEN=+$ORDER(^XTV(8989.51,PARAM,30,"AG","DIC(9.4,",0))
+5 SET PKGPRI=-$GET(^XTV(8989.51,PARAM,30,PKGIEN,0))
+6 IF 'PKGIEN
QUIT "Nothing to change."
+7 SET SYSIEN=+$ORDER(^XTV(8989.51,PARAM,30,"AG","DIC(4.2,",0))
+8 SET SYSPRI=-$GET(^XTV(8989.51,PARAM,30,SYSIEN,0))
+9 SET SYSVP=$$GETVP(PARAM,"SYS")
SET PKGVP=$$GETVP(PARAM,"PKG")
+10 IF '$LENGTH(PKGVP)
QUIT "Cannot determine package."
+11 SET PKGVAL=$ORDER(^XTV(8989.5,"AC",PARAM,PKGVP,""))'=""
+12 SET SYSVAL=$ORDER(^XTV(8989.5,"AC",PARAM,SYSVP,""))'=""
+13 SET FDA=1
+14 IF SYSIEN
IF 'SYSVAL
Begin DoDot:1
+15 SET FDA(FDA,8989.513,SYSIEN_","_PARAM_",",.01)="@"
SET SYSIEN=0
End DoDot:1
+16 SET FDA=FDA+1
+17 IF SYSVAL
IF PKGVAL
Begin DoDot:1
+18 NEW DELVP,DELIEN,IEN
+19 IF PKGPRI>SYSPRI
SET DELIEN=SYSIEN
SET DELVP=SYSVP
SET SYSIEN=0
SET SYSVAL=0
+20 IF '$TEST
SET DELIEN=PKGIEN
SET DELVP=PKGVP
SET PKGIEN=0
SET PKGVAL=0
+21 DO CHGENT(DELIEN,DELVP,"@","@")
End DoDot:1
+22 SET FDA=FDA+1
+23 IF SYSVAL
IF 'PKGVAL
Begin DoDot:1
+24 IF PKGIEN
SET FDA(FDA,8989.513,PKGIEN_","_PARAM_",",.01)="@"
SET PKGIEN=0
End DoDot:1
+25 SET FDA=FDA+1
+26 IF 'SYSIEN
IF PKGIEN
Begin DoDot:1
+27 DO CHGENT(PKGIEN,PKGVP,4.2,SYSVP)
+28 SET SYSIEN=PKGIEN
SET SYSVAL=PKGVAL
SET (PKGIEN,PKGVAL)=0
End DoDot:1
+29 IF $DATA(FDA)
Begin DoDot:1
+30 NEW ERR,LVL
+31 FOR LVL=0:0
SET LVL=$ORDER(FDA(LVL))
IF 'LVL
QUIT
Begin DoDot:2
+32 DO UPDATE^DIE(,$NAME(FDA(LVL)),,"ERR")
+33
*** ERROR ***
End DoDot:2
End DoDot:1
+34 QUIT "OK"
GETVP(PAR,ENT) ;
+1 DO ENTDFLT^XPAR1(.ENT)
+2 QUIT ENT
CHGENT(ENTIEN,ENTVP,ENTVAL,PARVAL) ;
+1 NEW INST,IEN
+2 SET INST=""
+3 SET FDA(FDA,8989.513,ENTIEN_","_PARAM_",",$SELECT(ENTVAL="@":.01,1:.02))=ENTVAL
+4 FOR
SET INST=$ORDER(^XTV(8989.5,"AC",PARAM,ENTVP,INST))
IF '$LENGTH(INST)
QUIT
Begin DoDot:1
+5 FOR IEN=0:0
SET IEN=$ORDER(^XTV(8989.5,"AC",PARAM,ENTVP,INST,IEN))
IF 'IEN
QUIT
Begin DoDot:2
+6 SET FDA(FDA+.1,8989.5,IEN_",",.01)=PARVAL
End DoDot:2
End DoDot:1
+7 QUIT