- MAGNTLR4 ;WOIFO/NST - TeleReader Configuration utilities ; 23 Apr 2012 11:19 AM
- ;;3.0;IMAGING;**127**;Mar 19, 2002;Build 4231;Apr 01, 2013
- ;; Per VHA Directive 2004-038, this routine should not be modified.
- ;; +---------------------------------------------------------------+
- ;; | Property of the US Government. |
- ;; | No permission to copy or redistribute this software is given. |
- ;; | Use of unreleased versions of this software requires the user |
- ;; | to execute a written test agreement with the VistA Imaging |
- ;; | Development Office of the Department of Veterans Affairs, |
- ;; | telephone (301) 734-0100. |
- ;; | 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. |
- ;; +---------------------------------------------------------------+
- ;;
- Q
- ;
- ;***** Clone a Reader in TELEREADER READER file (#2006.5843)
- ; RPC: MAG3 TELEREADER CLONE READER
- ;
- ; Input Parameters
- ; ================
- ; MAGFROM = Source reader (a pointer to NEW PERSON file (#200)) to be cloned
- ; MAGTO = An array with target readers (pointers to NEW PERSON file (#200))
- ;
- ; Return Values
- ; =============
- ; MAGRY = An array with results per cloned reader
- ; if error
- ; MAGRY(0) = 0 ^ Error message
- ; if success
- ; MAGRY(0) = 1 ^ Number of processed readers
- ; MAGRY(1..n) = 0|1 ^ Message
- ; 0 failure
- ; 1 success
- ;
- ; Note: ^TMP("MAGNTLR4",$J) is used during cloning process to store
- ; the privileges of the source reader. All the privileges are in
- ; multiple ACQUISITION SITE field (#2006.5843,1)
- ;
- CLONE(MAGRY,MAGFROM,MAGTO) ;RPC [MAG3 TELEREADER CLONE READER]
- N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTERR"
- N FROMIEN,IEN,I,MAGRES
- N MAGPRIV ; Reader's privileges
- ;
- I $G(MAGFROM)'>0 S MAGRY(0)="0^The source reader is not provided." Q
- ; Verify input parameters
- S FROMIEN=$O(^MAG(2006.5843,"B",MAGFROM,""))
- I FROMIEN'>0 S MAGRY(0)="0^Reader #"_MAGFROM_" profile is not defined." Q
- ;
- ; Get the source reader profile
- L +^MAG(2006.5843,FROMIEN):10
- E S MAGRY(0)="0^Cannot lock source reader profile" Q
- ; Store source reader privileges in temp global
- K ^TMP("MAGNTLR4",$J)
- M ^TMP("MAGNTLR4",$J,FROMIEN,1)=^MAG(2006.5843,FROMIEN,1)
- L -^MAG(2006.5843,FROMIEN)
- S MAGPRIV=$NA(^TMP("MAGNTLR4",$J,FROMIEN,1))
- ;
- S IEN=""
- S I=0
- F S IEN=$O(MAGTO(IEN)) Q:IEN="" D
- . ; Clone the reader IEN
- . D CLONE1R^MAGNTLR4(.MAGRES,MAGFROM,IEN,MAGPRIV)
- . S I=I+1,MAGRY(I)=MAGRES
- . Q
- K ^TMP("MAGNTLR4",$J)
- S MAGRY(0)="1^"_I
- Q
- ;
- ;+++++ Clone reader MAGFROM to MAGREADR
- ;
- ; Input Parameters
- ; ================
- ; MAGFROM = Source reader
- ; MAGREADR = Target reader
- ; MAGPRIV = A source temp global with a profile configured
- ;
- ; Return Values
- ; =============
- ; 0|1 ^ Message
- ; where
- ; 0 - failure
- ; 1 - success
- CLONE1R(MAGRY,MAGFROM,MAGREADR,MAGPRIV) ; Clone one reader
- N $ETRAP,$ESTACK S $ETRAP="D ERR^MAGGTERR"
- N MAGNFDA,MAGNIEN,MAGNXE,MAGRESA
- N IEN,DIK,DA
- ;
- I MAGFROM=MAGREADR S MAGRY="0^Source and target readers are the same" Q
- ; Delete the target reader privileges first
- S DA=$O(^MAG(2006.5843,"B",MAGREADR,""))
- I DA>0 D
- . S DIK="^MAG(2006.5843,"
- . D ^DIK
- . Q
- ;
- ; Clone the reader
- ; Add the new reader first
- S MAGNFDA(2006.5843,"+1,",.01)=MAGREADR
- D UPDATE^DIE("S","MAGNFDA","MAGNIEN","MAGNXE")
- ;
- I $D(MAGNXE("DIERR","E")) D Q
- . D MSG^DIALOG("A",.MAGRESA,245,5,"MAGNXE")
- . S MAGRY="0^"_MAGRESA(1)
- . Q
- ;
- S IEN=MAGNIEN(1) ; New reader IEN
- ; Update the privileges for the reader
- M ^MAG(2006.5843,IEN,1)=@MAGPRIV
- S MAGRY="1^Reader #"_MAGREADR_" profile has been created"
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGNTLR4 4066 printed Apr 23, 2025@18:21:56 Page 2
- MAGNTLR4 ;WOIFO/NST - TeleReader Configuration utilities ; 23 Apr 2012 11:19 AM
- +1 ;;3.0;IMAGING;**127**;Mar 19, 2002;Build 4231;Apr 01, 2013
- +2 ;; Per VHA Directive 2004-038, 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 ;; | Use of unreleased versions of this software requires the user |
- +7 ;; | to execute a written test agreement with the VistA Imaging |
- +8 ;; | Development Office of the Department of Veterans Affairs, |
- +9 ;; | telephone (301) 734-0100. |
- +10 ;; | The Food and Drug Administration classifies this software as |
- +11 ;; | a medical device. As such, it may not be changed in any way. |
- +12 ;; | Modifications to this software may result in an adulterated |
- +13 ;; | medical device under 21CFR820, the use of which is considered |
- +14 ;; | to be a violation of US Federal Statutes. |
- +15 ;; +---------------------------------------------------------------+
- +16 ;;
- +17 QUIT
- +18 ;
- +19 ;***** Clone a Reader in TELEREADER READER file (#2006.5843)
- +20 ; RPC: MAG3 TELEREADER CLONE READER
- +21 ;
- +22 ; Input Parameters
- +23 ; ================
- +24 ; MAGFROM = Source reader (a pointer to NEW PERSON file (#200)) to be cloned
- +25 ; MAGTO = An array with target readers (pointers to NEW PERSON file (#200))
- +26 ;
- +27 ; Return Values
- +28 ; =============
- +29 ; MAGRY = An array with results per cloned reader
- +30 ; if error
- +31 ; MAGRY(0) = 0 ^ Error message
- +32 ; if success
- +33 ; MAGRY(0) = 1 ^ Number of processed readers
- +34 ; MAGRY(1..n) = 0|1 ^ Message
- +35 ; 0 failure
- +36 ; 1 success
- +37 ;
- +38 ; Note: ^TMP("MAGNTLR4",$J) is used during cloning process to store
- +39 ; the privileges of the source reader. All the privileges are in
- +40 ; multiple ACQUISITION SITE field (#2006.5843,1)
- +41 ;
- CLONE(MAGRY,MAGFROM,MAGTO) ;RPC [MAG3 TELEREADER CLONE READER]
- +1 NEW $ETRAP,$ESTACK
- SET $ETRAP="D ERRA^MAGGTERR"
- +2 NEW FROMIEN,IEN,I,MAGRES
- +3 ; Reader's privileges
- NEW MAGPRIV
- +4 ;
- +5 IF $GET(MAGFROM)'>0
- SET MAGRY(0)="0^The source reader is not provided."
- QUIT
- +6 ; Verify input parameters
- +7 SET FROMIEN=$ORDER(^MAG(2006.5843,"B",MAGFROM,""))
- +8 IF FROMIEN'>0
- SET MAGRY(0)="0^Reader #"_MAGFROM_" profile is not defined."
- QUIT
- +9 ;
- +10 ; Get the source reader profile
- +11 LOCK +^MAG(2006.5843,FROMIEN):10
- +12 IF '$TEST
- SET MAGRY(0)="0^Cannot lock source reader profile"
- QUIT
- +13 ; Store source reader privileges in temp global
- +14 KILL ^TMP("MAGNTLR4",$JOB)
- +15 MERGE ^TMP("MAGNTLR4",$JOB,FROMIEN,1)=^MAG(2006.5843,FROMIEN,1)
- +16 LOCK -^MAG(2006.5843,FROMIEN)
- +17 SET MAGPRIV=$NAME(^TMP("MAGNTLR4",$JOB,FROMIEN,1))
- +18 ;
- +19 SET IEN=""
- +20 SET I=0
- +21 FOR
- SET IEN=$ORDER(MAGTO(IEN))
- if IEN=""
- QUIT
- Begin DoDot:1
- +22 ; Clone the reader IEN
- +23 DO CLONE1R^MAGNTLR4(.MAGRES,MAGFROM,IEN,MAGPRIV)
- +24 SET I=I+1
- SET MAGRY(I)=MAGRES
- +25 QUIT
- End DoDot:1
- +26 KILL ^TMP("MAGNTLR4",$JOB)
- +27 SET MAGRY(0)="1^"_I
- +28 QUIT
- +29 ;
- +30 ;+++++ Clone reader MAGFROM to MAGREADR
- +31 ;
- +32 ; Input Parameters
- +33 ; ================
- +34 ; MAGFROM = Source reader
- +35 ; MAGREADR = Target reader
- +36 ; MAGPRIV = A source temp global with a profile configured
- +37 ;
- +38 ; Return Values
- +39 ; =============
- +40 ; 0|1 ^ Message
- +41 ; where
- +42 ; 0 - failure
- +43 ; 1 - success
- CLONE1R(MAGRY,MAGFROM,MAGREADR,MAGPRIV) ; Clone one reader
- +1 NEW $ETRAP,$ESTACK
- SET $ETRAP="D ERR^MAGGTERR"
- +2 NEW MAGNFDA,MAGNIEN,MAGNXE,MAGRESA
- +3 NEW IEN,DIK,DA
- +4 ;
- +5 IF MAGFROM=MAGREADR
- SET MAGRY="0^Source and target readers are the same"
- QUIT
- +6 ; Delete the target reader privileges first
- +7 SET DA=$ORDER(^MAG(2006.5843,"B",MAGREADR,""))
- +8 IF DA>0
- Begin DoDot:1
- +9 SET DIK="^MAG(2006.5843,"
- +10 DO ^DIK
- +11 QUIT
- End DoDot:1
- +12 ;
- +13 ; Clone the reader
- +14 ; Add the new reader first
- +15 SET MAGNFDA(2006.5843,"+1,",.01)=MAGREADR
- +16 DO UPDATE^DIE("S","MAGNFDA","MAGNIEN","MAGNXE")
- +17 ;
- +18 IF $DATA(MAGNXE("DIERR","E"))
- Begin DoDot:1
- +19 DO MSG^DIALOG("A",.MAGRESA,245,5,"MAGNXE")
- +20 SET MAGRY="0^"_MAGRESA(1)
- +21 QUIT
- End DoDot:1
- QUIT
- +22 ;
- +23 ; New reader IEN
- SET IEN=MAGNIEN(1)
- +24 ; Update the privileges for the reader
- +25 MERGE ^MAG(2006.5843,IEN,1)=@MAGPRIV
- +26 SET MAGRY="1^Reader #"_MAGREADR_" profile has been created"
- +27 QUIT