source: FOIAVistA/trunk/r/NOIS-FSC/FSCAFFIL.m@ 1586

Last change on this file since 1586 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.9 KB
Line 
1FSCAFFIL ;SLC/STAFF-NOIS Affiliation ;1/17/98 16:50
2 ;;1.1;NOIS;;Sep 06, 1998
3 ;
4AFFIL(CALL) ; from FSCTASKA
5 N ADD,REMOVE K ADD,REMOVE
6 D CLEAN(CALL,.REMOVE,.ADD)
7 I $O(REMOVE(0)) D DEL(.REMOVE)
8 I $O(ADD(0)) D NEW(CALL,.ADD)
9 K ADD,REMOVE
10 Q
11 ;
12CLEAN(CALL,REMOVE,ADD) ;
13 N EVENT,METHOD,MISC,NEVENT,NMETHOD,NOTNUM,PACK,PACKGP,RTD,SPEC,USER
14 D CINFO(CALL,.PACK,.PACKGP,.MISC,.RTD,.SPEC)
15 S USER=0 F S USER=$O(^FSCD("NOTIFY","ACUSER",CALL,USER)) Q:USER'>0 S NOTNUM=+^(USER) I NOTNUM D
16 .I $P($G(^FSCD("NOTIFY",NOTNUM,0)),U,7) Q
17 .I '$D(^FSC("SPEC",USER,0)) Q ; ** should not be processing non spec
18 .D SINFO(USER,.METHOD,.EVENT)
19 .I '$L(METHOD) S REMOVE(USER)=NOTNUM Q
20 .I '$L(EVENT) S REMOVE(USER)=NOTNUM Q
21 .I USER'=SPEC D
22 ..I '$$CHECK(USER,PACK,PACKGP) S REMOVE(USER)=NOTNUM Q
23 ..I MISC,$D(^FSC("SPEC","AF",1,USER)) S REMOVE(USER)=NOTNUM
24 .I $D(REMOVE(USER)) Q
25 .D NINFO(NOTNUM,.NMETHOD,.NEVENT)
26 .I NMETHOD'=METHOD S $P(^FSCD("NOTIFY",NOTNUM,0),U,5)=METHOD
27 .I NEVENT'=EVENT S $P(^FSCD("NOTIFY",NOTNUM,0),U,6)=EVENT
28 I SPEC,'$D(^FSCD("NOTIFY","ACUSER",CALL,SPEC)) D CHKADD(SPEC,.ADD)
29 I PACK S USER=0 F S USER=$O(^FSC("SPEC","AP",PACK,USER)) Q:USER'>0 D
30 .I $D(REMOVE(USER)) Q
31 .I $D(ADD(USER)) Q
32 .I $D(^FSCD("NOTIFY","ACUSER",CALL,USER)) Q
33 .I RTD,$D(^FSC("SPEC","AF",2,USER)) D CHKADD(USER,.ADD)
34 .I 'MISC,$D(^FSC("SPEC","AF",1,USER)) D CHKADD(USER,.ADD)
35 I PACKGP S USER=0 F S USER=$O(^FSC("SPEC","AG",PACKGP,USER)) Q:USER'>0 D
36 .I $D(REMOVE(USER)) Q
37 .I $D(ADD(USER)) Q
38 .I $D(^FSCD("NOTIFY","ACUSER",CALL,USER)) Q
39 .I '$P($G(^FSC("SPEC",USER,20,+$O(^FSC("SPEC","AG",PACKGP,USER,0)),0)),U,3) Q
40 .I RTD,$D(^FSC("SPEC","AF",2,USER)) D CHKADD(USER,.ADD)
41 .I 'MISC,$D(^FSC("SPEC","AF",1,USER)) D CHKADD(USER,.ADD)
42 Q
43 ;
44CHECK(USER,PACK,PACKGP) ; $$(user,package,package group) -> 0 or 1 if ok to tag for notify
45 I '$P($G(^FSC("SPEC",USER,0)),U,22) Q 0
46 I PACKGP,$P($G(^FSC("SPEC",USER,20,+$O(^FSC("SPEC","AG",PACKGP,USER,0)),0)),U,3) Q 1
47 I PACK,$O(^FSC("SPEC","AP",PACK,USER,0)) Q 1
48 Q 0
49 ;
50CHKADD(USER,ADD) ;
51 N EVENT,METHOD
52 D SINFO(USER,.METHOD,.EVENT)
53 I '$L(METHOD) Q
54 I '$L(EVENT) Q
55 S ADD(USER)=METHOD_U_EVENT
56 Q
57 ;
58CINFO(CALL,PACK,PACKGP,MISC,RTD,SPEC) ;
59 N ZERO,ONETW
60 S ZERO=$G(^FSCD("CALL",+CALL,0)),ONETW=$G(^(120))
61 S PACK=$P(ONETW,U,9)
62 S PACKGP=$P(ONETW,U,13)
63 S MISC=$S($P(ZERO,U,10)=5:1,1:"")
64 S RTD=$S($P(ZERO,U,17):1,1:"")
65 S SPEC=$P(ZERO,U,9)
66 Q
67 ;
68SINFO(SPEC,METHOD,EVENT) ;
69 S METHOD=$P($G(^FSC("SPEC",+SPEC,0)),U,14),EVENT=$P($G(^(0)),U,15)
70 Q
71 ;
72NINFO(NUM,METHOD,EVENT) ;
73 S METHOD=$P($G(^FSCD("NOTIFY",+NUM,0)),U,5),EVENT=$P($G(^(0)),U,6)
74 Q
75 ;
76DEL(REMOVE) ;
77 N USER
78 S USER=0 F S USER=$O(REMOVE(USER)) Q:USER'>0 D
79 .I REMOVE(USER) D DEL^FSCUCD("^FSCD(""NOTIFY"",",REMOVE(USER))
80 Q
81 ;
82NEW(CALL,ADD) ;
83 N USER
84 S USER=0 F S USER=$O(ADD(USER)) Q:USER'>0 D
85 .D SETUP^FSCNOT(CALL,,,USER,$P(ADD(USER),U),$P(ADD(USER),U,2))
86 Q
87 ;
88TEST ; run in debug
89 N CALL
90 S CALL=999 F S CALL=$O(^FSCD("CALL",CALL)) Q:CALL<1 Q:CALL>10000 W !,CALL D AFFIL(CALL)
91 Q
Note: See TracBrowser for help on using the repository browser.