MAGSIMBR ;WOIFO/SEB - Image Business Rules ;
;;3.0;IMAGING;**8**;Sep 15, 2004
;; +---------------------------------------------------------------+
;; | 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 Class II 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
; Business rules for deletion of images
DELETE(RY,MAGIEN,SYSDEL) N DELOK,MAGRY,MAG2,TIUDA
; Check user privileges for delete key
S RY(0)="1^This image is allowed to be deleted."
I 'SYSDEL I '$D(^XUSEC("MAG DELETE",DUZ)) D
. S RY(0)="0^User doesn't have delete privilege."
. Q
I +RY(0)=0 Q
; Check if we are allowed to delete this image
; (Node 101 - Placeholder for future status field)
S DELOK=1 ;I $P($G(^MAG(2005,MAGIEN,101)),"^")=0 S DELOK=0
I DELOK=0 S RY(0)="0^This image cannot be deleted."
I +RY(0)=0 Q
; If this image is linked to a TIU note, check to see that the TIU note is not signed.
S MAG2=$G(^MAG(2005,MAGIEN,2)) I $P(MAG2,"^",6)=8925 D
. S TIUDA=$P(MAG2,"^",7) D DATA(.MAGRY,TIUDA)
. ;I $P(MAGRY,"^",4)="COMPLETED" S RY(0)="0^The TIU note has been signed. Cannot delete this image."
. Q
I +RY(0)=0 Q
Q
;
DATA(MAGRY,TIUDA) ;RPC Call to get TIU data from the TIUDA
; Return = TIUDA^Document Type^Document Date^Document Status
;
S MAGRY=TIUDA_U_$$GET1^DIQ(8925,TIUDA,".01","E")_U_$$GET1^DIQ(8925,TIUDA,"1201","I")_U_$$GET1^DIQ(8925,TIUDA,".05","E")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGSIMBR 2199 printed Dec 13, 2024@02:08:21 Page 2
MAGSIMBR ;WOIFO/SEB - Image Business Rules ;
+1 ;;3.0;IMAGING;**8**;Sep 15, 2004
+2 ;; +---------------------------------------------------------------+
+3 ;; | Property of the US Government. |
+4 ;; | No permission to copy or redistribute this software is given. |
+5 ;; | Use of unreleased versions of this software requires the user |
+6 ;; | to execute a written test agreement with the VistA Imaging |
+7 ;; | Development Office of the Department of Veterans Affairs, |
+8 ;; | telephone (301) 734-0100. |
+9 ;; | |
+10 ;; | The Food and Drug Administration classifies this software as |
+11 ;; | a Class II medical device. As such, it may not be changed |
+12 ;; | in any way. Modifications to this software may result in an |
+13 ;; | adulterated medical device under 21CFR820, the use of which |
+14 ;; | is considered to be a violation of US Federal Statutes. |
+15 ;; +---------------------------------------------------------------+
+16 ;;
+17 QUIT
+18 ; Business rules for deletion of images
DELETE(RY,MAGIEN,SYSDEL) NEW DELOK,MAGRY,MAG2,TIUDA
+1 ; Check user privileges for delete key
+2 SET RY(0)="1^This image is allowed to be deleted."
+3 IF 'SYSDEL
IF '$DATA(^XUSEC("MAG DELETE",DUZ))
Begin DoDot:1
+4 SET RY(0)="0^User doesn't have delete privilege."
+5 QUIT
End DoDot:1
+6 IF +RY(0)=0
QUIT
+7 ; Check if we are allowed to delete this image
+8 ; (Node 101 - Placeholder for future status field)
+9 ;I $P($G(^MAG(2005,MAGIEN,101)),"^")=0 S DELOK=0
SET DELOK=1
+10 IF DELOK=0
SET RY(0)="0^This image cannot be deleted."
+11 IF +RY(0)=0
QUIT
+12 ; If this image is linked to a TIU note, check to see that the TIU note is not signed.
+13 SET MAG2=$GET(^MAG(2005,MAGIEN,2))
IF $PIECE(MAG2,"^",6)=8925
Begin DoDot:1
+14 SET TIUDA=$PIECE(MAG2,"^",7)
DO DATA(.MAGRY,TIUDA)
+15 ;I $P(MAGRY,"^",4)="COMPLETED" S RY(0)="0^The TIU note has been signed. Cannot delete this image."
+16 QUIT
End DoDot:1
+17 IF +RY(0)=0
QUIT
+18 QUIT
+19 ;
DATA(MAGRY,TIUDA) ;RPC Call to get TIU data from the TIUDA
+1 ; Return = TIUDA^Document Type^Document Date^Document Status
+2 ;
+3 SET MAGRY=TIUDA_U_$$GET1^DIQ(8925,TIUDA,".01","E")_U_$$GET1^DIQ(8925,TIUDA,"1201","I")_U_$$GET1^DIQ(8925,TIUDA,".05","E")
+4 QUIT