Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: MAGNTLR4

MAGNTLR4.m

Go to the documentation of this file.
  1. 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
  1. ;; Per VHA Directive 2004-038, this routine should not be modified.
  1. ;; +---------------------------------------------------------------+
  1. ;; | Property of the US Government. |
  1. ;; | No permission to copy or redistribute this software is given. |
  1. ;; | Use of unreleased versions of this software requires the user |
  1. ;; | to execute a written test agreement with the VistA Imaging |
  1. ;; | Development Office of the Department of Veterans Affairs, |
  1. ;; | telephone (301) 734-0100. |
  1. ;; | The Food and Drug Administration classifies this software as |
  1. ;; | a medical device. As such, it may not be changed in any way. |
  1. ;; | Modifications to this software may result in an adulterated |
  1. ;; | medical device under 21CFR820, the use of which is considered |
  1. ;; | to be a violation of US Federal Statutes. |
  1. ;; +---------------------------------------------------------------+
  1. ;;
  1. Q
  1. ;
  1. ;***** Clone a Reader in TELEREADER READER file (#2006.5843)
  1. ; RPC: MAG3 TELEREADER CLONE READER
  1. ;
  1. ; Input Parameters
  1. ; ================
  1. ; MAGFROM = Source reader (a pointer to NEW PERSON file (#200)) to be cloned
  1. ; MAGTO = An array with target readers (pointers to NEW PERSON file (#200))
  1. ;
  1. ; Return Values
  1. ; =============
  1. ; MAGRY = An array with results per cloned reader
  1. ; if error
  1. ; MAGRY(0) = 0 ^ Error message
  1. ; if success
  1. ; MAGRY(0) = 1 ^ Number of processed readers
  1. ; MAGRY(1..n) = 0|1 ^ Message
  1. ; 0 failure
  1. ; 1 success
  1. ;
  1. ; Note: ^TMP("MAGNTLR4",$J) is used during cloning process to store
  1. ; the privileges of the source reader. All the privileges are in
  1. ; multiple ACQUISITION SITE field (#2006.5843,1)
  1. ;
  1. CLONE(MAGRY,MAGFROM,MAGTO) ;RPC [MAG3 TELEREADER CLONE READER]
  1. N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTERR"
  1. N FROMIEN,IEN,I,MAGRES
  1. N MAGPRIV ; Reader's privileges
  1. ;
  1. I $G(MAGFROM)'>0 S MAGRY(0)="0^The source reader is not provided." Q
  1. ; Verify input parameters
  1. S FROMIEN=$O(^MAG(2006.5843,"B",MAGFROM,""))
  1. I FROMIEN'>0 S MAGRY(0)="0^Reader #"_MAGFROM_" profile is not defined." Q
  1. ;
  1. ; Get the source reader profile
  1. L +^MAG(2006.5843,FROMIEN):10
  1. E S MAGRY(0)="0^Cannot lock source reader profile" Q
  1. ; Store source reader privileges in temp global
  1. K ^TMP("MAGNTLR4",$J)
  1. M ^TMP("MAGNTLR4",$J,FROMIEN,1)=^MAG(2006.5843,FROMIEN,1)
  1. L -^MAG(2006.5843,FROMIEN)
  1. S MAGPRIV=$NA(^TMP("MAGNTLR4",$J,FROMIEN,1))
  1. ;
  1. S IEN=""
  1. S I=0
  1. F S IEN=$O(MAGTO(IEN)) Q:IEN="" D
  1. . ; Clone the reader IEN
  1. . D CLONE1R^MAGNTLR4(.MAGRES,MAGFROM,IEN,MAGPRIV)
  1. . S I=I+1,MAGRY(I)=MAGRES
  1. . Q
  1. K ^TMP("MAGNTLR4",$J)
  1. S MAGRY(0)="1^"_I
  1. Q
  1. ;
  1. ;+++++ Clone reader MAGFROM to MAGREADR
  1. ;
  1. ; Input Parameters
  1. ; ================
  1. ; MAGFROM = Source reader
  1. ; MAGREADR = Target reader
  1. ; MAGPRIV = A source temp global with a profile configured
  1. ;
  1. ; Return Values
  1. ; =============
  1. ; 0|1 ^ Message
  1. ; where
  1. ; 0 - failure
  1. ; 1 - success
  1. CLONE1R(MAGRY,MAGFROM,MAGREADR,MAGPRIV) ; Clone one reader
  1. N $ETRAP,$ESTACK S $ETRAP="D ERR^MAGGTERR"
  1. N MAGNFDA,MAGNIEN,MAGNXE,MAGRESA
  1. N IEN,DIK,DA
  1. ;
  1. I MAGFROM=MAGREADR S MAGRY="0^Source and target readers are the same" Q
  1. ; Delete the target reader privileges first
  1. S DA=$O(^MAG(2006.5843,"B",MAGREADR,""))
  1. I DA>0 D
  1. . S DIK="^MAG(2006.5843,"
  1. . D ^DIK
  1. . Q
  1. ;
  1. ; Clone the reader
  1. ; Add the new reader first
  1. S MAGNFDA(2006.5843,"+1,",.01)=MAGREADR
  1. D UPDATE^DIE("S","MAGNFDA","MAGNIEN","MAGNXE")
  1. ;
  1. I $D(MAGNXE("DIERR","E")) D Q
  1. . D MSG^DIALOG("A",.MAGRESA,245,5,"MAGNXE")
  1. . S MAGRY="0^"_MAGRESA(1)
  1. . Q
  1. ;
  1. S IEN=MAGNIEN(1) ; New reader IEN
  1. ; Update the privileges for the reader
  1. M ^MAG(2006.5843,IEN,1)=@MAGPRIV
  1. S MAGRY="1^Reader #"_MAGREADR_" profile has been created"
  1. Q