RORSET02 ;BPIOFO/CLR - NEW REGISTRY SETUP FROM POST-INSTALL ;6/06/2012
;;1.5;CLINICAL CASE REGISTRIES;**18,21,26,33**;Feb 17, 2006;Build 81
; This routine uses the following IAs:
;
; #10063 ^%ZTLOAD
; #10026 ^DIR
; #10103 ^XLFDT
; #10141 ^XPDUTL
;
;*****************************************************************************
;*****************************************************************************
; --- ROUTINE MODIFICATION LOG ---
;
;PKG/PATCH DATE DEVELOPER MODIFICATION
;----------- --------- ----------- ----------------------------------------
;ROR*1.5*21 NOV 2013 T KOPP Added env check, pre/post install logic
; Added new of ZTQUEUED variable
; Added initialization of registry params
; for new registries
; Corrected max # of strings variable used
; from MAXNTSK to RORMNTSK
;ROR*1.5*26 APR 2015 T KOPP Corrected 'suspend' parameters to strip
; date, leaving only time portions
;ROR*1.5*33 MAY 2018 F TRAXLER ROR TASK scheduling changes
;******************************************************************************
;******************************************************************************
;
N RORPARM,RORBUF,RORI,RORDIFF,ROROUT,RORMSG,RORSUSP,MAXNTSK
N RC,REGNAME,RORMNTSK,RORSUSP,TMP,REGLST,RORINFO
N ZTCPU,ZTDESC,ZTIO,ZTKIL,ZTPRI,ZTRTN,ZTSAVE,ZTSK,ZTSYNC,ZTUCI,ZTREQ,ZTDTH
N DIR,DIRUT,Y,DIERR,FLD,NODE,RORERRDL,RORQ,ZTQUEUED
;
S RORPARM("ERR")=1 ; Enable error processing
S RORPARM("LOG")=1 ; Enable event recording
D INIT^RORUTL01("RORSET02")
D CLEAR^RORERR("TASK^RORSET02")
;--- display all ACTIVE auto confirm registries that have not been initialized
D BMES^XPDUTL(" *** Checking for registry(s) to be initialized")
S RC=$$REGSEL^RORUTL01("UA")
I RC<0 D BMES^XPDUTL($$MSG^RORERR20(RC,,," file #798.1")),BMES^XPDUTL("") Q
I '$D(REGLST) D Q
. D BMES^XPDUTL(""),BMES^XPDUTL(" No active registries were found needing to be initialized.")
. D BMES^XPDUTL(""),BMES^XPDUTL("")
D BMES^XPDUTL(""),BMES^XPDUTL("")
D BMES^XPDUTL(" The following registry(s) will be populated with new patients: ")
S REGNAME="" F S REGNAME=$O(REGLST(REGNAME)) Q:REGNAME="" D
. D MES^XPDUTL($J("",10)_REGNAME)
D BMES^XPDUTL("")
D BMES^XPDUTL(" *** Storing registry setup parameters")
S RORMNTSK=$G(XPDQUES("POSQ1")),RORSUSP=$G(XPDQUES("POSQ2"))
I RORSUSP S RORSUSP=($G(XPDQUES("POSQ3"))#1)_U_($G(XPDQUES("POSQ4"))#1)
S RORQ=$G(XPDQUES("POSQ5"))
I RORQ<$$NOW^XLFDT() S RORQ=$$NOW^XLFDT()
D CONFTXT^RORSETU1(RORMNTSK,RORSUSP)
;log parameters in log
D TP^ROR10(.RORINFO,"RORFLSET")
D TP^ROR10(.RORINFO,"RORFLCLR")
D TP^ROR10(.RORINFO,"RORMNTSK")
D TP^ROR10(.RORINFO,"RORSUSP")
D LOG^RORLOG(,"Task Parameters",,.RORINFO)
;--- Schedule the setup task
I RORQ<$$NOW^XLFDT() S RORQ=$$NOW^XLFDT()
S ZTRTN="TASK^RORSET02",ZTIO="",ZTDTH=$$FMTH^XLFDT(RORQ),ZTQUEUED=1
S ZTDESC="Local Registries Initialization"
F TMP="RORMNTSK","RORSUSP" S ZTSAVE(TMP)=""
S ZTSAVE("REGLST(")=""
D ^%ZTLOAD
I $G(ZTSK) D Q
. D BMES^XPDUTL("The scheduled task number is "_ZTSK)
D BMES^XPDUTL("")
D BMES^XPDUTL(" ROR INITIALIZE task was not scheduled and is required")
D BMES^XPDUTL(" to complete the patch"),BMES^XPDUTL(" Try restarting the install")
D BMES^XPDUTL(" If this error continues, please enter a Remedy ticket")
D BMES^XPDUTL(" *** Patch install aborted")
Q
;
ERROR ;--- Display stack errors
D DSPSTK^RORERR()
Q
;
;***** ENTRY POINT OF THE REGISTRY SETUP TASK
;
; RORMNTSK Maximum number of the registry update subtasks
; RORREG RegistryIEN^RegistryName
; RORSUSP Task suspension time frame (StartTime^EndTime)
;
TASK ;
N RORERROR ; Error processing data
N RORLOG ; Log subsystem constants & variables
N RORPARM ; Application parameters
;
N RC,REGNAME,TMP,REGIEN
N RORSCHEDDT,RORSCHEDINFO,RORSCHEDULE,RORTASKCHK,RORUNSCHEDULE
S RORPARM("DEVELOPER")=1 ; Enable modifications
S RORPARM("ERR")=1 ; Enable error processing
S RORPARM("LOG")=1 ; Enable event recording
S RORPARM("SETUP")=1 ; Registry setup indicator
;
;--- Check if ROR TASK option is running
S RORTASKCHK=$$TASKCHK^RORUTL18("ROR TASK")
I RORTASKCHK'=0 D Q ;stop if ROR TASK is running
. S RC=$$ERROR^RORERR(-76,,,,"ROR TASK")
;--- Get ROR TASK schedule information
S RORSCHEDINFO=$$GETSCHED^RORUTL18("ROR TASK")
;--- Unschedule ROR TASK option if it is scheduled
I RORSCHEDINFO'="" S RORUNSCHEDULE=$$SETSCHED^RORUTL18("ROR TASK","@")
;--- Check list of registries
I $D(REGLST)<10 D Q
. S RC=$$ERROR^RORERR(-28,,,," initialize")
;--- Populate the registry
S RC=$$UPDATE^RORUPD(.REGLST,$G(RORMNTSK),$G(RORSUSP)) Q:RC<0
;--- Setup the registry
S REGNAME="" F S REGNAME=$O(REGLST(REGNAME)) Q:REGNAME="" D
. S REGIEN=$$REGIEN^RORUTL02(REGNAME)
. I REGIEN<0 S RC=$$ERROR^RORERR(-112,,,,REGNAME) Q
. S RC=$$PREPARE^RORSETU2(REGIEN)
. I RC<0 S RC=$$ERROR^RORERR(-112,,,,REGNAME) Q
. ;--- Send the notification e-mail
. S:RC'<0 TMP=$$SENDINFO^RORUTL17(+REGIEN,,"E")
. ;--- Cleanup
. I RC'<0 D S ZTREQ="@"
. . K ^XTMP("RORUPDR"_+REGIEN)
;--- reschedule ROR TASK option
N XMY,XMSUB,XMTEXT
S RORSCHEDINFO=$G(RORSCHEDINFO)
I RORSCHEDINFO="" D Q ;ROR TASK is not currently in FILE 19.2
. S XMY(DUZ)="" ;message recipient
. S XMSUB="ROR TASK option must be scheduled"
. S XMTEXT(1)="Please use the Schedule/Unschedule Options [XUTM SCHEDULE]"
. S XMTEXT(2)="option to schedule the ROR TASK option to run as a regular"
. S XMTEXT(3)="background job."
. S XMTEXT(4)=" "
. S XMTEXT(5)="Set the time of day to whatever you think best."
. S XMTEXT(6)="Set the Rescheduling Frequency = 1D"
. S XMTEXT(7)="Set the Task Parameters = VA HEPC, VA HIV"
. S XMTEXT="XMTEXT("
. D ^XMD
S RORSCHEDDT=$$FMADD^XLFDT($$NOW^XLFDT(),,1) ;use 1 hour from now
S RORSCHEDULE=$$SETSCHED^RORUTL18("ROR TASK",RORSCHEDDT,,"1D",,,1)
;Send MailMan message about ROR TASK option rescheduling success
I RORSCHEDULE=1 D
. S RORSCHEDINFO=$$GETSCHED^RORUTL18("ROR TASK")
. S XMY(DUZ)="" ;message recipient
. S XMSUB="ROR TASK option was rescheduled"
. S XMTEXT(1)="The ROR TASK option was successfully rescheduled."
. S XMTEXT(2)=" "
. S XMTEXT(3)="You may wish to check/alter the scheduling conditions, but"
. S XMTEXT(4)="please keep this option scheduled at all times unless a ROR"
. S XMTEXT(5)="patch is being installed."
. S XMTEXT(6)=" "
. S XMTEXT(7)="Use Schedule/Unschedule Options [XUTM SCHEDULE] to check."
. S XMTEXT="XMTEXT("
I RORSCHEDULE'=1 D
. S XMY(DUZ)="" ;message recipient
. S XMSUB="ROR TASK option was not rescheduled"
. S XMTEXT(1)="The ROR TASK option could not be rescheduled."
. S XMTEXT(2)="Please reschedule it as soon as possible."
. S XMTEXT(3)="ROR TASK should be scheduled to run daily unless a ROR"
. S XMTEXT(4)="patch is being installed."
. S XMTEXT(5)=" "
. S XMTEXT(6)="Use the Schedule/Unschedule Options [XUTM SCHEDULE] option"
. S XMTEXT(7)="to schedule ROR TASK."
. S XMTEXT="XMTEXT("
D ^XMD
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRORSET02 7478 printed Dec 13, 2024@01:43:24 Page 2
RORSET02 ;BPIOFO/CLR - NEW REGISTRY SETUP FROM POST-INSTALL ;6/06/2012
+1 ;;1.5;CLINICAL CASE REGISTRIES;**18,21,26,33**;Feb 17, 2006;Build 81
+2 ; This routine uses the following IAs:
+3 ;
+4 ; #10063 ^%ZTLOAD
+5 ; #10026 ^DIR
+6 ; #10103 ^XLFDT
+7 ; #10141 ^XPDUTL
+8 ;
+9 ;*****************************************************************************
+10 ;*****************************************************************************
+11 ; --- ROUTINE MODIFICATION LOG ---
+12 ;
+13 ;PKG/PATCH DATE DEVELOPER MODIFICATION
+14 ;----------- --------- ----------- ----------------------------------------
+15 ;ROR*1.5*21 NOV 2013 T KOPP Added env check, pre/post install logic
+16 ; Added new of ZTQUEUED variable
+17 ; Added initialization of registry params
+18 ; for new registries
+19 ; Corrected max # of strings variable used
+20 ; from MAXNTSK to RORMNTSK
+21 ;ROR*1.5*26 APR 2015 T KOPP Corrected 'suspend' parameters to strip
+22 ; date, leaving only time portions
+23 ;ROR*1.5*33 MAY 2018 F TRAXLER ROR TASK scheduling changes
+24 ;******************************************************************************
+25 ;******************************************************************************
+26 ;
+27 NEW RORPARM,RORBUF,RORI,RORDIFF,ROROUT,RORMSG,RORSUSP,MAXNTSK
+28 NEW RC,REGNAME,RORMNTSK,RORSUSP,TMP,REGLST,RORINFO
+29 NEW ZTCPU,ZTDESC,ZTIO,ZTKIL,ZTPRI,ZTRTN,ZTSAVE,ZTSK,ZTSYNC,ZTUCI,ZTREQ,ZTDTH
+30 NEW DIR,DIRUT,Y,DIERR,FLD,NODE,RORERRDL,RORQ,ZTQUEUED
+31 ;
+32 ; Enable error processing
SET RORPARM("ERR")=1
+33 ; Enable event recording
SET RORPARM("LOG")=1
+34 DO INIT^RORUTL01("RORSET02")
+35 DO CLEAR^RORERR("TASK^RORSET02")
+36 ;--- display all ACTIVE auto confirm registries that have not been initialized
+37 DO BMES^XPDUTL(" *** Checking for registry(s) to be initialized")
+38 SET RC=$$REGSEL^RORUTL01("UA")
+39 IF RC<0
DO BMES^XPDUTL($$MSG^RORERR20(RC,,," file #798.1"))
DO BMES^XPDUTL("")
QUIT
+40 IF '$DATA(REGLST)
Begin DoDot:1
+41 DO BMES^XPDUTL("")
DO BMES^XPDUTL(" No active registries were found needing to be initialized.")
+42 DO BMES^XPDUTL("")
DO BMES^XPDUTL("")
End DoDot:1
QUIT
+43 DO BMES^XPDUTL("")
DO BMES^XPDUTL("")
+44 DO BMES^XPDUTL(" The following registry(s) will be populated with new patients: ")
+45 SET REGNAME=""
FOR
SET REGNAME=$ORDER(REGLST(REGNAME))
if REGNAME=""
QUIT
Begin DoDot:1
+46 DO MES^XPDUTL($JUSTIFY("",10)_REGNAME)
End DoDot:1
+47 DO BMES^XPDUTL("")
+48 DO BMES^XPDUTL(" *** Storing registry setup parameters")
+49 SET RORMNTSK=$GET(XPDQUES("POSQ1"))
SET RORSUSP=$GET(XPDQUES("POSQ2"))
+50 IF RORSUSP
SET RORSUSP=($GET(XPDQUES("POSQ3"))#1)_U_($GET(XPDQUES("POSQ4"))#1)
+51 SET RORQ=$GET(XPDQUES("POSQ5"))
+52 IF RORQ<$$NOW^XLFDT()
SET RORQ=$$NOW^XLFDT()
+53 DO CONFTXT^RORSETU1(RORMNTSK,RORSUSP)
+54 ;log parameters in log
+55 DO TP^ROR10(.RORINFO,"RORFLSET")
+56 DO TP^ROR10(.RORINFO,"RORFLCLR")
+57 DO TP^ROR10(.RORINFO,"RORMNTSK")
+58 DO TP^ROR10(.RORINFO,"RORSUSP")
+59 DO LOG^RORLOG(,"Task Parameters",,.RORINFO)
+60 ;--- Schedule the setup task
+61 IF RORQ<$$NOW^XLFDT()
SET RORQ=$$NOW^XLFDT()
+62 SET ZTRTN="TASK^RORSET02"
SET ZTIO=""
SET ZTDTH=$$FMTH^XLFDT(RORQ)
SET ZTQUEUED=1
+63 SET ZTDESC="Local Registries Initialization"
+64 FOR TMP="RORMNTSK","RORSUSP"
SET ZTSAVE(TMP)=""
+65 SET ZTSAVE("REGLST(")=""
+66 DO ^%ZTLOAD
+67 IF $GET(ZTSK)
Begin DoDot:1
+68 DO BMES^XPDUTL("The scheduled task number is "_ZTSK)
End DoDot:1
QUIT
+69 DO BMES^XPDUTL("")
+70 DO BMES^XPDUTL(" ROR INITIALIZE task was not scheduled and is required")
+71 DO BMES^XPDUTL(" to complete the patch")
DO BMES^XPDUTL(" Try restarting the install")
+72 DO BMES^XPDUTL(" If this error continues, please enter a Remedy ticket")
+73 DO BMES^XPDUTL(" *** Patch install aborted")
+74 QUIT
+75 ;
ERROR ;--- Display stack errors
+1 DO DSPSTK^RORERR()
+2 QUIT
+3 ;
+4 ;***** ENTRY POINT OF THE REGISTRY SETUP TASK
+5 ;
+6 ; RORMNTSK Maximum number of the registry update subtasks
+7 ; RORREG RegistryIEN^RegistryName
+8 ; RORSUSP Task suspension time frame (StartTime^EndTime)
+9 ;
TASK ;
+1 ; Error processing data
NEW RORERROR
+2 ; Log subsystem constants & variables
NEW RORLOG
+3 ; Application parameters
NEW RORPARM
+4 ;
+5 NEW RC,REGNAME,TMP,REGIEN
+6 NEW RORSCHEDDT,RORSCHEDINFO,RORSCHEDULE,RORTASKCHK,RORUNSCHEDULE
+7 ; Enable modifications
SET RORPARM("DEVELOPER")=1
+8 ; Enable error processing
SET RORPARM("ERR")=1
+9 ; Enable event recording
SET RORPARM("LOG")=1
+10 ; Registry setup indicator
SET RORPARM("SETUP")=1
+11 ;
+12 ;--- Check if ROR TASK option is running
+13 SET RORTASKCHK=$$TASKCHK^RORUTL18("ROR TASK")
+14 ;stop if ROR TASK is running
IF RORTASKCHK'=0
Begin DoDot:1
+15 SET RC=$$ERROR^RORERR(-76,,,,"ROR TASK")
End DoDot:1
QUIT
+16 ;--- Get ROR TASK schedule information
+17 SET RORSCHEDINFO=$$GETSCHED^RORUTL18("ROR TASK")
+18 ;--- Unschedule ROR TASK option if it is scheduled
+19 IF RORSCHEDINFO'=""
SET RORUNSCHEDULE=$$SETSCHED^RORUTL18("ROR TASK","@")
+20 ;--- Check list of registries
+21 IF $DATA(REGLST)<10
Begin DoDot:1
+22 SET RC=$$ERROR^RORERR(-28,,,," initialize")
End DoDot:1
QUIT
+23 ;--- Populate the registry
+24 SET RC=$$UPDATE^RORUPD(.REGLST,$GET(RORMNTSK),$GET(RORSUSP))
if RC<0
QUIT
+25 ;--- Setup the registry
+26 SET REGNAME=""
FOR
SET REGNAME=$ORDER(REGLST(REGNAME))
if REGNAME=""
QUIT
Begin DoDot:1
+27 SET REGIEN=$$REGIEN^RORUTL02(REGNAME)
+28 IF REGIEN<0
SET RC=$$ERROR^RORERR(-112,,,,REGNAME)
QUIT
+29 SET RC=$$PREPARE^RORSETU2(REGIEN)
+30 IF RC<0
SET RC=$$ERROR^RORERR(-112,,,,REGNAME)
QUIT
+31 ;--- Send the notification e-mail
+32 if RC'<0
SET TMP=$$SENDINFO^RORUTL17(+REGIEN,,"E")
+33 ;--- Cleanup
+34 IF RC'<0
Begin DoDot:2
+35 KILL ^XTMP("RORUPDR"_+REGIEN)
End DoDot:2
SET ZTREQ="@"
End DoDot:1
+36 ;--- reschedule ROR TASK option
+37 NEW XMY,XMSUB,XMTEXT
+38 SET RORSCHEDINFO=$GET(RORSCHEDINFO)
+39 ;ROR TASK is not currently in FILE 19.2
IF RORSCHEDINFO=""
Begin DoDot:1
+40 ;message recipient
SET XMY(DUZ)=""
+41 SET XMSUB="ROR TASK option must be scheduled"
+42 SET XMTEXT(1)="Please use the Schedule/Unschedule Options [XUTM SCHEDULE]"
+43 SET XMTEXT(2)="option to schedule the ROR TASK option to run as a regular"
+44 SET XMTEXT(3)="background job."
+45 SET XMTEXT(4)=" "
+46 SET XMTEXT(5)="Set the time of day to whatever you think best."
+47 SET XMTEXT(6)="Set the Rescheduling Frequency = 1D"
+48 SET XMTEXT(7)="Set the Task Parameters = VA HEPC, VA HIV"
+49 SET XMTEXT="XMTEXT("
+50 DO ^XMD
End DoDot:1
QUIT
+51 ;use 1 hour from now
SET RORSCHEDDT=$$FMADD^XLFDT($$NOW^XLFDT(),,1)
+52 SET RORSCHEDULE=$$SETSCHED^RORUTL18("ROR TASK",RORSCHEDDT,,"1D",,,1)
+53 ;Send MailMan message about ROR TASK option rescheduling success
+54 IF RORSCHEDULE=1
Begin DoDot:1
+55 SET RORSCHEDINFO=$$GETSCHED^RORUTL18("ROR TASK")
+56 ;message recipient
SET XMY(DUZ)=""
+57 SET XMSUB="ROR TASK option was rescheduled"
+58 SET XMTEXT(1)="The ROR TASK option was successfully rescheduled."
+59 SET XMTEXT(2)=" "
+60 SET XMTEXT(3)="You may wish to check/alter the scheduling conditions, but"
+61 SET XMTEXT(4)="please keep this option scheduled at all times unless a ROR"
+62 SET XMTEXT(5)="patch is being installed."
+63 SET XMTEXT(6)=" "
+64 SET XMTEXT(7)="Use Schedule/Unschedule Options [XUTM SCHEDULE] to check."
+65 SET XMTEXT="XMTEXT("
End DoDot:1
+66 IF RORSCHEDULE'=1
Begin DoDot:1
+67 ;message recipient
SET XMY(DUZ)=""
+68 SET XMSUB="ROR TASK option was not rescheduled"
+69 SET XMTEXT(1)="The ROR TASK option could not be rescheduled."
+70 SET XMTEXT(2)="Please reschedule it as soon as possible."
+71 SET XMTEXT(3)="ROR TASK should be scheduled to run daily unless a ROR"
+72 SET XMTEXT(4)="patch is being installed."
+73 SET XMTEXT(5)=" "
+74 SET XMTEXT(6)="Use the Schedule/Unschedule Options [XUTM SCHEDULE] option"
+75 SET XMTEXT(7)="to schedule ROR TASK."
+76 SET XMTEXT="XMTEXT("
End DoDot:1
+77 DO ^XMD
+78 QUIT