PSO7E529 ;ALB/BI - ENVIRONMENTAL CHECK/PRE-INSTALL FOR PSO*7.0*529 ;05/15/2018
;;7.0;OUTPATIENT PHARMACY;**529**;DEC 1997;Build 94
;External reference to ^XOB(18.12 supported by DBIA 5813
;External reference to ^XOB(18.02 supported by DBIA 5814
;External reference to ^XUSRB1 is supported by ICR 2240
;
; 1st: Makes an entry/update to the WEB SERVICE FILE #18.02 in global ^XOB(18.02,
; 2nd: Makes an entry/update to the WEB SERVICE FILE #18.02 in global ^XOB(18.02,
; 3nd: Makes an entry/update to the WEB SERVER FILE #18.12 in global ^XOB(18.12,
; 4th: Performs a web service call to validate the server connection.
;
N FDA ; -- FileMan Data Array
N WEBVICE ; -- Web Service Internal Entry Number
N WEBVER ; -- Web Server Internal Entry Number
N MULTIEN ; -- Web Service Multiple Internal Entry Number
N WSTAT ; -- Web Service Status
N IENROOT,MSGROOT,IENROOT1,VICEIEN
N PSODEAC,PSODEAMSG
;
N DIR,DTOUT,DUOUT,DIRUT,DIROUT,SERVADD,X,Y,ENVRMT
S ENVRMT="" I $$PROD^XUPROD S ENVRMT="P"
I ENVRMT="" D Q:$D(DIRUT)
. S DIR(0)="S^N:PRE-PROD;S:SQA/DEV"
. S DIR("A")="ENVIRONMENT TYPE" D ^DIR
. I $D(DIRUT) D Q
. . D BMES^XPDUTL("******************************************************************")
. . D BMES^XPDUTL("WARNING: The WEB SERVER/SERVICE ENVIRONMENT TYPE MUST BE SELECTED")
. . D BMES^XPDUTL(" >>>> Installation aborted <<<<")
. . D BMES^XPDUTL("******************************************************************")
. . S XPDQUIT=1 ; Do not install this transport global and KILL it from ^XTMP.
. S ENVRMT=$G(Y)
;
S:ENVRMT="P" SERVADD="prod.deals.vaec.domain.ext"
S:ENVRMT="N" SERVADD="dev.deals.vaec.domain.ext"
S:ENVRMT="S" SERVADD="dev.deals.vaec.domain.ext"
;
I $G(SERVADD)="" D Q
. D BMES^XPDUTL(" *******************************************************")
. D BMES^XPDUTL(" No Environment Selected - Patch Not Installed ")
. D BMES^XPDUTL(" *******************************************************")
. S XPDQUIT=1 ; Do not install this transport global and KILL it from ^XTMP.
;
K FDA
S FDA(18.02,"?+1,",.01)="PSO DOJ/DEA WEB SERVICE" ; NAME
S FDA(18.02,"?+1,",.02)="REST" ; TYPE
S FDA(18.02,"?+1,",200)="/deaInfo/" ; CONTEXT ROOT
S FDA(18.02,"?+1,",201)="" ; AVAILABILITY RESOURCE
D UPDATE^DIE("E","FDA","IENROOT","MSGROOT")
K IENROOT,MSGROOT,FDA
;
S FDA(18.12,"?+1,",.01)="PSO DOJ/DEA WEB SERVER" ; NAME
S FDA(18.12,"?+1,",.03)=443 ; PORT
S FDA(18.12,"?+1,",.04)=SERVADD ; SERVER
S FDA(18.12,"?+1,",.06)="ENABLED" ; STATUS 1-ENABLED / 0-DISABLED
S FDA(18.12,"?+1,",.07)=10 ; DEFAULT HTTP TIMEOUT
S FDA(18.12,"?+1,",1.01)="YES" ; LOGIN REQUIRED
S FDA(18.12,"?+1,",3.01)="TRUE" ; SSL ENABLED
S FDA(18.12,"?+1,",3.02)="encrypt_only_tlsv12" ; SSL CONFIGURATION
S FDA(18.12,"?+1,",3.03)=443 ; SSL PORT
I ENVRMT="P" D
. S FDA(18.12,"?+1,",200)="user"
. S FDA(18.12,"?+1,",300)=$$ENCRYP^XUSRB1("hkttHhdfn6XK")
I ENVRMT'="P" D
. S FDA(18.12,"?+1,",200)="user"
. S FDA(18.12,"?+1,",300)=$$ENCRYP^XUSRB1("pass")
D UPDATE^DIE("E","FDA","IENROOT","MSGROOT")
;
S IENROOT1=$G(IENROOT(1)),MULTIEN=0
;
S WEBVER=$S(IENROOT1:IENROOT1,1:WEBVER)
K IENROOT,MSGROOT,FDA
S VICEIEN=0 F S VICEIEN=$O(^XOB(18.12,WEBVER,100,"B",VICEIEN)) Q:'VICEIEN I $$GET1^DIQ(18.02,VICEIEN,.01)="PSO DOJ/DEA WEB SERVICE" S MULTIEN=VICEIEN Q
S MULTIEN=$S(MULTIEN:MULTIEN,1:"+1")
S FDA(18.121,MULTIEN_","_WEBVER_",",.01)="PSO DOJ/DEA WEB SERVICE" ; WEB SERVICE
S FDA(18.121,MULTIEN_","_WEBVER_",",.06)="ENABLED" ; STATUS 1-ENABLED / 0-DISABLED
D UPDATE^DIE("E","FDA","IENROOT","MSGROOT")
;
D BMES^XPDUTL("Connecting to PSO DOJ/DEA WEB SERVICE..")
S WSTAT=$$GET
I '$G(WSTAT) D Q
. D BMES^XPDUTL(" *********************************************************")
. D BMES^XPDUTL(" WARNING: The WEB SERVER/SERVICE SETUP FAILED")
. D BMES^XPDUTL(" Please try again after a few minutes. Failed to install,")
. D BMES^XPDUTL(" please submit a Service Now ticket.")
. D BMES^XPDUTL(" >>>> Installation aborted <<<<")
. D BMES^XPDUTL(" *********************************************************")
. S XPDQUIT=1 ; Do not install this transport global and KILL it from ^XTMP.
;
D FILE^DID(8991.8,,"ENTRIES","PSODEAC","PSODEAMSG")
I '$G(PSODEAC("ENTRIES")) D Q
. D BMES^XPDUTL(" *********************************************************")
. D BMES^XPDUTL(" WARNING: XU*8.0*688 required for installation of this patch ")
. D BMES^XPDUTL(" >>>> Installation aborted <<<<")
. D BMES^XPDUTL(" *********************************************************")
. S XPDQUIT=1 ; Do not install this transport global and KILL it from ^XTMP.
;
D BMES^XPDUTL(" *******************************************************")
D BMES^XPDUTL(" The Environmental Check Routine finished Successfully.")
D BMES^XPDUTL(" *******************************************************")
Q
;
GET() ; -- Send a test to the Web Service and compare the Result
N SERVER,SERVICE,RESOURCE,REQUEST,SC,RESPONSE,RESPJSON,DATA,PSOERR
S SERVER="PSO DOJ/DEA WEB SERVER"
S SERVICE="PSO DOJ/DEA WEB SERVICE"
S RESOURCE=""
;
; Get an instance of the REST request object.
S REQUEST=$$GETREST^XOBWLIB(SERVICE,SERVER)
;
; Execute the HTTP Get method.
S SC=$$GET^XOBWLIB(REQUEST,RESOURCE,.PSOERR,0)
I 'SC I PSOERR.code=404 Q 1
I 'SC Q "0^General Service Error"
;
; Process the response.
S RESPONSE=REQUEST.HttpResponse
S DATA=RESPONSE.Data
S RESPJSON=""
F Q:DATA.AtEnd Set RESPJSON=RESPJSON_DATA.ReadLine()
I $L($G(RESPJSON)) Q 1
Q 0
;
PRE ; Pre-Install
I '$D(ZTQUEUED) D Q
.N PSOASTER S $P(PSOASTER,"*",74)="*"
.S XPDABORT=1
.D BMES^XPDUTL(PSOASTER)
.D MES^XPDUTL(" Patch Install must be Queued. Please unload this distribution")
.D MES^XPDUTL(" and run install again with Queueing.")
.D MES^XPDUTL(PSOASTER)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSO7E529 6470 printed Dec 13, 2024@02:23:37 Page 2
PSO7E529 ;ALB/BI - ENVIRONMENTAL CHECK/PRE-INSTALL FOR PSO*7.0*529 ;05/15/2018
+1 ;;7.0;OUTPATIENT PHARMACY;**529**;DEC 1997;Build 94
+2 ;External reference to ^XOB(18.12 supported by DBIA 5813
+3 ;External reference to ^XOB(18.02 supported by DBIA 5814
+4 ;External reference to ^XUSRB1 is supported by ICR 2240
+5 ;
+6 ; 1st: Makes an entry/update to the WEB SERVICE FILE #18.02 in global ^XOB(18.02,
+7 ; 2nd: Makes an entry/update to the WEB SERVICE FILE #18.02 in global ^XOB(18.02,
+8 ; 3nd: Makes an entry/update to the WEB SERVER FILE #18.12 in global ^XOB(18.12,
+9 ; 4th: Performs a web service call to validate the server connection.
+10 ;
+11 ; -- FileMan Data Array
NEW FDA
+12 ; -- Web Service Internal Entry Number
NEW WEBVICE
+13 ; -- Web Server Internal Entry Number
NEW WEBVER
+14 ; -- Web Service Multiple Internal Entry Number
NEW MULTIEN
+15 ; -- Web Service Status
NEW WSTAT
+16 NEW IENROOT,MSGROOT,IENROOT1,VICEIEN
+17 NEW PSODEAC,PSODEAMSG
+18 ;
+19 NEW DIR,DTOUT,DUOUT,DIRUT,DIROUT,SERVADD,X,Y,ENVRMT
+20 SET ENVRMT=""
IF $$PROD^XUPROD
SET ENVRMT="P"
+21 IF ENVRMT=""
Begin DoDot:1
+22 SET DIR(0)="S^N:PRE-PROD;S:SQA/DEV"
+23 SET DIR("A")="ENVIRONMENT TYPE"
DO ^DIR
+24 IF $DATA(DIRUT)
Begin DoDot:2
+25 DO BMES^XPDUTL("******************************************************************")
+26 DO BMES^XPDUTL("WARNING: The WEB SERVER/SERVICE ENVIRONMENT TYPE MUST BE SELECTED")
+27 DO BMES^XPDUTL(" >>>> Installation aborted <<<<")
+28 DO BMES^XPDUTL("******************************************************************")
+29 ; Do not install this transport global and KILL it from ^XTMP.
SET XPDQUIT=1
End DoDot:2
QUIT
+30 SET ENVRMT=$GET(Y)
End DoDot:1
if $DATA(DIRUT)
QUIT
+31 ;
+32 if ENVRMT="P"
SET SERVADD="prod.deals.vaec.domain.ext"
+33 if ENVRMT="N"
SET SERVADD="dev.deals.vaec.domain.ext"
+34 if ENVRMT="S"
SET SERVADD="dev.deals.vaec.domain.ext"
+35 ;
+36 IF $GET(SERVADD)=""
Begin DoDot:1
+37 DO BMES^XPDUTL(" *******************************************************")
+38 DO BMES^XPDUTL(" No Environment Selected - Patch Not Installed ")
+39 DO BMES^XPDUTL(" *******************************************************")
+40 ; Do not install this transport global and KILL it from ^XTMP.
SET XPDQUIT=1
End DoDot:1
QUIT
+41 ;
+42 KILL FDA
+43 ; NAME
SET FDA(18.02,"?+1,",.01)="PSO DOJ/DEA WEB SERVICE"
+44 ; TYPE
SET FDA(18.02,"?+1,",.02)="REST"
+45 ; CONTEXT ROOT
SET FDA(18.02,"?+1,",200)="/deaInfo/"
+46 ; AVAILABILITY RESOURCE
SET FDA(18.02,"?+1,",201)=""
+47 DO UPDATE^DIE("E","FDA","IENROOT","MSGROOT")
+48 KILL IENROOT,MSGROOT,FDA
+49 ;
+50 ; NAME
SET FDA(18.12,"?+1,",.01)="PSO DOJ/DEA WEB SERVER"
+51 ; PORT
SET FDA(18.12,"?+1,",.03)=443
+52 ; SERVER
SET FDA(18.12,"?+1,",.04)=SERVADD
+53 ; STATUS 1-ENABLED / 0-DISABLED
SET FDA(18.12,"?+1,",.06)="ENABLED"
+54 ; DEFAULT HTTP TIMEOUT
SET FDA(18.12,"?+1,",.07)=10
+55 ; LOGIN REQUIRED
SET FDA(18.12,"?+1,",1.01)="YES"
+56 ; SSL ENABLED
SET FDA(18.12,"?+1,",3.01)="TRUE"
+57 ; SSL CONFIGURATION
SET FDA(18.12,"?+1,",3.02)="encrypt_only_tlsv12"
+58 ; SSL PORT
SET FDA(18.12,"?+1,",3.03)=443
+59 IF ENVRMT="P"
Begin DoDot:1
+60 SET FDA(18.12,"?+1,",200)="user"
+61 SET FDA(18.12,"?+1,",300)=$$ENCRYP^XUSRB1("hkttHhdfn6XK")
End DoDot:1
+62 IF ENVRMT'="P"
Begin DoDot:1
+63 SET FDA(18.12,"?+1,",200)="user"
+64 SET FDA(18.12,"?+1,",300)=$$ENCRYP^XUSRB1("pass")
End DoDot:1
+65 DO UPDATE^DIE("E","FDA","IENROOT","MSGROOT")
+66 ;
+67 SET IENROOT1=$GET(IENROOT(1))
SET MULTIEN=0
+68 ;
+69 SET WEBVER=$SELECT(IENROOT1:IENROOT1,1:WEBVER)
+70 KILL IENROOT,MSGROOT,FDA
+71 SET VICEIEN=0
FOR
SET VICEIEN=$ORDER(^XOB(18.12,WEBVER,100,"B",VICEIEN))
if 'VICEIEN
QUIT
IF $$GET1^DIQ(18.02,VICEIEN,.01)="PSO DOJ/DEA WEB SERVICE"
SET MULTIEN=VICEIEN
QUIT
+72 SET MULTIEN=$SELECT(MULTIEN:MULTIEN,1:"+1")
+73 ; WEB SERVICE
SET FDA(18.121,MULTIEN_","_WEBVER_",",.01)="PSO DOJ/DEA WEB SERVICE"
+74 ; STATUS 1-ENABLED / 0-DISABLED
SET FDA(18.121,MULTIEN_","_WEBVER_",",.06)="ENABLED"
+75 DO UPDATE^DIE("E","FDA","IENROOT","MSGROOT")
+76 ;
+77 DO BMES^XPDUTL("Connecting to PSO DOJ/DEA WEB SERVICE..")
+78 SET WSTAT=$$GET
+79 IF '$GET(WSTAT)
Begin DoDot:1
+80 DO BMES^XPDUTL(" *********************************************************")
+81 DO BMES^XPDUTL(" WARNING: The WEB SERVER/SERVICE SETUP FAILED")
+82 DO BMES^XPDUTL(" Please try again after a few minutes. Failed to install,")
+83 DO BMES^XPDUTL(" please submit a Service Now ticket.")
+84 DO BMES^XPDUTL(" >>>> Installation aborted <<<<")
+85 DO BMES^XPDUTL(" *********************************************************")
+86 ; Do not install this transport global and KILL it from ^XTMP.
SET XPDQUIT=1
End DoDot:1
QUIT
+87 ;
+88 DO FILE^DID(8991.8,,"ENTRIES","PSODEAC","PSODEAMSG")
+89 IF '$GET(PSODEAC("ENTRIES"))
Begin DoDot:1
+90 DO BMES^XPDUTL(" *********************************************************")
+91 DO BMES^XPDUTL(" WARNING: XU*8.0*688 required for installation of this patch ")
+92 DO BMES^XPDUTL(" >>>> Installation aborted <<<<")
+93 DO BMES^XPDUTL(" *********************************************************")
+94 ; Do not install this transport global and KILL it from ^XTMP.
SET XPDQUIT=1
End DoDot:1
QUIT
+95 ;
+96 DO BMES^XPDUTL(" *******************************************************")
+97 DO BMES^XPDUTL(" The Environmental Check Routine finished Successfully.")
+98 DO BMES^XPDUTL(" *******************************************************")
+99 QUIT
+100 ;
GET() ; -- Send a test to the Web Service and compare the Result
+1 NEW SERVER,SERVICE,RESOURCE,REQUEST,SC,RESPONSE,RESPJSON,DATA,PSOERR
+2 SET SERVER="PSO DOJ/DEA WEB SERVER"
+3 SET SERVICE="PSO DOJ/DEA WEB SERVICE"
+4 SET RESOURCE=""
+5 ;
+6 ; Get an instance of the REST request object.
+7 SET REQUEST=$$GETREST^XOBWLIB(SERVICE,SERVER)
+8 ;
+9 ; Execute the HTTP Get method.
+10 SET SC=$$GET^XOBWLIB(REQUEST,RESOURCE,.PSOERR,0)
+11 IF 'SC
IF PSOERR.code=404
QUIT 1
+12 IF 'SC
QUIT "0^General Service Error"
+13 ;
+14 ; Process the response.
+15 SET RESPONSE=REQUEST.HttpResponse
+16 SET DATA=RESPONSE.Data
+17 SET RESPJSON=""
+18 FOR
if DATA.AtEnd
QUIT
SET RESPJSON=RESPJSON_DATA.ReadLine()
+19 IF $LENGTH($GET(RESPJSON))
QUIT 1
+20 QUIT 0
+21 ;
PRE ; Pre-Install
+1 IF '$DATA(ZTQUEUED)
Begin DoDot:1
+2 NEW PSOASTER
SET $PIECE(PSOASTER,"*",74)="*"
+3 SET XPDABORT=1
+4 DO BMES^XPDUTL(PSOASTER)
+5 DO MES^XPDUTL(" Patch Install must be Queued. Please unload this distribution")
+6 DO MES^XPDUTL(" and run install again with Queueing.")
+7 DO MES^XPDUTL(PSOASTER)
End DoDot:1
QUIT
+8 QUIT