| 1 | MAGSIMBR ;WOIFO/SEB - Image Business Rules ; | 
|---|
| 2 | ;;3.0;IMAGING;**8**;Sep 15, 2004 | 
|---|
| 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 | ;; |                                                               | | 
|---|
| 11 | ;; | The Food and Drug Administration classifies this software as  | | 
|---|
| 12 | ;; | a Class II medical device.  As such, it may not be changed    | | 
|---|
| 13 | ;; | in any way.  Modifications to this software may result in an  | | 
|---|
| 14 | ;; | adulterated medical device under 21CFR820, the use of which   | | 
|---|
| 15 | ;; | is considered to be a violation of US Federal Statutes.       | | 
|---|
| 16 | ;; +---------------------------------------------------------------+ | 
|---|
| 17 | ;; | 
|---|
| 18 | Q | 
|---|
| 19 | ; Business rules for deletion of images | 
|---|
| 20 | DELETE(RY,MAGIEN,SYSDEL) N DELOK,MAGRY,MAG2,TIUDA | 
|---|
| 21 | ; Check user privileges for delete key | 
|---|
| 22 | S RY(0)="1^This image is allowed to be deleted." | 
|---|
| 23 | I 'SYSDEL I '$D(^XUSEC("MAG DELETE",DUZ)) D | 
|---|
| 24 | . S RY(0)="0^User doesn't have delete privilege." | 
|---|
| 25 | . Q | 
|---|
| 26 | I +RY(0)=0 Q | 
|---|
| 27 | ; Check if we are allowed to delete this image | 
|---|
| 28 | ; (Node 101 - Placeholder for future status field) | 
|---|
| 29 | S DELOK=1 ;I $P($G(^MAG(2005,MAGIEN,101)),"^")=0 S DELOK=0 | 
|---|
| 30 | I DELOK=0 S RY(0)="0^This image cannot be deleted." | 
|---|
| 31 | I +RY(0)=0 Q | 
|---|
| 32 | ; If this image is linked to a TIU note, check to see that the TIU note is not signed. | 
|---|
| 33 | S MAG2=$G(^MAG(2005,MAGIEN,2)) I $P(MAG2,"^",6)=8925 D | 
|---|
| 34 | . S TIUDA=$P(MAG2,"^",7) D DATA(.MAGRY,TIUDA) | 
|---|
| 35 | . ;I $P(MAGRY,"^",4)="COMPLETED" S RY(0)="0^The TIU note has been signed. Cannot delete this image." | 
|---|
| 36 | . Q | 
|---|
| 37 | I +RY(0)=0 Q | 
|---|
| 38 | Q | 
|---|
| 39 | ; | 
|---|
| 40 | DATA(MAGRY,TIUDA) ;RPC Call to get TIU data from the TIUDA | 
|---|
| 41 | ; Return = TIUDA^Document Type^Document Date^Document Status | 
|---|
| 42 | ; | 
|---|
| 43 | S MAGRY=TIUDA_U_$$GET1^DIQ(8925,TIUDA,".01","E")_U_$$GET1^DIQ(8925,TIUDA,"1201","I")_U_$$GET1^DIQ(8925,TIUDA,".05","E") | 
|---|
| 44 | Q | 
|---|