MAGIP385 ;WOIFO/JBM/DWM - Install code for MAG*3.0*385; 21 April 2026
;;3.0;IMAGING;**385**;Mar 19, 2002;Build 10
;; Per VA Directive 6402, this routine should not be modified.
;; +---------------------------------------------------------------+
;; | Property of the US Government. |
;; | No permission to copy or redistribute this software is given. |
;; | |
;; | The Food and Drug Administration classifies this software as |
;; | a medical device. As such, it may not be changed in any way. |
;; | Modifications to this software may result in an adulterated |
;; | medical device under 21CFR820, the use of which is considered |
;; | to be a violation of US Federal Statutes. |
;; +---------------------------------------------------------------+
;;
;
; Supported IA #10141 reference $$BMES^XPDUTL function call
; Supported IA #2053 reference FILE^DIE
;
; There are no environment checks here but the MAGIP379 has to be
; referenced by the "Environment Check Routine" field of the KIDS
; build so that entry points of the routine are available to the
; KIDS during all installation phases.
Q
;
;+++++ INSTALLATION ERROR HANDLING
ERROR ;
S:$D(XPDNM) XPDABORT=1
;--- Display the messages and store them to the INSTALL file
D DUMP^MAGUERR1(),ABTMSG^MAGKIDS()
Q
;
;***** POST-INSTALL CODE
POS ;
N CALLBACK,OUT,IEN,MAGFDA,ERR,MAGMSG
D CLEAR^MAGUERR(1)
;
; ------------------------------------------------------------------
D DISPURL ; #2006.1 Imaging Site Parameter file - Display URL update
; ------------------------------------------------------------------
D NETLOC ; #2005.2 Network Location - VistA Site Service update
; ------------------------------------------------------------------
;
;--- Send the notification e-mail
D BMES^XPDUTL("Post Install Mail Message: "_$$FMTE^XLFDT($$NOW^XLFDT))
D INS^MAGQBUT4(XPDNM,DUZ,$$NOW^XLFDT,XPDA)
Q
;
;***** PRE-INSTALL CODE
PRE ;
Q
;
DISPURL ; #2006.1 Imaging Site Parameter file - Display Help URL update
; Adding VDL link for the Clinical Display User Manual
N IEN,URL
S URL="https://www.domain.ext/vdl/documents/Clinical/Vista_Imaging_Sys/MAG_Display_User_Manual.pdf"
S IEN=0 F S IEN=$O(^MAG(2006.1,IEN)) Q:'IEN D
. S $P(^MAG(2006.1,IEN,"HELPD"),U)=URL
. Q
Q
;
NETLOC ; #2005.2 Network Location - VistA Site Service update
; Update to 'https:' & remove port number (if needed)
;
N UP,IEN,FILE,FIELD,IENS,PHYREF,X,Y,HYP,SERV,NUM,MAGFDA,DIERR,MAGERR
;
; Obtain VistA Site Service IEN value in #2005.2
S UP=0,IEN=$$FIND1^DIC(2005.2,"","X","VISTASITESERVICE","B") D Q:'IEN
. Q:IEN
. I IEN=0 W !!,"No VISTASITESERVICE entry found in file #2005.2",!! Q
. W !!,"ERROR - unable to obtain #2005.2 IEN for VISTASITESERVICE",!!
. Q
;
; Physical Reference - field #1
S FILE=2005.2,FIELD=1,IENS=IEN
S PHYREF=$$GET1^DIQ(FILE,IENS,FIELD) I $D(DIERR)!(PHYREF="") D Q
. W !!,"ERROR - unable to obtain PHYSICAL REFERENCE field "
. W "value for VISTASITESERVICE",!!
. Q
;
; Hyper Text Transfer Protocol - update to 'https:' (if needed)
S X=$P(PHYREF,"/"),Y=$$LOWER(X) S HYP=Y K X,Y
I HYP="http:" S HYP="https:",$P(PHYREF,"/")=HYP,UP=1
;
; Port Number - remove if present
I $L(PHYREF,":")>2 D
. S SERV=$P(PHYREF,"/",3),NUM=$F(SERV,":")-2
. S SERV=$E(SERV,1,NUM),$P(PHYREF,"/",3)=SERV,UP=1
. Q
;
; Update #2005.2 VistA Site Service entry (if needed)
I UP=0 D Q
. W !!,"No update to the VistA Site Service entry needed"
. Q
I UP=1 D
. L +^MAG(2005.2,IENS):1E9
. K MAGFDA,DIERR,MAGERR S MAGFDA(2005.2,IENS_",",1)=PHYREF
. D FILE^DIE("","MAGFDA","MAGERR")
. I $D(DIERR) D
.. W !!,"ERROR - unable to update #2005.2 entry for VISTASITESERVICE",!!
.. Q
. I '$D(DIERR) D
.. W !!,"VistA Site Service field 'Physical Reference' updated:"
.. W !,PHYREF,!!
.. Q
. K MAGFDA,DIERR,MAGERR
. L -^MAG(2005.2,IENS)
. Q
Q
;
LOWER(X) ; Translate to Lowercase
N Y
S Y=$TR(X,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
Q Y
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGIP385 4188 printed Jul 22, 2026@15:14:10 Page 2
MAGIP385 ;WOIFO/JBM/DWM - Install code for MAG*3.0*385; 21 April 2026
+1 ;;3.0;IMAGING;**385**;Mar 19, 2002;Build 10
+2 ;; Per VA Directive 6402, this routine should not be modified.
+3 ;; +---------------------------------------------------------------+
+4 ;; | Property of the US Government. |
+5 ;; | No permission to copy or redistribute this software is given. |
+6 ;; | |
+7 ;; | The Food and Drug Administration classifies this software as |
+8 ;; | a medical device. As such, it may not be changed in any way. |
+9 ;; | Modifications to this software may result in an adulterated |
+10 ;; | medical device under 21CFR820, the use of which is considered |
+11 ;; | to be a violation of US Federal Statutes. |
+12 ;; +---------------------------------------------------------------+
+13 ;;
+14 ;
+15 ; Supported IA #10141 reference $$BMES^XPDUTL function call
+16 ; Supported IA #2053 reference FILE^DIE
+17 ;
+18 ; There are no environment checks here but the MAGIP379 has to be
+19 ; referenced by the "Environment Check Routine" field of the KIDS
+20 ; build so that entry points of the routine are available to the
+21 ; KIDS during all installation phases.
+22 QUIT
+23 ;
+24 ;+++++ INSTALLATION ERROR HANDLING
ERROR ;
+1 if $DATA(XPDNM)
SET XPDABORT=1
+2 ;--- Display the messages and store them to the INSTALL file
+3 DO DUMP^MAGUERR1()
DO ABTMSG^MAGKIDS()
+4 QUIT
+5 ;
+6 ;***** POST-INSTALL CODE
POS ;
+1 NEW CALLBACK,OUT,IEN,MAGFDA,ERR,MAGMSG
+2 DO CLEAR^MAGUERR(1)
+3 ;
+4 ; ------------------------------------------------------------------
+5 ; #2006.1 Imaging Site Parameter file - Display URL update
DO DISPURL
+6 ; ------------------------------------------------------------------
+7 ; #2005.2 Network Location - VistA Site Service update
DO NETLOC
+8 ; ------------------------------------------------------------------
+9 ;
+10 ;--- Send the notification e-mail
+11 DO BMES^XPDUTL("Post Install Mail Message: "_$$FMTE^XLFDT($$NOW^XLFDT))
+12 DO INS^MAGQBUT4(XPDNM,DUZ,$$NOW^XLFDT,XPDA)
+13 QUIT
+14 ;
+15 ;***** PRE-INSTALL CODE
PRE ;
+1 QUIT
+2 ;
DISPURL ; #2006.1 Imaging Site Parameter file - Display Help URL update
+1 ; Adding VDL link for the Clinical Display User Manual
+2 NEW IEN,URL
+3 SET URL="https://www.domain.ext/vdl/documents/Clinical/Vista_Imaging_Sys/MAG_Display_User_Manual.pdf"
+4 SET IEN=0
FOR
SET IEN=$ORDER(^MAG(2006.1,IEN))
if 'IEN
QUIT
Begin DoDot:1
+5 SET $PIECE(^MAG(2006.1,IEN,"HELPD"),U)=URL
+6 QUIT
End DoDot:1
+7 QUIT
+8 ;
NETLOC ; #2005.2 Network Location - VistA Site Service update
+1 ; Update to 'https:' & remove port number (if needed)
+2 ;
+3 NEW UP,IEN,FILE,FIELD,IENS,PHYREF,X,Y,HYP,SERV,NUM,MAGFDA,DIERR,MAGERR
+4 ;
+5 ; Obtain VistA Site Service IEN value in #2005.2
+6 SET UP=0
SET IEN=$$FIND1^DIC(2005.2,"","X","VISTASITESERVICE","B")
Begin DoDot:1
+7 if IEN
QUIT
+8 IF IEN=0
WRITE !!,"No VISTASITESERVICE entry found in file #2005.2",!!
QUIT
+9 WRITE !!,"ERROR - unable to obtain #2005.2 IEN for VISTASITESERVICE",!!
+10 QUIT
End DoDot:1
if 'IEN
QUIT
+11 ;
+12 ; Physical Reference - field #1
+13 SET FILE=2005.2
SET FIELD=1
SET IENS=IEN
+14 SET PHYREF=$$GET1^DIQ(FILE,IENS,FIELD)
IF $DATA(DIERR)!(PHYREF="")
Begin DoDot:1
+15 WRITE !!,"ERROR - unable to obtain PHYSICAL REFERENCE field "
+16 WRITE "value for VISTASITESERVICE",!!
+17 QUIT
End DoDot:1
QUIT
+18 ;
+19 ; Hyper Text Transfer Protocol - update to 'https:' (if needed)
+20 SET X=$PIECE(PHYREF,"/")
SET Y=$$LOWER(X)
SET HYP=Y
KILL X,Y
+21 IF HYP="http:"
SET HYP="https:"
SET $PIECE(PHYREF,"/")=HYP
SET UP=1
+22 ;
+23 ; Port Number - remove if present
+24 IF $LENGTH(PHYREF,":")>2
Begin DoDot:1
+25 SET SERV=$PIECE(PHYREF,"/",3)
SET NUM=$FIND(SERV,":")-2
+26 SET SERV=$EXTRACT(SERV,1,NUM)
SET $PIECE(PHYREF,"/",3)=SERV
SET UP=1
+27 QUIT
End DoDot:1
+28 ;
+29 ; Update #2005.2 VistA Site Service entry (if needed)
+30 IF UP=0
Begin DoDot:1
+31 WRITE !!,"No update to the VistA Site Service entry needed"
+32 QUIT
End DoDot:1
QUIT
+33 IF UP=1
Begin DoDot:1
+34 LOCK +^MAG(2005.2,IENS):1E9
+35 KILL MAGFDA,DIERR,MAGERR
SET MAGFDA(2005.2,IENS_",",1)=PHYREF
+36 DO FILE^DIE("","MAGFDA","MAGERR")
+37 IF $DATA(DIERR)
Begin DoDot:2
+38 WRITE !!,"ERROR - unable to update #2005.2 entry for VISTASITESERVICE",!!
+39 QUIT
End DoDot:2
+40 IF '$DATA(DIERR)
Begin DoDot:2
+41 WRITE !!,"VistA Site Service field 'Physical Reference' updated:"
+42 WRITE !,PHYREF,!!
+43 QUIT
End DoDot:2
+44 KILL MAGFDA,DIERR,MAGERR
+45 LOCK -^MAG(2005.2,IENS)
+46 QUIT
End DoDot:1
+47 QUIT
+48 ;
LOWER(X) ; Translate to Lowercase
+1 NEW Y
+2 SET Y=$TRANSLATE(X,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
+3 QUIT Y