1 | DGPFALF1 ;ALB/KCL,RBS - PRF LOCAL FLAG API'S CONTINUED ; 4/20/04 12:02pm
|
---|
2 | ;;5.3;Registration;**425,554**;Aug 13, 1993
|
---|
3 | ;
|
---|
4 | ;- no direct entry
|
---|
5 | QUIT
|
---|
6 | ;
|
---|
7 | STOALL(DGPFLF,DGPFLH,DGPFERR) ;File both LOCAL FLAG(#26.11) & HISTORY(#26.12)
|
---|
8 | ;This function acts as a wrapper around the $$STOFLAG^DGPFALF
|
---|
9 | ;and the $$STOHIST^DGPFALH filer calls.
|
---|
10 | ;
|
---|
11 | ; Input:
|
---|
12 | ; DGPFLF - (required) array of Local Flag values to be filed
|
---|
13 | ; (see $$GETLF^DGPFALF for valid array structure)
|
---|
14 | ; DGPFLH - (required) array of Flag History values to be filed
|
---|
15 | ; (see $$GETHIST^DGPFALH for valid array structure)
|
---|
16 | ; DGPFERR - (optional) passed by reference to contain error messages
|
---|
17 | ;
|
---|
18 | ; Output:
|
---|
19 | ; Function Value - Returns circumflex("^") delimited results of
|
---|
20 | ; $$STOFLAG^DGPFALF and $$STOHIST^DGPFALH calls.
|
---|
21 | ; Example: "3^12"
|
---|
22 | ; On Success - "IEN of (#26.11)^IEN of (#26.12)"
|
---|
23 | ; On Failure - 0
|
---|
24 | ; DGPFERR - Undefined on success, error message on failure
|
---|
25 | ;
|
---|
26 | N DGOIEN ;existing Local Flag file IEN used for "roll-back"
|
---|
27 | N DGPFOLF ;existing Local Flag data array used for "roll-back"
|
---|
28 | N DGLIEN ;Local Flag file IEN
|
---|
29 | N DGLHIEN ;Local Flag history file IEN
|
---|
30 | N DGFLG ;"FLAG" value
|
---|
31 | ;
|
---|
32 | S (DGLIEN,DGLHIEN)=0
|
---|
33 | S DGFLG=$P($G(DGPFLF("FLAG")),U)
|
---|
34 | S DGOIEN=$$FNDFLAG^DGPFALF(DGFLG)
|
---|
35 | I 'DGOIEN!(DGOIEN&($$GETLF^DGPFALF(DGOIEN,.DGPFOLF))) D
|
---|
36 | . S DGLIEN=$$STOFLAG^DGPFALF(.DGPFLF,.DGPFERR)
|
---|
37 | . I $D(DGPFERR) S DGLIEN=0
|
---|
38 | . I DGLIEN D
|
---|
39 | . . S DGPFLH("FLAG")=DGLIEN
|
---|
40 | . . S DGLHIEN=$$STOHIST^DGPFALH(.DGPFLH,.DGPFERR)
|
---|
41 | . . I $D(DGPFERR) S DGLHIEN=0
|
---|
42 | . . I DGLHIEN=0 D ;roll back the Local Flag file setup
|
---|
43 | . . . I 'DGOIEN,'$D(DGPFOLF) S DGPFOLF("FLAG")="@"
|
---|
44 | . . . I $$ROLLBACK^DGPFALF1(26.11,DGLIEN,.DGPFOLF,"FLAG") S DGLIEN=0
|
---|
45 | Q $S(DGLHIEN=0:0,1:DGLIEN_"^"_DGLHIEN)
|
---|
46 | ;
|
---|
47 | ROLLBACK(DGFILE,DGFIEN,DGPFOA,DGKEY) ;Rollback a FILE record
|
---|
48 | ; Input:
|
---|
49 | ; DGFILE - File reference that will be used for rollback
|
---|
50 | ; DGFIEN - IEN of record to rollback in DGFILE
|
---|
51 | ; DGPFOA - Original array of data prior to record modification
|
---|
52 | ; DGKEY - .01 Field Name reference to DELETE whole record
|
---|
53 | ; Output:
|
---|
54 | ; Function value - 1 on successful Rollback
|
---|
55 | ; 0 on failure
|
---|
56 | ;
|
---|
57 | N DGIENS,DGFDA,DGERR,DGRSLT
|
---|
58 | S DGRSLT=0
|
---|
59 | I $D(DGFILE),+$G(DGFIEN),$D(DGPFOA),$D(DGKEY) D
|
---|
60 | . Q:'$D(^DGPF(DGFILE))
|
---|
61 | . Q:'$D(^DGPF(DGFILE,DGFIEN))
|
---|
62 | . S DGIENS=DGFIEN_","
|
---|
63 | . I $G(DGPFOA(DGKEY))="@" D
|
---|
64 | . . S DGFDA(DGFILE,DGIENS,.01)="@"
|
---|
65 | . . D FILE^DIE("","DGFDA","DGERR")
|
---|
66 | . . I '$D(DGERR) S DGRSLT=1
|
---|
67 | . E D
|
---|
68 | . . I $$STOFLAG^DGPFALF(.DGPFOA,.DGERR),'$D(DGERR) S DGRSLT=1
|
---|
69 | Q DGRSLT
|
---|
70 | ;
|
---|
71 | LOCKLF(DGPFLIEN) ; Lock Flag ien
|
---|
72 | ; Input:
|
---|
73 | ; DGPFLIEN - IEN of record
|
---|
74 | ; Output:
|
---|
75 | ; Function Value - Returns 1 on success
|
---|
76 | ; 0 on failure
|
---|
77 | L +^DGPF(26.11,DGPFLIEN):10 I '$T Q 0
|
---|
78 | Q 1
|
---|
79 | ;
|
---|
80 | UNLOCK(DGPFLIEN) ; Un-Lock Flag ien
|
---|
81 | ; Input:
|
---|
82 | ; DGPFLIEN - IEN of record
|
---|
83 | ; Output:
|
---|
84 | ; Function Value - Returns 1 on success
|
---|
85 | ; 0 on failure
|
---|
86 | L -^DGPF(26.11,DGPFLIEN):2 I '$T Q 0
|
---|
87 | Q 1
|
---|
88 | ;
|
---|
89 | ;
|
---|
90 | ; PRF LOCAL FLAG FILE (#26.11) Field VALIDATION data
|
---|
91 | ; don't do the Principal Investigator(s) multiple fields...
|
---|
92 | ; they're pointers anyway and won't be Validated.
|
---|
93 | ; PRININV;2;0;0;principal investigator(s) (if Research Flag)(pointer)
|
---|
94 | ;
|
---|
95 | ; *** Only Validate the following fields...
|
---|
96 | XREF ;;array node name;field#;required param;word processing?;description
|
---|
97 | ;;FLAG;.01;1;0;flag name
|
---|
98 | ;;STAT;.02;1;0;active/inactive
|
---|
99 | ;;TYPE;.03;1;0;pointer to PRF TYPE FILE (#26.16)
|
---|
100 | ;;REVFREQ;.04;1;0;review frequency
|
---|
101 | ;;NOTIDAYS;.05;1;0;notification days
|
---|
102 | ;;REVGRP;.06;0;0;pointer to MAIL GROUP FILE (#3.8)
|
---|
103 | ;;TIUTITLE;.07;1;0;pointer to TIU DOCUMENT (#8925.1) file
|
---|
104 | ;;DESC;1;1;1;description of flag
|
---|