source: WorldVistAEHR/trunk/r/NOIS-FSC/FSCNOT.m@ 1766

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

initial load of WorldVistAEHR

File size: 2.0 KB
Line 
1FSCNOT ;SLC/STAFF NOIS Notification ;1/11/98 18:43
2 ;;1.1;NOIS;;Sep 06, 1998
3 ;
4SETUP(CALL,LIST,LOC,USER,METHOD,EVENT) ; from FSCAFFIL, FSCEL, FSCLMPNB, FSCLP, FSCRPCN, FSCTASKU
5 N DA,DIE,DR,NUM
6 L +^FSCD("NOTIFY",0):30 I '$T Q ; *** needs ok
7 S NUM=1+$P(^FSCD("NOTIFY",0),U,3)
8 F Q:'$D(^FSCD("NOTIFY",NUM,0)) S NUM=NUM+1
9 S $P(^FSCD("NOTIFY",0),U,3)=NUM,$P(^(0),U,4)=$P(^(0),U,4)+1
10 S ^FSCD("NOTIFY",NUM,0)=CALL,^FSCD("NOTIFY","B",CALL,NUM)=""
11 L -^FSCD("NOTIFY",0)
12 S DA=NUM,DIE=7100.2,DR=""
13 D
14 .I $G(LIST) S DR=DR_"1///`"_LIST Q
15 .I $G(LOC) S DR=DR_"2///`"_LOC Q
16 .I $G(USER) D Q
17 ..S DR=DR_"3///`"_+USER
18 ..I $P(USER,U,2) S DR=DR_";6///1"
19 I '$L(DR) Q
20 I $L($G(METHOD)),$L($G(EVENT)) S DR=DR_";4///"_METHOD_";5///"_EVENT
21 L +^FSCD("NOTIFY",NUM):30 I '$T Q ; *** needs ok
22 D ^DIE
23 L -^FSCD("NOTIFY",NUM)
24 Q
25 ;
26NOTINFO(CALL,USER) ; from FSCLMPNR, FSCLMPON, FSCRPCN, FSCRPCON
27 ; returns ^TMP("FSC NOTIFY",$J,notification #) = msg
28 ; ^TMP("FSC NOTIFY",$J,"B",msg,notification #) = ""
29 N MSG,NUM
30 S NUM=0 F S NUM=$O(^FSCD("NOTIFY","B",CALL,NUM)) Q:NUM<1 D
31 .D MSG(NUM,$G(USER),.MSG)
32 .I $L(MSG) S ^TMP("FSC NOTIFY",$J,NUM)=MSG,^TMP("FSC NOTIFY",$J,"B",$E(MSG,1,60),NUM)=""
33 Q
34 ;
35MSG(NUM,USER,MSG) ;
36 N EMAIL,EVENT,LIST,LOC,METHOD,PERSON S OK=1,MSG=""
37 S LIST=$P(^FSCD("NOTIFY",NUM,0),U,2),LOC=$P(^(0),U,3),PERSON=$P(^(0),U,4),METHOD=$P(^(0),U,5),EVENT=$P(^(0),U,6)
38 I PERSON D Q
39 .I USER,USER'=PERSON Q
40 .S MSG=METHOD_" "_$$VALUE^FSCGET(PERSON,7100.2,3)_" when "_EVENT
41 I LIST D Q
42 .S PERSON=$P(^FSC("LIST",LIST,0),U,2),METHOD=$P(^(0),U,6),EVENT=$P(^(0),U,7)
43 .I 'PERSON Q
44 .I USER,USER'=PERSON Q
45 .S MSG=METHOD_" "_$$VALUE^FSCGET(PERSON,7100.2,3)_" (from list: "_$$VALUE^FSCGET(LIST,7100.2,1)_") when "_EVENT
46 I LOC D Q
47 .S PERSON=$P(^FSC("SITE",LOC,0),U,6),EMAIL=$P(^(0),U,10),METHOD=$P(^(0),U,4),EVENT=$P(^(0),U,5)
48 .I USER,USER'=PERSON Q
49 .I METHOD="MAIL" S PERSON=$S($L(EMAIL):EMAIL,PERSON:$$VALUE^FSCGET(PERSON,7100.2,3),1:"") I '$L(PERSON) Q
50 .S MSG=METHOD_" "_PERSON_" ("_$$VALUE^FSCGET(LOC,7100.2,2)_") when "_EVENT
51 Q
Note: See TracBrowser for help on using the repository browser.