YS221PST ;BAL/KTL - Patch 221 Post-init ; February, 27 2023@16:21
;;5.01;MENTAL HEALTH;**221**;Dec 30, 1994;Build 11
;
EDTDATE ; date used to update 601.71:18
;;3230504.1315
Q
PRE ; nothing necessary
Q
POST ; post-init
D INSTALLQ^YTXCHG("XCHGLST","YS221PST")
D RMRSTCT("MHLA")
D RMRSTCT("MHLB")
D RMRSTCT("MHLC-C")
D UPDURL
Q
;
RMRSTCT(NAME) ; Remove restriction on progress note generation
D RMVRP(NAME)
D ADDNT(NAME)
D UPDTST(NAME)
Q
RMVRP(NAME) ; Remove R PRIV and GENERATE PNOTE=Y
N IEN,REC
S IEN=$O(^YTT(601.71,"B",NAME,0)) Q:'IEN
S REC(9)="@"
S REC(28)="Y"
D FMUPD^YTXCHGU(601.71,.REC,IEN)
Q
ADDNT(NAME) ; Add TIU NOTE TITLE
D ADDNOTE^YTXCHGI(NAME)
Q
UPDTST(NAME) ; Update Date Edited
N IEN,REC
S IEN=$O(^YTT(601.71,"B",NAME,0)) Q:'IEN
S REC(18)=$P($T(EDTDATE+1),";;",2)
D FMUPD^YTXCHGU(601.71,.REC,IEN)
Q
;
UPDURL ; Update GUI TOOLS URL for MHA Web
N LIST,PARM,ERR,ENT,INST,VAL,TITL,CMD,SPEC,NEWVAL
K ^TMP($J,"XPAR")
S LIST=$NA(^TMP($J,"XPAR"))
S PARM="ORWT TOOLS MENU"
D ENVAL^XPAR(LIST,PARM,"",.ERR,1)
S ^XTMP("YS221-TOOLS",0)=$$FMADD^XLFDT(DT,7)_U_DT_U_"MH Backup Tools Menu"
M ^XTMP("YS221-TOOLS","XPAR")=^TMP($J,"XPAR")
S SPEC("/home?")="/home/a/?",SPEC("/home/?")="/home/a/?" ;In case URL entered home/? Patch 208 to 221
S SPEC("/home/b/?")="/home/a/?" ;Patch 208 to 221
S ENT="" F S ENT=$O(^TMP($J,"XPAR",ENT)) Q:ENT="" D
. S INST=0 F S INST=$O(^TMP($J,"XPAR",ENT,INST)) Q:+INST=0 D
.. S VAL=^TMP($J,"XPAR",ENT,INST)
.. I (VAL["mha.domain.ext/app/home?"!(VAL["mha.domain.ext/app/home/")) D
... S TITL=$P(VAL,"="),CMD=$P(VAL,"=",2,99)
... S CMD=$$REPLACE^XLFSTR(CMD,.SPEC)
... S NEWVAL=TITL_"="_CMD
... D BMES^XPDUTL("Updating "_CMD_" for "_ENT)
... D EN^XPAR(ENT,PARM,INST,NEWVAL,.ERR)
K ^TMP($J,"XPAR")
Q
;
XCHGLST(ARRAY) ; return array of instrument exchange entries
; ARRAY(cnt,1)=instrument exchange entry name
; ARRAY(cnt,2)=instrument exchange entry creation date
;
N I,X
F I=1:1 S X=$P($T(ENTRIES+I),";;",2,99) Q:X="zzzzz" D
. S ARRAY(I,1)=$P(X,U)
. S ARRAY(I,2)=$P(X,U,2)
Q
ENTRIES ; New MHA instruments ^ Exchange Entry Date
;;YS*5.01*221 BSS^05/04/2023@12:16:04
;;zzzzz
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYS221PST 2239 printed Dec 13, 2024@02:12:45 Page 2
YS221PST ;BAL/KTL - Patch 221 Post-init ; February, 27 2023@16:21
+1 ;;5.01;MENTAL HEALTH;**221**;Dec 30, 1994;Build 11
+2 ;
EDTDATE ; date used to update 601.71:18
+1 ;;3230504.1315
+2 QUIT
PRE ; nothing necessary
+1 QUIT
POST ; post-init
+1 DO INSTALLQ^YTXCHG("XCHGLST","YS221PST")
+2 DO RMRSTCT("MHLA")
+3 DO RMRSTCT("MHLB")
+4 DO RMRSTCT("MHLC-C")
+5 DO UPDURL
+6 QUIT
+7 ;
RMRSTCT(NAME) ; Remove restriction on progress note generation
+1 DO RMVRP(NAME)
+2 DO ADDNT(NAME)
+3 DO UPDTST(NAME)
+4 QUIT
RMVRP(NAME) ; Remove R PRIV and GENERATE PNOTE=Y
+1 NEW IEN,REC
+2 SET IEN=$ORDER(^YTT(601.71,"B",NAME,0))
if 'IEN
QUIT
+3 SET REC(9)="@"
+4 SET REC(28)="Y"
+5 DO FMUPD^YTXCHGU(601.71,.REC,IEN)
+6 QUIT
ADDNT(NAME) ; Add TIU NOTE TITLE
+1 DO ADDNOTE^YTXCHGI(NAME)
+2 QUIT
UPDTST(NAME) ; Update Date Edited
+1 NEW IEN,REC
+2 SET IEN=$ORDER(^YTT(601.71,"B",NAME,0))
if 'IEN
QUIT
+3 SET REC(18)=$PIECE($TEXT(EDTDATE+1),";;",2)
+4 DO FMUPD^YTXCHGU(601.71,.REC,IEN)
+5 QUIT
+6 ;
UPDURL ; Update GUI TOOLS URL for MHA Web
+1 NEW LIST,PARM,ERR,ENT,INST,VAL,TITL,CMD,SPEC,NEWVAL
+2 KILL ^TMP($JOB,"XPAR")
+3 SET LIST=$NAME(^TMP($JOB,"XPAR"))
+4 SET PARM="ORWT TOOLS MENU"
+5 DO ENVAL^XPAR(LIST,PARM,"",.ERR,1)
+6 SET ^XTMP("YS221-TOOLS",0)=$$FMADD^XLFDT(DT,7)_U_DT_U_"MH Backup Tools Menu"
+7 MERGE ^XTMP("YS221-TOOLS","XPAR")=^TMP($JOB,"XPAR")
+8 ;In case URL entered home/? Patch 208 to 221
SET SPEC("/home?")="/home/a/?"
SET SPEC("/home/?")="/home/a/?"
+9 ;Patch 208 to 221
SET SPEC("/home/b/?")="/home/a/?"
+10 SET ENT=""
FOR
SET ENT=$ORDER(^TMP($JOB,"XPAR",ENT))
if ENT=""
QUIT
Begin DoDot:1
+11 SET INST=0
FOR
SET INST=$ORDER(^TMP($JOB,"XPAR",ENT,INST))
if +INST=0
QUIT
Begin DoDot:2
+12 SET VAL=^TMP($JOB,"XPAR",ENT,INST)
+13 IF (VAL["mha.domain.ext/app/home?"!(VAL["mha.domain.ext/app/home/"))
Begin DoDot:3
+14 SET TITL=$PIECE(VAL,"=")
SET CMD=$PIECE(VAL,"=",2,99)
+15 SET CMD=$$REPLACE^XLFSTR(CMD,.SPEC)
+16 SET NEWVAL=TITL_"="_CMD
+17 DO BMES^XPDUTL("Updating "_CMD_" for "_ENT)
+18 DO EN^XPAR(ENT,PARM,INST,NEWVAL,.ERR)
End DoDot:3
End DoDot:2
End DoDot:1
+19 KILL ^TMP($JOB,"XPAR")
+20 QUIT
+21 ;
XCHGLST(ARRAY) ; return array of instrument exchange entries
+1 ; ARRAY(cnt,1)=instrument exchange entry name
+2 ; ARRAY(cnt,2)=instrument exchange entry creation date
+3 ;
+4 NEW I,X
+5 FOR I=1:1
SET X=$PIECE($TEXT(ENTRIES+I),";;",2,99)
if X="zzzzz"
QUIT
Begin DoDot:1
+6 SET ARRAY(I,1)=$PIECE(X,U)
+7 SET ARRAY(I,2)=$PIECE(X,U,2)
End DoDot:1
+8 QUIT
ENTRIES ; New MHA instruments ^ Exchange Entry Date
+1 ;;YS*5.01*221 BSS^05/04/2023@12:16:04
+2 ;;zzzzz
+3 QUIT