MAGVAU01 ;WOIFO/NST/DAC - Update records in storage files ; 14 Sep 2011 1:53 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
 ;
 ;*****  Update ARTIFACT DESCRIPTOR file (#2006.915)
 ;       
 ; RPC: MAGVA SET AD RETPOL
 ; 
 ; Input Parameters
 ; ================
 ; 
 ;   MAGPARAM("PK") = IEN 
 ;   MAGPARAM("RETENTION POLICY")
 ; 
 ; Return Values
 ; =============
 ; if error MAGRY = Failure status ^ Error message
 ; if success MAGRY = Success status
 ; 
UPDAD(MAGRY,MAGPARAM) ; RPC [MAGVA SET AD RETPOL]
 K MAGRY
 ; Update the record
 D UPDRCD^MAGVAF01(.MAGRY,2006.915,.MAGPARAM)
 Q
 ;
 ;*****  Update STORAGE PROVIDER file (#2006.917)
 ;       
 ; RPC: MAGVA UPDATE PROVIDER
 ; 
 ; Input Parameters
 ; ================
 ; 
 ;   MAGPARAM("PK") = IEN 
 ;   MAGPARAM("STORAGE PLACE")
 ;   MAGPARAM("ARCHIVE")
 ;   MAGPARAM("PRIMARY STORAGE")
 ;   MAGPARAM("ACTIVE")
 ;   MAGPARAM("WRITABLE")
 ; 
 ; Return Values
 ; =============
 ; if error MAGRY = Failure status ^ Error message^
 ; if success MAGRY = Success status
 ;
UPDPRV(MAGRY,MAGPARAM) ; RPC [MAGVA UPDATE PROVIDER]
 K MAGRY
 ; Update the record
 D UPDRCD^MAGVAF01(.MAGRY,2006.917,.MAGPARAM)
 Q
 ;*****  Update STORAGE PROVIDER AVAILABILITY file (#2006.924)
 ;       
 ; RPC: MAGVA UPDATE PROVAVAILTY
 ; 
 ; Input Parameters
 ; ================
 ; 
 ;   MAGPARAM("PK") = IEN 
 ;   MAGPARAM("START TIME") = DateTime in IDF format (YYYYMMDD.HHMMSS)
 ;   MAGPARAM("END TIME") = DateTime in IDF format (YYYYMMDD.HHMMSS)
 ;   MAGPARAM("ACTIVE")= 0/1
 ;   
 ; Return Values
 ; =============
 ; if error MAGRY = Failure status ^ Error message^
 ; if success MAGRY = Success status
 ;
UPDPA(MAGRY,MAGPARAM) ; RPC [MAGVA UPDATE PROVAVAILTY]
 K MAGRY
 ; Update the record
 S MAGPARAM("START TIME")=$$IDF2FM^MAGVAF01($G(MAGPARAM("START TIME")))
 S MAGPARAM("END TIME")=$$IDF2FM^MAGVAF01($G(MAGPARAM("END TIME")))
 D UPDRCD^MAGVAF01(.MAGRY,2006.924,.MAGPARAM)
 Q
 ;
 ;***** Set the Last Access Date/Time to current date/time
 ;      for artifact instance records in ARTIFACT INSTANCE file (#2006.918)
 ;      and ARTIFACT file (#2006.916)
 ;       
 ; RPC: MAGVA UPDATE LAST ACCESS DT
 ; 
 ; Input Parameters
 ; ================
 ; 
 ;   MAGPARAM("PK") = PK (IEN) of the record in ARTIFACT INSTANCE file (#2006.918)
 ;   
 ; Return Values
 ; =============
 ; if error MAGRY = Failure status ^ Error message^
 ; if success MAGRY = Success status
 ;
UPDLADT(MAGRY,MAGAPARAM) ; RPC [MAGVA UPDATE LAST ACCESS DT]
 K MAGRY
 N NOW,PARAM
 N FILE,FLDAFK,IENS
 N OUT,ERR,MAGRESA
 N VALAFK
 N IEN ; PK in Artifact Instance file (#2006.918)
 S IEN=$G(MAGAPARAM("PK"))
 ; Check for PK
 I IEN="" S MAGRY=$$FAILED^MAGVAF02()_$$RESDEL^MAGVAF02()_"Input parameter PK is required." Q  ; Error getting the IEN
 ; Get Artifact Value
 S FILE=2006.918
 S IENS=IEN_","
 S FLDAFK=$$GETFLDID^MAGVAF01(FILE,"ARTIFACT")
 S VALAFK=$$GET1^DIQ(FILE,IENS,FLDAFK,"I")  ; get ARTIFACT value
 ;
 ; Update files
 S NOW=$$NOW^XLFDT  ; Get current datetime
 K PARAM
 S PARAM("PK")=IEN
 S PARAM("LAST ACCESS DATE/TIME")=NOW
 ; Update the last access datetime field in Artifact Instance file (#2006.918)
 D UPDRCD^MAGVAF01(.MAGRY,2006.918,.PARAM)
 I '$$ISOK^MAGVAF02(MAGRY) Q  ; Quit if error. MAGRY is already set
 ; Update Artifact file
 K PARAM,MAGRY
 S PARAM("PK")=VALAFK
 S PARAM("LAST ACCESS DATE/TIME")=NOW
 ; Update the last access datetime field in Artifact file (#2006.916)
 D UPDRCD^MAGVAF01(.MAGRY,2006.916,.PARAM)
 Q
 ;
 ;*****  Update ARTIFACT RETENTION POLICY file (#2006.921)
 ;       If "SATISFIED" is sent and the value equals true (1) then
 ;       set SATISFIED DATE/TIME to current date/time
 ;       
 ; RPC: MAGVA UPDATE ARETPOL
 ; 
 ; Input Parameters
 ; ================
 ; 
 ;   MAGPARAM("PK") = IEN of record in  ARTIFACT RETENTION POLICY file (#2006.921)
 ;   MAGPARAM("ACTIVE") = 0/1
 ; 
 ; Return Values
 ; =============
 ; if error MAGRY = Failure status ^ Error message^
 ; if success MAGRY = Success status
 ;
UPDARP(MAGRY,MAGPARAM) ; RPC [MAGVA UPDATE ARETPOL]
 K MAGRY
 S MAGPARAM("SATISFIED DATE/TIME")=$$IDF2FM^MAGVAF01($G(MAGPARAM("SATISFIED DATE/TIME")))
 ; Update the record
 D UPDRCD^MAGVAF01(.MAGRY,2006.921,.MAGPARAM)
 Q
 ;
 ;*****  Update RETENTION POLICY STORAGE PROVIDER MAP file (#2006.923)
 ;       
 ; RPC: MAGVA UPDATE RETPOL PROV MAP
 ; 
 ; Input Parameters
 ; ================
 ; 
 ;   MAGPARAM("PK") = IEN 
 ;   MAGPARAM("SYNCHRONOUS") = 0/1
 ;   MAGPARAM("OFFSITE") = 0/1
 ; 
 ; Return Values
 ; =============
 ; if error MAGRY = Failure status ^ Error message^
 ; if success MAGRY = Success status 
 ; 
UPDRPPM(MAGRY,MAGPARAM) ; RPC [MAGVA UPDATE RETPOL PROV MAP]
 K MAGRY
 ; Update the record
 D UPDRCD^MAGVAF01(.MAGRY,2006.923,.MAGPARAM)
 Q
 ;
 ;*****  Update ARTIFACT file (#2006.916)
 ;       
 ; RPC: MAGVA UPDATE ARTIFACT
 ; 
 ; Input Parameters
 ; ================
 ; 
 ;   MAGPARAM("PK") = IEN 
 ;   MAGPARAM("CRC")
 ;   MAGPARAM("SIZE IN BYTES")
 ; 
 ; Return Values
 ; =============
 ; if error MAGRY = Failure status ^ Error message^
 ; if success MAGRY = Success status
 ;
UPDAFACT(MAGRY,MAGPARAM) ; RPC [MAGVA UPDATE ARTIFACT]
 K MAGRY
 ; Make sure CREATING APPLICATION and CREATED DATE/TIME are not altered
 K MAGPARAM("CREATING APPLICATION")
 K MAGPARAM("CREATED DATE/TIME")
 ; Update the record
 D UPDRCD^MAGVAF01(.MAGRY,2006.916,.MAGPARAM)
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGVAU01   6534     printed  Sep 23, 2025@19:45:46                                                                                                                                                                                                    Page 2
MAGVAU01  ;WOIFO/NST/DAC - Update records in storage files ; 14 Sep 2011 1:53 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 
 +18      ;
 +19      ;*****  Update ARTIFACT DESCRIPTOR file (#2006.915)
 +20      ;       
 +21      ; RPC: MAGVA SET AD RETPOL
 +22      ; 
 +23      ; Input Parameters
 +24      ; ================
 +25      ; 
 +26      ;   MAGPARAM("PK") = IEN 
 +27      ;   MAGPARAM("RETENTION POLICY")
 +28      ; 
 +29      ; Return Values
 +30      ; =============
 +31      ; if error MAGRY = Failure status ^ Error message
 +32      ; if success MAGRY = Success status
 +33      ; 
UPDAD(MAGRY,MAGPARAM) ; RPC [MAGVA SET AD RETPOL]
 +1        KILL MAGRY
 +2       ; Update the record
 +3        DO UPDRCD^MAGVAF01(.MAGRY,2006.915,.MAGPARAM)
 +4        QUIT 
 +5       ;
 +6       ;*****  Update STORAGE PROVIDER file (#2006.917)
 +7       ;       
 +8       ; RPC: MAGVA UPDATE PROVIDER
 +9       ; 
 +10      ; Input Parameters
 +11      ; ================
 +12      ; 
 +13      ;   MAGPARAM("PK") = IEN 
 +14      ;   MAGPARAM("STORAGE PLACE")
 +15      ;   MAGPARAM("ARCHIVE")
 +16      ;   MAGPARAM("PRIMARY STORAGE")
 +17      ;   MAGPARAM("ACTIVE")
 +18      ;   MAGPARAM("WRITABLE")
 +19      ; 
 +20      ; Return Values
 +21      ; =============
 +22      ; if error MAGRY = Failure status ^ Error message^
 +23      ; if success MAGRY = Success status
 +24      ;
UPDPRV(MAGRY,MAGPARAM) ; RPC [MAGVA UPDATE PROVIDER]
 +1        KILL MAGRY
 +2       ; Update the record
 +3        DO UPDRCD^MAGVAF01(.MAGRY,2006.917,.MAGPARAM)
 +4        QUIT 
 +5       ;*****  Update STORAGE PROVIDER AVAILABILITY file (#2006.924)
 +6       ;       
 +7       ; RPC: MAGVA UPDATE PROVAVAILTY
 +8       ; 
 +9       ; Input Parameters
 +10      ; ================
 +11      ; 
 +12      ;   MAGPARAM("PK") = IEN 
 +13      ;   MAGPARAM("START TIME") = DateTime in IDF format (YYYYMMDD.HHMMSS)
 +14      ;   MAGPARAM("END TIME") = DateTime in IDF format (YYYYMMDD.HHMMSS)
 +15      ;   MAGPARAM("ACTIVE")= 0/1
 +16      ;   
 +17      ; Return Values
 +18      ; =============
 +19      ; if error MAGRY = Failure status ^ Error message^
 +20      ; if success MAGRY = Success status
 +21      ;
UPDPA(MAGRY,MAGPARAM) ; RPC [MAGVA UPDATE PROVAVAILTY]
 +1        KILL MAGRY
 +2       ; Update the record
 +3        SET MAGPARAM("START TIME")=$$IDF2FM^MAGVAF01($GET(MAGPARAM("START TIME")))
 +4        SET MAGPARAM("END TIME")=$$IDF2FM^MAGVAF01($GET(MAGPARAM("END TIME")))
 +5        DO UPDRCD^MAGVAF01(.MAGRY,2006.924,.MAGPARAM)
 +6        QUIT 
 +7       ;
 +8       ;***** Set the Last Access Date/Time to current date/time
 +9       ;      for artifact instance records in ARTIFACT INSTANCE file (#2006.918)
 +10      ;      and ARTIFACT file (#2006.916)
 +11      ;       
 +12      ; RPC: MAGVA UPDATE LAST ACCESS DT
 +13      ; 
 +14      ; Input Parameters
 +15      ; ================
 +16      ; 
 +17      ;   MAGPARAM("PK") = PK (IEN) of the record in ARTIFACT INSTANCE file (#2006.918)
 +18      ;   
 +19      ; Return Values
 +20      ; =============
 +21      ; if error MAGRY = Failure status ^ Error message^
 +22      ; if success MAGRY = Success status
 +23      ;
UPDLADT(MAGRY,MAGAPARAM) ; RPC [MAGVA UPDATE LAST ACCESS DT]
 +1        KILL MAGRY
 +2        NEW NOW,PARAM
 +3        NEW FILE,FLDAFK,IENS
 +4        NEW OUT,ERR,MAGRESA
 +5        NEW VALAFK
 +6       ; PK in Artifact Instance file (#2006.918)
           NEW IEN
 +7        SET IEN=$GET(MAGAPARAM("PK"))
 +8       ; Check for PK
 +9       ; Error getting the IEN
           IF IEN=""
               SET MAGRY=$$FAILED^MAGVAF02()_$$RESDEL^MAGVAF02()_"Input parameter PK is required."
               QUIT 
 +10      ; Get Artifact Value
 +11       SET FILE=2006.918
 +12       SET IENS=IEN_","
 +13       SET FLDAFK=$$GETFLDID^MAGVAF01(FILE,"ARTIFACT")
 +14      ; get ARTIFACT value
           SET VALAFK=$$GET1^DIQ(FILE,IENS,FLDAFK,"I")
 +15      ;
 +16      ; Update files
 +17      ; Get current datetime
           SET NOW=$$NOW^XLFDT
 +18       KILL PARAM
 +19       SET PARAM("PK")=IEN
 +20       SET PARAM("LAST ACCESS DATE/TIME")=NOW
 +21      ; Update the last access datetime field in Artifact Instance file (#2006.918)
 +22       DO UPDRCD^MAGVAF01(.MAGRY,2006.918,.PARAM)
 +23      ; Quit if error. MAGRY is already set
           IF '$$ISOK^MAGVAF02(MAGRY)
               QUIT 
 +24      ; Update Artifact file
 +25       KILL PARAM,MAGRY
 +26       SET PARAM("PK")=VALAFK
 +27       SET PARAM("LAST ACCESS DATE/TIME")=NOW
 +28      ; Update the last access datetime field in Artifact file (#2006.916)
 +29       DO UPDRCD^MAGVAF01(.MAGRY,2006.916,.PARAM)
 +30       QUIT 
 +31      ;
 +32      ;*****  Update ARTIFACT RETENTION POLICY file (#2006.921)
 +33      ;       If "SATISFIED" is sent and the value equals true (1) then
 +34      ;       set SATISFIED DATE/TIME to current date/time
 +35      ;       
 +36      ; RPC: MAGVA UPDATE ARETPOL
 +37      ; 
 +38      ; Input Parameters
 +39      ; ================
 +40      ; 
 +41      ;   MAGPARAM("PK") = IEN of record in  ARTIFACT RETENTION POLICY file (#2006.921)
 +42      ;   MAGPARAM("ACTIVE") = 0/1
 +43      ; 
 +44      ; Return Values
 +45      ; =============
 +46      ; if error MAGRY = Failure status ^ Error message^
 +47      ; if success MAGRY = Success status
 +48      ;
UPDARP(MAGRY,MAGPARAM) ; RPC [MAGVA UPDATE ARETPOL]
 +1        KILL MAGRY
 +2        SET MAGPARAM("SATISFIED DATE/TIME")=$$IDF2FM^MAGVAF01($GET(MAGPARAM("SATISFIED DATE/TIME")))
 +3       ; Update the record
 +4        DO UPDRCD^MAGVAF01(.MAGRY,2006.921,.MAGPARAM)
 +5        QUIT 
 +6       ;
 +7       ;*****  Update RETENTION POLICY STORAGE PROVIDER MAP file (#2006.923)
 +8       ;       
 +9       ; RPC: MAGVA UPDATE RETPOL PROV MAP
 +10      ; 
 +11      ; Input Parameters
 +12      ; ================
 +13      ; 
 +14      ;   MAGPARAM("PK") = IEN 
 +15      ;   MAGPARAM("SYNCHRONOUS") = 0/1
 +16      ;   MAGPARAM("OFFSITE") = 0/1
 +17      ; 
 +18      ; Return Values
 +19      ; =============
 +20      ; if error MAGRY = Failure status ^ Error message^
 +21      ; if success MAGRY = Success status 
 +22      ; 
UPDRPPM(MAGRY,MAGPARAM) ; RPC [MAGVA UPDATE RETPOL PROV MAP]
 +1        KILL MAGRY
 +2       ; Update the record
 +3        DO UPDRCD^MAGVAF01(.MAGRY,2006.923,.MAGPARAM)
 +4        QUIT 
 +5       ;
 +6       ;*****  Update ARTIFACT file (#2006.916)
 +7       ;       
 +8       ; RPC: MAGVA UPDATE ARTIFACT
 +9       ; 
 +10      ; Input Parameters
 +11      ; ================
 +12      ; 
 +13      ;   MAGPARAM("PK") = IEN 
 +14      ;   MAGPARAM("CRC")
 +15      ;   MAGPARAM("SIZE IN BYTES")
 +16      ; 
 +17      ; Return Values
 +18      ; =============
 +19      ; if error MAGRY = Failure status ^ Error message^
 +20      ; if success MAGRY = Success status
 +21      ;
UPDAFACT(MAGRY,MAGPARAM) ; RPC [MAGVA UPDATE ARTIFACT]
 +1        KILL MAGRY
 +2       ; Make sure CREATING APPLICATION and CREATED DATE/TIME are not altered
 +3        KILL MAGPARAM("CREATING APPLICATION")
 +4        KILL MAGPARAM("CREATED DATE/TIME")
 +5       ; Update the record
 +6        DO UPDRCD^MAGVAF01(.MAGRY,2006.916,.MAGPARAM)
 +7        QUIT