source: FOIAVistA/tag/r/NOIS-FSC/FSCRPCN.m@ 949

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

initial load of FOIAVistA 6/30/08 version

File size: 4.9 KB
Line 
1FSCRPCN ;SLC/STAFF-NOIS RPC Notifications ;1/13/98 16:01
2 ;;1.1;NOIS;;Sep 06, 1998
3 ;
4SIGNUP(IN,OUT) ; from FSCRPX (RPBSignupNotify)
5 N CALL,EVENT,LINE,METHOD,USER
6 S LINE=$G(^TMP("FSCRPC",$J,"INPUT",1))
7 S CALL=$P(LINE,U),METHOD=$P(LINE,U,2),EVENT=$P(LINE,U,3),USER=$P(LINE,U,4)
8 Q:'CALL Q:'$L(METHOD) Q:'$L(EVENT) Q:'USER
9 D SETUP^FSCNOT(CALL,,,USER_U_1,METHOD,EVENT)
10 Q
11 ;
12BE(IN,OUT) ; from FSCRPX (RPCBeNotified)
13 N CALL,EVENT,LINE,METHOD,NUM
14 S LINE=$G(^TMP("FSCRPC",$J,"INPUT",1))
15 S METHOD=$P(LINE,U,2),EVENT=$P(LINE,U,3)
16 Q:'$L(METHOD) Q:'$L(EVENT)
17 I $P(LINE,U) D
18 .S CALL=0 F S CALL=$O(^TMP("FSC CURRENT LIST",$J,"C",CALL)) Q:CALL<1 D CALLSET(CALL,METHOD,EVENT)
19 E D
20 .S NUM=1 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S CALL=+^(NUM) I CALL D CALLSET(CALL,METHOD,EVENT)
21 Q
22 ;
23CALLSET(CALL,METHOD,EVENT) ;
24 N NUM
25 I $D(^FSCD("NOTIFY","ACUSER",CALL,DUZ)) S NUM=+^(DUZ) D Q
26 .S $P(^FSCD("NOTIFY",NUM,0),U,5,7)=METHOD_U_EVENT_U_1
27 D SETUP^FSCNOT(CALL,,,DUZ_U_1,METHOD,EVENT)
28 Q
29 ;
30FIND(IN,OUT) ; from FSCRPX (RPCFindNotification)
31 N LINE,USER
32 S LINE=$G(^TMP("FSCRPC",$J,"INPUT",1))
33 S USER=$P(LINE,U,2)
34 I 'USER Q
35 I $P(LINE,U) D ALL(USER)
36 E D ONLY(USER)
37 Q
38 ;
39ALL(USER) ;
40 N CALL,LNUM
41 K ^TMP("FSC LIST",$J),^TMP("FSC CURRENT LIST",$J)
42 D ALL^FSCLMPNF(USER)
43 S LNUM=0
44 S CALL="A" F S CALL=$O(^TMP("FSC LIST",$J,CALL),-1) Q:CALL<1 D
45 .S LNUM=LNUM+1
46 .S (^TMP("FSCRPC",$J,"OUTPUT",LNUM),^TMP("FSC CURRENT LIST",$J,LNUM+1000))=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
47 .S ^TMP("FSC CURRENT LIST",$J,"C",CALL)=LNUM+1000
48 K ^TMP("FSC LIST",$J)
49 Q
50 ;
51ONLY(USER) ;
52 N CALL,DONE,LNUM
53 K ^TMP("FSC LIST",$J)
54 S CALL=0 F S CALL=$O(^TMP("FSC CURRENT LIST",$J,"C",CALL)) Q:CALL<1 D
55 .I $D(^FSCD("NOTIFY","ACUSER",CALL,USER)) S ^TMP("FSC LIST",$J,CALL)="" Q
56 .S (DONE,LNUM)=0 F S LNUM=$O(^FSCD("NOTIFY","ACLIST",CALL,LNUM)) Q:LNUM<1 D Q:DONE
57 ..I $D(^FSC("LIST","C",USER,LNUM)) S ^TMP("FSC LIST",$J,CALL)="",DONE=1
58 K ^TMP("FSC CURRENT LIST",$J)
59 S LNUM=0
60 S CALL="A" F S CALL=$O(^TMP("FSC LIST",$J,CALL),-1) Q:CALL<1 D
61 .S LNUM=LNUM+1
62 .S (^TMP("FSCRPC",$J,"OUTPUT",LNUM),^TMP("FSC CURRENT LIST",$J,LNUM+1000))=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
63 .S ^TMP("FSC CURRENT LIST",$J,"C",CALL)=LNUM+1000
64 K ^TMP("FSC LIST",$J)
65 Q
66REMOVE(IN,OUT) ; from FSCRPX (RPCRemoveNotification)
67 N LINE
68 S LINE=$G(^TMP("FSCRPC",$J,"INPUT",1))
69 I '$L(LINE) Q
70 I +LINE=1 D REMLIST
71 E D REMCALLS
72 Q
73REMLIST ;
74 N CALL,DA,DIK
75 S DIK="^FSCD(""NOTIFY"","
76 S CALL=0 F S CALL=$O(^TMP("FSC CURRENT LIST",$J,"C",CALL)) Q:CALL<1 D
77 .K ^TMP("FSC NOTIFY",$J)
78 .D NOTINFO^FSCNOT(CALL,DUZ)
79 .S DA=0 F S DA=$O(^TMP("FSC NOTIFY",$J,DA)) Q:DA<1 D ^DIK
80 K ^TMP("FSC NOTIFY",$J)
81 Q
82 ;
83REMCALLS ;
84 N CALL,DA,DIK,NUM
85 S DIK="^FSCD(""NOTIFY"","
86 S NUM=0 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S CALL=+^(NUM) I CALL D
87 .K ^TMP("FSC NOTIFY",$J)
88 .D NOTINFO^FSCNOT(CALL,DUZ)
89 .S DA=0 F S DA=$O(^TMP("FSC NOTIFY",$J,DA)) Q:DA<1 D ^DIK
90 K ^TMP("FSC NOTIFY",$J)
91 Q
92 ;
93NOTIFY(IN,OUT) ; from FSCRPX (RPCNotify)
94 N CALLFLAG,DELIVERY,LINE,METHOD,MSG,RECIP,YOURSELF K RECIP
95 S LINE=$G(^TMP("FSCRPC",$J,"INPUT",1))
96 S CALLFLAG=$P(LINE,U),METHOD=$P(LINE,U,2),YOURSELF=$P(LINE,U,3),DELIVERY=$P(LINE,U,4),MSG=$P(LINE,U,5,99)
97 I '$L(METHOD) Q
98 D RECIP(.RECIP)
99 I 'YOURSELF S DELIVERY=""
100 E S RECIP(DUZ)=""
101 I METHOD="ALERT" D ALERT(CALLFLAG,DELIVERY,MSG,.RECIP)
102 I METHOD="MAIL" D MAIL(MSG,.RECIP)
103 Q
104 ;
105MAIL(XMSUB,XMY) ;
106 Q:'$D(XMSUB) I XMSUB[U S XMSUB=$$REPLACE^FSCRU(XMSUB,U,"~U~")
107 N CNT,LINE,NUM,XMTEXT,XMZ K ^TMP("FSC MAIL",$J)
108 S ^TMP("FSC MAIL",$J,1,0)=" "
109 S ^TMP("FSC MAIL",$J,2,0)=" *** NOIS INFORMATION ***"
110 S CNT=2
111 S NUM=1 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 I ^(NUM)="{Info}" Q
112 I NUM<1 Q
113 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S LINE=^(NUM) Q:LINE="<<<>>>" S CNT=CNT+1,^TMP("FSC MAIL",$J,CNT,0)=LINE
114 S XMTEXT="^TMP(""FSC MAIL"",$J,"
115 S XMY(DUZ)=""
116 D ^XMD I $G(XMZ) ; W !,"Message #",XMZ," sent." H 2
117 D KILL^XM K ^TMP("FSC MAIL",$J)
118 Q
119 ;
120ALERT(CALLFLAG,DELIVERY,XQAMSG,XQA) ;
121 N ALERT,CALL,NUM,XQADATA,XQAID,XQAROU
122 I $L(DELIVERY) S XQAMSG=XQAMSG_" from: Yourself, sent: "_$$FMTE^XLFDT(DT)
123 E S XQAMSG=XQAMSG_" from: "_$$VALUE^FSCGET(DUZ,7100,2.1)
124 I DELIVERY=DT S DELIVERY=""
125 D NEWALERT^FSCNOTS(DUZ,,XQAMSG,.ALERT,DELIVERY)
126 I CALLFLAG S CALL=0 F S CALL=$O(^TMP("FSC CURRENT LIST",$J,"C",CALL)) Q:CALL<1 D NEWSEND^FSCNAS(ALERT,CALL)
127 I 'CALLFLAG D
128 .S NUM=1 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 I ^(NUM)="{Info}" Q
129 .I NUM<1 Q
130 .F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S CALL=+^(NUM) I CALL D NEWSEND^FSCNAS(ALERT,CALL)
131 I DELIVERY Q
132 S XQADATA=ALERT,XQAROU="ALERT^FSCNAR",XQAID="FSC-M"
133 D SETUP^XQALERT
134 Q
135 ;
136RECIP(RECIP) ;
137 N LINE,NUM,OK
138 S NUM=1 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 I ^(NUM)="{SendTo}" Q
139 I NUM<1 Q
140 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S LINE=^(NUM) Q:LINE="<<<>>>" Q:'$L(LINE) D
141 .I $L(LINE)>4,$E(LINE,1,2)="G." S OK=1
142 .E S LINE=+LINE S OK=1 I 'LINE S OK=0
143 .I OK S RECIP(LINE)=""
144 Q
145 ;
Note: See TracBrowser for help on using the repository browser.