ORPATCHUTILS ;SLC/AGP - PRE/POST INSTALL OR*3.0*508 ;Apr 09, 2025@10:39:19
;;3.0;ORDER ENTRY/RESULTS REPORTING;**508**;Dec 17, 1997;Build 39
;
;
Q
;============================== ALERTS FILE #100.9 ========================================
; Alert sections array structure:
;
; ARRAY(IEN,"name")=NAME
; ARRAY(IEN,"error")=""
; ARRAY(IEN,"parameters",PARAMNAME)=VALUE
;
; IEN = Number the entry must be installed at in file 100.9
; NAME =.01 File: 100.9
; PARAMNAME = Parameter name to update VALUE = Value to store at the package precedents in the parameter
;
; each external API returns a 1 or 0, if 1 it is okay to continue to the next step of the install
; if 0 an error will be return in the entry "error" subscript
ENVCHKALERTS(ALERTS) ;
N IDX,RESULT
S RESULT=1
S IDX=0 F S IDX=$O(ALERTS(IDX)) Q:IDX'>0!(RESULT=0) D
.I '$D(^ORD(100.9,IDX)) Q
.I $P($G(^ORD(100.9,IDX,0)),U)'=ALERTS(IDX,"name") S ALERTS(IDX,"error")="Entry found in file 100.9",RESULT=0
Q RESULT
;
;
SETALERTSTUB(ALERTS,DISPLAY) ;
N DA,DIK,ID,IDX,FDA,IENS,MSG,RESULT
S DISPLAY=+$G(DISPLAY)
I DISPLAY D BMES^XPDUTL("Setting notifications stub entries...")
S IDX=0,RESULT=1 F S IDX=$O(ALERTS(IDX)) Q:IDX'>0 D
. I +$D(DISPLAY) D BMES^XPDUTL(" "_ALERTS(IDX,"name"))
. S ID=IDX_","
. I $D(^ORD(100.9,IDX)),$P($G(^ORD(100.9,IDX,0)),U)'=ALERTS(IDX,"name") D
.. I DISPLAY D BMES^XPDUTL(" "_$P(^ORD(100.9,IDX,0),U)_" will be overriden")
.. S DIK="^ORD(100.9,",DA=IDX
.. D ^DIK
.. S ID="+1,"
. K FDA,IENS,MSG
. S FDA(100.9,ID,.01)=ALERTS(IDX,"name")
. S IENS(1)=IDX
. D UPDATE^DIE("","FDA","IENS","MSG")
. I $D(MSG) D Q
..I DISPLAY D BMES^XPDUTL(" "_ALERTS(IDX,"name")_" did not get created")
..S ALERTS(IDX,"error")="Failed UPDATE^DIE" S RESULT=0
. I +$G(IENS(1))'=IDX D
..I DISPLAY D BMES^XPDUTL(" "_ALERTS(IDX,"name")_" IEN is not correct")
..S ALERTS(IDX,"error")="IEN is not correct" S RESULT=0
I DISPLAY D BMES^XPDUTL("Done"_$S('RESULT:" took errors",1:""))
Q RESULT
;
SETALERTPARAMS(ALERTS,DISPLAY) ;
N ENT,IDX,INST,LINE,ORERROR,PARAM,RESULT,VALUE
S DISPLAY=+$G(DISPLAY)
I DISPLAY D BMES^XPDUTL("Setting package level parameters new notifications...")
S ENT="PKG"
S RESULT=1
S IDX=0 F S IDX=$O(ALERTS(IDX)) Q:IDX'>0 D
.K INST,ORERROR,PARAM,VALUE
.S INST=ALERTS(IDX,"name")
.I DISPLAY D BMES^XPDUTL(" Notification "_INST)
.S PARAM="" F S PARAM=$O(ALERTS(IDX,"parameters",PARAM)) Q:PARAM="" D
..S VALUE=$G(ALERTS(IDX,"parameters",PARAM))
..I DISPLAY D BMES^XPDUTL(" Setting Parameter "_PARAM)
..D EN^XPAR(ENT,PARAM,INST,VALUE,.ORERROR)
..I +ORERROR D
...I DISPLAY D BMES^XPDUTL(" Error setting values")
...S ALERTS(IDX,"error")="Failed updating "_PARAM,RESULT=0
I +$D(DISPLAY) D BMES^XPDUTL("Done"_$S('RESULT:" took errors",1:""))
Q RESULT
;
;============================== ALERTS FILE #100.9 ========================================
;
SETPARAMS(INPUTS,DISPLAY) ;
N ENT,ERROR,PARAM,INST,TEXT,VALUE
S DISPLAY=+$G(DISPLAY)
S PARAM="" F S PARAM=$O(INPUTS(PARAM)) Q:PARAM="" D
.I DISPLAY D BMES^XPDUTL(" "_PARAM)
.S ENT="" F S ENT=$O(INPUTS(PARAM,ENT)) Q:ENT="" D
..S INST="" F S INST=$O(INPUTS(PARAM,ENT,INST)) Q:INST="" D
...S VALUE=$G(INPUTS(PARAM,ENT,INST))
...K ERROR D EN^XPAR(ENT,PARAM,INST,VALUE,.ERROR)
...I +ERROR>0,DISPLAY D Q
....S TEXT(1)=" Error updating inputs:"
....S TEXT(2)=" Entity: "_ENT
....S TEXT(3)=" Instance: "_INST
....S TEXT(4)=" Value: "_VALUE
....D BMES^XPDUTL(.TEXT)
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORPATCHUTILS 3612 printed May 25, 2026@12:36:40 Page 2
ORPATCHUTILS ;SLC/AGP - PRE/POST INSTALL OR*3.0*508 ;Apr 09, 2025@10:39:19
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**508**;Dec 17, 1997;Build 39
+2 ;
+3 ;
+4 QUIT
+5 ;============================== ALERTS FILE #100.9 ========================================
+6 ; Alert sections array structure:
+7 ;
+8 ; ARRAY(IEN,"name")=NAME
+9 ; ARRAY(IEN,"error")=""
+10 ; ARRAY(IEN,"parameters",PARAMNAME)=VALUE
+11 ;
+12 ; IEN = Number the entry must be installed at in file 100.9
+13 ; NAME =.01 File: 100.9
+14 ; PARAMNAME = Parameter name to update VALUE = Value to store at the package precedents in the parameter
+15 ;
+16 ; each external API returns a 1 or 0, if 1 it is okay to continue to the next step of the install
+17 ; if 0 an error will be return in the entry "error" subscript
ENVCHKALERTS(ALERTS) ;
+1 NEW IDX,RESULT
+2 SET RESULT=1
+3 SET IDX=0
FOR
SET IDX=$ORDER(ALERTS(IDX))
if IDX'>0!(RESULT=0)
QUIT
Begin DoDot:1
+4 IF '$DATA(^ORD(100.9,IDX))
QUIT
+5 IF $PIECE($GET(^ORD(100.9,IDX,0)),U)'=ALERTS(IDX,"name")
SET ALERTS(IDX,"error")="Entry found in file 100.9"
SET RESULT=0
End DoDot:1
+6 QUIT RESULT
+7 ;
+8 ;
SETALERTSTUB(ALERTS,DISPLAY) ;
+1 NEW DA,DIK,ID,IDX,FDA,IENS,MSG,RESULT
+2 SET DISPLAY=+$GET(DISPLAY)
+3 IF DISPLAY
DO BMES^XPDUTL("Setting notifications stub entries...")
+4 SET IDX=0
SET RESULT=1
FOR
SET IDX=$ORDER(ALERTS(IDX))
if IDX'>0
QUIT
Begin DoDot:1
+5 IF +$DATA(DISPLAY)
DO BMES^XPDUTL(" "_ALERTS(IDX,"name"))
+6 SET ID=IDX_","
+7 IF $DATA(^ORD(100.9,IDX))
IF $PIECE($GET(^ORD(100.9,IDX,0)),U)'=ALERTS(IDX,"name")
Begin DoDot:2
+8 IF DISPLAY
DO BMES^XPDUTL(" "_$PIECE(^ORD(100.9,IDX,0),U)_" will be overriden")
+9 SET DIK="^ORD(100.9,"
SET DA=IDX
+10 DO ^DIK
+11 SET ID="+1,"
End DoDot:2
+12 KILL FDA,IENS,MSG
+13 SET FDA(100.9,ID,.01)=ALERTS(IDX,"name")
+14 SET IENS(1)=IDX
+15 DO UPDATE^DIE("","FDA","IENS","MSG")
+16 IF $DATA(MSG)
Begin DoDot:2
+17 IF DISPLAY
DO BMES^XPDUTL(" "_ALERTS(IDX,"name")_" did not get created")
+18 SET ALERTS(IDX,"error")="Failed UPDATE^DIE"
SET RESULT=0
End DoDot:2
QUIT
+19 IF +$GET(IENS(1))'=IDX
Begin DoDot:2
+20 IF DISPLAY
DO BMES^XPDUTL(" "_ALERTS(IDX,"name")_" IEN is not correct")
+21 SET ALERTS(IDX,"error")="IEN is not correct"
SET RESULT=0
End DoDot:2
End DoDot:1
+22 IF DISPLAY
DO BMES^XPDUTL("Done"_$SELECT('RESULT:" took errors",1:""))
+23 QUIT RESULT
+24 ;
SETALERTPARAMS(ALERTS,DISPLAY) ;
+1 NEW ENT,IDX,INST,LINE,ORERROR,PARAM,RESULT,VALUE
+2 SET DISPLAY=+$GET(DISPLAY)
+3 IF DISPLAY
DO BMES^XPDUTL("Setting package level parameters new notifications...")
+4 SET ENT="PKG"
+5 SET RESULT=1
+6 SET IDX=0
FOR
SET IDX=$ORDER(ALERTS(IDX))
if IDX'>0
QUIT
Begin DoDot:1
+7 KILL INST,ORERROR,PARAM,VALUE
+8 SET INST=ALERTS(IDX,"name")
+9 IF DISPLAY
DO BMES^XPDUTL(" Notification "_INST)
+10 SET PARAM=""
FOR
SET PARAM=$ORDER(ALERTS(IDX,"parameters",PARAM))
if PARAM=""
QUIT
Begin DoDot:2
+11 SET VALUE=$GET(ALERTS(IDX,"parameters",PARAM))
+12 IF DISPLAY
DO BMES^XPDUTL(" Setting Parameter "_PARAM)
+13 DO EN^XPAR(ENT,PARAM,INST,VALUE,.ORERROR)
+14 IF +ORERROR
Begin DoDot:3
+15 IF DISPLAY
DO BMES^XPDUTL(" Error setting values")
+16 SET ALERTS(IDX,"error")="Failed updating "_PARAM
SET RESULT=0
End DoDot:3
End DoDot:2
End DoDot:1
+17 IF +$DATA(DISPLAY)
DO BMES^XPDUTL("Done"_$SELECT('RESULT:" took errors",1:""))
+18 QUIT RESULT
+19 ;
+20 ;============================== ALERTS FILE #100.9 ========================================
+21 ;
SETPARAMS(INPUTS,DISPLAY) ;
+1 NEW ENT,ERROR,PARAM,INST,TEXT,VALUE
+2 SET DISPLAY=+$GET(DISPLAY)
+3 SET PARAM=""
FOR
SET PARAM=$ORDER(INPUTS(PARAM))
if PARAM=""
QUIT
Begin DoDot:1
+4 IF DISPLAY
DO BMES^XPDUTL(" "_PARAM)
+5 SET ENT=""
FOR
SET ENT=$ORDER(INPUTS(PARAM,ENT))
if ENT=""
QUIT
Begin DoDot:2
+6 SET INST=""
FOR
SET INST=$ORDER(INPUTS(PARAM,ENT,INST))
if INST=""
QUIT
Begin DoDot:3
+7 SET VALUE=$GET(INPUTS(PARAM,ENT,INST))
+8 KILL ERROR
DO EN^XPAR(ENT,PARAM,INST,VALUE,.ERROR)
+9 IF +ERROR>0
IF DISPLAY
Begin DoDot:4
+10 SET TEXT(1)=" Error updating inputs:"
+11 SET TEXT(2)=" Entity: "_ENT
+12 SET TEXT(3)=" Instance: "_INST
+13 SET TEXT(4)=" Value: "_VALUE
+14 DO BMES^XPDUTL(.TEXT)
End DoDot:4
QUIT
End DoDot:3
End DoDot:2
End DoDot:1
+15 QUIT
+16 ;