MAGUAUD ;WOIFO/MLH/NST - Audit log RPC ; 31 Dec 2010 03:45 PM
 ;;3.0;IMAGING;**118**;Mar 19, 2002;Build 4525;May 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
INPUTSEP() ; Name value separator for input data ie. NAME`TESTPATIENT   
 Q "`"
EVENT(OUT,EVENT,HOST,APP,MESSAGE,DATA) ; rpc MAG EVENT AUDIT
 N ERRIX,ERRMSG,FDA,IENS,I,J,ISEP,ATT,VALUE,APPIEN
 K OUT
 ; Get application. It will be added if it is not in the file.
 S:$G(APP)'="" APPIEN=$$GETIEN^MAGVAF05(2006.9193,APP,1)
 S FDA(2006.93,"+1,",.01)="N"
 S FDA(2006.93,"+1,",1)=$G(EVENT)
 S FDA(2006.93,"+1,",2)=$G(HOST)
 S FDA(2006.93,"+1,",3)=$G(APP)
 S FDA(2006.93,"+1,",4)=$G(MESSAGE)
 S I="",ISEP=$$INPUTSEP
 F  S I=$O(DATA(I)) Q:I=""  D
 . S ATT=$P(DATA(I),ISEP,1)
 . S VALUE=$P(DATA(I),ISEP,2)
 . S J=I+1,IENS="+"_J_",+1,"
 . S FDA(2006.935,IENS,.01)=ATT
 . S FDA(2006.935,IENS,1)=VALUE
 . Q
 D UPDATE^DIE("E","FDA")
 S ERRIX=0
 F  S ERRIX=$O(^TMP("DIERR",$J,ERRIX)) Q:'ERRIX  D
 . S ERRMSG=-$G(^TMP("DIERR",$J,ERRIX))_","
 . S ERRMSG=ERRMSG_$G(^TMP("DIERR",$J,ERRIX,"TEXT",1))
 . S OUT($O(OUT(""),-1)+1)=ERRMSG
 . Q
 I '$D(OUT) S OUT(1)=0 ; no error
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGUAUD   2111     printed  Sep 23, 2025@19:45:04                                                                                                                                                                                                     Page 2
MAGUAUD   ;WOIFO/MLH/NST - Audit log RPC ; 31 Dec 2010 03:45 PM
 +1       ;;3.0;IMAGING;**118**;Mar 19, 2002;Build 4525;May 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 
INPUTSEP() ; Name value separator for input data ie. NAME`TESTPATIENT   
 +1        QUIT "`"
EVENT(OUT,EVENT,HOST,APP,MESSAGE,DATA) ; rpc MAG EVENT AUDIT
 +1        NEW ERRIX,ERRMSG,FDA,IENS,I,J,ISEP,ATT,VALUE,APPIEN
 +2        KILL OUT
 +3       ; Get application. It will be added if it is not in the file.
 +4        if $GET(APP)'=""
               SET APPIEN=$$GETIEN^MAGVAF05(2006.9193,APP,1)
 +5        SET FDA(2006.93,"+1,",.01)="N"
 +6        SET FDA(2006.93,"+1,",1)=$GET(EVENT)
 +7        SET FDA(2006.93,"+1,",2)=$GET(HOST)
 +8        SET FDA(2006.93,"+1,",3)=$GET(APP)
 +9        SET FDA(2006.93,"+1,",4)=$GET(MESSAGE)
 +10       SET I=""
           SET ISEP=$$INPUTSEP
 +11       FOR 
               SET I=$ORDER(DATA(I))
               if I=""
                   QUIT 
               Begin DoDot:1
 +12               SET ATT=$PIECE(DATA(I),ISEP,1)
 +13               SET VALUE=$PIECE(DATA(I),ISEP,2)
 +14               SET J=I+1
                   SET IENS="+"_J_",+1,"
 +15               SET FDA(2006.935,IENS,.01)=ATT
 +16               SET FDA(2006.935,IENS,1)=VALUE
 +17               QUIT 
               End DoDot:1
 +18       DO UPDATE^DIE("E","FDA")
 +19       SET ERRIX=0
 +20       FOR 
               SET ERRIX=$ORDER(^TMP("DIERR",$JOB,ERRIX))
               if 'ERRIX
                   QUIT 
               Begin DoDot:1
 +21               SET ERRMSG=-$GET(^TMP("DIERR",$JOB,ERRIX))_","
 +22               SET ERRMSG=ERRMSG_$GET(^TMP("DIERR",$JOB,ERRIX,"TEXT",1))
 +23               SET OUT($ORDER(OUT(""),-1)+1)=ERRMSG
 +24               QUIT 
               End DoDot:1
 +25      ; no error
           IF '$DATA(OUT)
               SET OUT(1)=0
 +26       QUIT