DGPFALF1 ;ALB/KCL,RBS - PRF LOCAL FLAG API'S CONTINUED ; 4/20/04 12:02pm
;;5.3;Registration;**425,554**;Aug 13, 1993
;
;- no direct entry
QUIT
;
STOALL(DGPFLF,DGPFLH,DGPFERR) ;File both LOCAL FLAG(#26.11) & HISTORY(#26.12)
;This function acts as a wrapper around the $$STOFLAG^DGPFALF
;and the $$STOHIST^DGPFALH filer calls.
;
; Input:
; DGPFLF - (required) array of Local Flag values to be filed
; (see $$GETLF^DGPFALF for valid array structure)
; DGPFLH - (required) array of Flag History values to be filed
; (see $$GETHIST^DGPFALH for valid array structure)
; DGPFERR - (optional) passed by reference to contain error messages
;
; Output:
; Function Value - Returns circumflex("^") delimited results of
; $$STOFLAG^DGPFALF and $$STOHIST^DGPFALH calls.
; Example: "3^12"
; On Success - "IEN of (#26.11)^IEN of (#26.12)"
; On Failure - 0
; DGPFERR - Undefined on success, error message on failure
;
N DGOIEN ;existing Local Flag file IEN used for "roll-back"
N DGPFOLF ;existing Local Flag data array used for "roll-back"
N DGLIEN ;Local Flag file IEN
N DGLHIEN ;Local Flag history file IEN
N DGFLG ;"FLAG" value
;
S (DGLIEN,DGLHIEN)=0
S DGFLG=$P($G(DGPFLF("FLAG")),U)
S DGOIEN=$$FNDFLAG^DGPFALF(DGFLG)
I 'DGOIEN!(DGOIEN&($$GETLF^DGPFALF(DGOIEN,.DGPFOLF))) D
. S DGLIEN=$$STOFLAG^DGPFALF(.DGPFLF,.DGPFERR)
. I $D(DGPFERR) S DGLIEN=0
. I DGLIEN D
. . S DGPFLH("FLAG")=DGLIEN
. . S DGLHIEN=$$STOHIST^DGPFALH(.DGPFLH,.DGPFERR)
. . I $D(DGPFERR) S DGLHIEN=0
. . I DGLHIEN=0 D ;roll back the Local Flag file setup
. . . I 'DGOIEN,'$D(DGPFOLF) S DGPFOLF("FLAG")="@"
. . . I $$ROLLBACK^DGPFALF1(26.11,DGLIEN,.DGPFOLF,"FLAG") S DGLIEN=0
Q $S(DGLHIEN=0:0,1:DGLIEN_"^"_DGLHIEN)
;
ROLLBACK(DGFILE,DGFIEN,DGPFOA,DGKEY) ;Rollback a FILE record
; Input:
; DGFILE - File reference that will be used for rollback
; DGFIEN - IEN of record to rollback in DGFILE
; DGPFOA - Original array of data prior to record modification
; DGKEY - .01 Field Name reference to DELETE whole record
; Output:
; Function value - 1 on successful Rollback
; 0 on failure
;
N DGIENS,DGFDA,DGERR,DGRSLT
S DGRSLT=0
I $D(DGFILE),+$G(DGFIEN),$D(DGPFOA),$D(DGKEY) D
. Q:'$D(^DGPF(DGFILE))
. Q:'$D(^DGPF(DGFILE,DGFIEN))
. S DGIENS=DGFIEN_","
. I $G(DGPFOA(DGKEY))="@" D
. . S DGFDA(DGFILE,DGIENS,.01)="@"
. . D FILE^DIE("","DGFDA","DGERR")
. . I '$D(DGERR) S DGRSLT=1
. E D
. . I $$STOFLAG^DGPFALF(.DGPFOA,.DGERR),'$D(DGERR) S DGRSLT=1
Q DGRSLT
;
LOCKLF(DGPFLIEN) ; Lock Flag ien
; Input:
; DGPFLIEN - IEN of record
; Output:
; Function Value - Returns 1 on success
; 0 on failure
L +^DGPF(26.11,DGPFLIEN):10 I '$T Q 0
Q 1
;
UNLOCK(DGPFLIEN) ; Un-Lock Flag ien
; Input:
; DGPFLIEN - IEN of record
; Output:
; Function Value - Returns 1 on success
; 0 on failure
L -^DGPF(26.11,DGPFLIEN):2 I '$T Q 0
Q 1
;
;
; PRF LOCAL FLAG FILE (#26.11) Field VALIDATION data
; don't do the Principal Investigator(s) multiple fields...
; they're pointers anyway and won't be Validated.
; PRININV;2;0;0;principal investigator(s) (if Research Flag)(pointer)
;
; *** Only Validate the following fields...
XREF ;;array node name;field#;required param;word processing?;description
;;FLAG;.01;1;0;flag name
;;STAT;.02;1;0;active/inactive
;;TYPE;.03;1;0;pointer to PRF TYPE FILE (#26.16)
;;REVFREQ;.04;1;0;review frequency
;;NOTIDAYS;.05;1;0;notification days
;;REVGRP;.06;0;0;pointer to MAIL GROUP FILE (#3.8)
;;TIUTITLE;.07;1;0;pointer to TIU DOCUMENT (#8925.1) file
;;DESC;1;1;1;description of flag
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGPFALF1 3887 printed Nov 22, 2024@17:57:21 Page 2
DGPFALF1 ;ALB/KCL,RBS - PRF LOCAL FLAG API'S CONTINUED ; 4/20/04 12:02pm
+1 ;;5.3;Registration;**425,554**;Aug 13, 1993
+2 ;
+3 ;- no direct entry
+4 QUIT
+5 ;
STOALL(DGPFLF,DGPFLH,DGPFERR) ;File both LOCAL FLAG(#26.11) & HISTORY(#26.12)
+1 ;This function acts as a wrapper around the $$STOFLAG^DGPFALF
+2 ;and the $$STOHIST^DGPFALH filer calls.
+3 ;
+4 ; Input:
+5 ; DGPFLF - (required) array of Local Flag values to be filed
+6 ; (see $$GETLF^DGPFALF for valid array structure)
+7 ; DGPFLH - (required) array of Flag History values to be filed
+8 ; (see $$GETHIST^DGPFALH for valid array structure)
+9 ; DGPFERR - (optional) passed by reference to contain error messages
+10 ;
+11 ; Output:
+12 ; Function Value - Returns circumflex("^") delimited results of
+13 ; $$STOFLAG^DGPFALF and $$STOHIST^DGPFALH calls.
+14 ; Example: "3^12"
+15 ; On Success - "IEN of (#26.11)^IEN of (#26.12)"
+16 ; On Failure - 0
+17 ; DGPFERR - Undefined on success, error message on failure
+18 ;
+19 ;existing Local Flag file IEN used for "roll-back"
NEW DGOIEN
+20 ;existing Local Flag data array used for "roll-back"
NEW DGPFOLF
+21 ;Local Flag file IEN
NEW DGLIEN
+22 ;Local Flag history file IEN
NEW DGLHIEN
+23 ;"FLAG" value
NEW DGFLG
+24 ;
+25 SET (DGLIEN,DGLHIEN)=0
+26 SET DGFLG=$PIECE($GET(DGPFLF("FLAG")),U)
+27 SET DGOIEN=$$FNDFLAG^DGPFALF(DGFLG)
+28 IF 'DGOIEN!(DGOIEN&($$GETLF^DGPFALF(DGOIEN,.DGPFOLF)))
Begin DoDot:1
+29 SET DGLIEN=$$STOFLAG^DGPFALF(.DGPFLF,.DGPFERR)
+30 IF $DATA(DGPFERR)
SET DGLIEN=0
+31 IF DGLIEN
Begin DoDot:2
+32 SET DGPFLH("FLAG")=DGLIEN
+33 SET DGLHIEN=$$STOHIST^DGPFALH(.DGPFLH,.DGPFERR)
+34 IF $DATA(DGPFERR)
SET DGLHIEN=0
+35 ;roll back the Local Flag file setup
IF DGLHIEN=0
Begin DoDot:3
+36 IF 'DGOIEN
IF '$DATA(DGPFOLF)
SET DGPFOLF("FLAG")="@"
+37 IF $$ROLLBACK^DGPFALF1(26.11,DGLIEN,.DGPFOLF,"FLAG")
SET DGLIEN=0
End DoDot:3
End DoDot:2
End DoDot:1
+38 QUIT $SELECT(DGLHIEN=0:0,1:DGLIEN_"^"_DGLHIEN)
+39 ;
ROLLBACK(DGFILE,DGFIEN,DGPFOA,DGKEY) ;Rollback a FILE record
+1 ; Input:
+2 ; DGFILE - File reference that will be used for rollback
+3 ; DGFIEN - IEN of record to rollback in DGFILE
+4 ; DGPFOA - Original array of data prior to record modification
+5 ; DGKEY - .01 Field Name reference to DELETE whole record
+6 ; Output:
+7 ; Function value - 1 on successful Rollback
+8 ; 0 on failure
+9 ;
+10 NEW DGIENS,DGFDA,DGERR,DGRSLT
+11 SET DGRSLT=0
+12 IF $DATA(DGFILE)
IF +$GET(DGFIEN)
IF $DATA(DGPFOA)
IF $DATA(DGKEY)
Begin DoDot:1
+13 if '$DATA(^DGPF(DGFILE))
QUIT
+14 if '$DATA(^DGPF(DGFILE,DGFIEN))
QUIT
+15 SET DGIENS=DGFIEN_","
+16 IF $GET(DGPFOA(DGKEY))="@"
Begin DoDot:2
+17 SET DGFDA(DGFILE,DGIENS,.01)="@"
+18 DO FILE^DIE("","DGFDA","DGERR")
+19 IF '$DATA(DGERR)
SET DGRSLT=1
End DoDot:2
+20 IF '$TEST
Begin DoDot:2
+21 IF $$STOFLAG^DGPFALF(.DGPFOA,.DGERR)
IF '$DATA(DGERR)
SET DGRSLT=1
End DoDot:2
End DoDot:1
+22 QUIT DGRSLT
+23 ;
LOCKLF(DGPFLIEN) ; Lock Flag ien
+1 ; Input:
+2 ; DGPFLIEN - IEN of record
+3 ; Output:
+4 ; Function Value - Returns 1 on success
+5 ; 0 on failure
+6 LOCK +^DGPF(26.11,DGPFLIEN):10
IF '$TEST
QUIT 0
+7 QUIT 1
+8 ;
UNLOCK(DGPFLIEN) ; Un-Lock Flag ien
+1 ; Input:
+2 ; DGPFLIEN - IEN of record
+3 ; Output:
+4 ; Function Value - Returns 1 on success
+5 ; 0 on failure
+6 LOCK -^DGPF(26.11,DGPFLIEN):2
IF '$TEST
QUIT 0
+7 QUIT 1
+8 ;
+9 ;
+10 ; PRF LOCAL FLAG FILE (#26.11) Field VALIDATION data
+11 ; don't do the Principal Investigator(s) multiple fields...
+12 ; they're pointers anyway and won't be Validated.
+13 ; PRININV;2;0;0;principal investigator(s) (if Research Flag)(pointer)
+14 ;
+15 ; *** Only Validate the following fields...
XREF ;;array node name;field#;required param;word processing?;description
+1 ;;FLAG;.01;1;0;flag name
+2 ;;STAT;.02;1;0;active/inactive
+3 ;;TYPE;.03;1;0;pointer to PRF TYPE FILE (#26.16)
+4 ;;REVFREQ;.04;1;0;review frequency
+5 ;;NOTIDAYS;.05;1;0;notification days
+6 ;;REVGRP;.06;0;0;pointer to MAIL GROUP FILE (#3.8)
+7 ;;TIUTITLE;.07;1;0;pointer to TIU DOCUMENT (#8925.1) file
+8 ;;DESC;1;1;1;description of flag