source: FOIAVistA/trunk/r/NOIS-FSC/FSCNOTS.m@ 1327

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

initial load of FOIAVistA 6/30/08 version

File size: 3.8 KB
Line 
1FSCNOTS ;SLC/STAFF-NOIS Notification Send ;1/13/98 13:58
2 ;;1.1;NOIS;;Sep 06, 1998
3 ;
4NOTIFY(CALL) ; from FSCTASKU
5 N ADDRESS,ARRAY,DA,DIK,EVENT,MAILMSG,METHOD,MSG,NOTIFY,NUM,OK,USER K ARRAY
6 S NUM=0 F S NUM=$O(^FSCD("NOTIFY","B",CALL,NUM)) Q:NUM<1 D
7 .S NOTIFY=^FSCD("NOTIFY",NUM,0)
8 .D GET(NOTIFY,.USER,.METHOD,.EVENT,.ADDRESS)
9 .D SEND(NOTIFY,CALL,EVENT,USER,.OK,.MSG) I OK D
10 ..I METHOD="MAIL" D Q
11 ...S MAILMSG=$S('$D(MAILMSG):MSG,1:$S(MSG["Status":MSG,1:MAILMSG))
12 ...I $L(ADDRESS) S ARRAY(ADDRESS)="",ARRAY(ADDRESS,1)="I" Q
13 ...S ARRAY(USER)="",ARRAY(USER,1)="I"
14 ..I METHOD="ALERT" D ALERT(CALL,USER,MSG) Q
15 .I EVENT="ADDED" S DA=NUM,DIK="^FSCD(""NOTIFY""," D ^DIK
16 .I EVENT="CLOSED" S DA=NUM,DIK="^FSCD(""NOTIFY""," D ^DIK
17 I $L($O(ARRAY(0))) D MAIL(CALL,.ARRAY,MAILMSG)
18 Q
19 ;
20GET(NOTIFY,USER,METHOD,EVENT,ADDRESS) ; from FSCTASKN
21 N CALL,LIST,LOC S ADDRESS=""
22 S CALL=$P(NOTIFY,U),LIST=$P(NOTIFY,U,2),LOC=$P(NOTIFY,U,3),USER=$P(NOTIFY,U,4),METHOD=$P(NOTIFY,U,5),EVENT=$P(NOTIFY,U,6)
23 I USER S ADDRESS=$P($G(^FSC("SPEC",USER,0)),U,6) S:'$L(ADDRESS) ADDRESS=USER Q
24 I LIST S USER=$P(^FSC("LIST",LIST,0),U,2),METHOD=$P(^(0),U,6),EVENT=$P(^(0),U,7),ADDRESS=$P($G(^FSC("SPEC",USER,0)),U,6) S:'$L(ADDRESS) ADDRESS=USER Q
25 I LOC S USER=$P(^FSC("SITE",LOC,0),U,6),METHOD=$P(^(0),U,4),EVENT=$P(^(0),U,5),ADDRESS=$P(^(0),U,10) S:'$L(ADDRESS) ADDRESS=USER
26 Q
27 ;
28SEND(NOTIFY,CALL,EVENT,USER,OK,MSG) ; (notify zero node,call,event,user for notification,ok,msg) returns ok to send notification and msg
29 N EDITTIME,EDITUSER,FROM,LOG,STATTIME,TO,USERFLAG S OK=0,MSG=""
30 S EDITTIME=$P(^FSCD("CALL",CALL,120),U,4),EDITUSER=$P(^(120),U,5),STATTIME=$P(^(120),U,2),FROM=$P(^(120),U,8),TO=$P(^(0),U,24)
31 I EDITUSER=USER Q
32 I 'USER Q
33 S USERFLAG=$S($$ACCESS^FSCU(EDITUSER,"SPEC"):"",1:"<non Specialist> ")
34 I EVENT="EDITED" D Q
35 .S OK=1,MSG="Edited by "_USERFLAG_$$VALUE^FSCGET(EDITUSER,7100,124)_" on "_$P($$FMTE^XLFDT(EDITTIME),":",1,2)_"."
36 I EVENT="STATUS CHANGED",EDITTIME=STATTIME D Q
37 .S FROM=$$VALUE^FSCGET(FROM,7100,4.6),TO=$$VALUE^FSCGET(TO,7100,4.5)
38 .S OK=1,MSG="Status changed "_$S($L(FROM):"from "_FROM_" ",1:"")_"to "_TO_" by "_USERFLAG_$$VALUE^FSCGET(EDITUSER,7100,124)_" on "_$P($$FMTE^XLFDT(EDITTIME),":",1,2)_"."
39 I EVENT="ADDED" D Q
40 .S OK=1,MSG="Call added to "_$P($G(^FSC("LIST",+$P(NOTIFY,U,2),0)),U)_" "_$$FMTE^XLFDT(DT)_"."
41 I EVENT="CLOSED" D Q
42 .S OK=1,MSG="Call Closed by "_USERFLAG_$$VALUE^FSCGET(EDITUSER,7100,124)_" on "_$$FMTE^XLFDT(DT)_"."
43 Q
44 ;
45MAIL(CALL,XMY,MAILMSG) ; from FSCTASKN
46 N XMDUZ,XMSUB,XMTEXT K ^TMP("FSC MAIL DETAIL",$J)
47 S XMDUZ="NOIS Notification",XMSUB=$$SHORT^FSCGETS(CALL,"NOIS:")
48 I XMSUB[U S XMSUB=$$REPLACE^FSCRU(XMSUB,U,"~U~")
49 D
50 .I $D(^XTMP("FSC CALL DETAIL",CALL)) S XMTEXT="^XTMP(""FSC CALL DETAIL"","_CALL_"," Q
51 .S ^TMP("FSC MAIL DETAIL",$J,0,1,0)=MAILMSG
52 .S ^TMP("FSC MAIL DETAIL",$J,0,2,0)=" "
53 .D BUILD^FSCFORM(0,CALL,"DETAIL",2,"FSC MAIL ") S XMTEXT="^TMP(""FSC MAIL DETAIL"",$J,0,"
54 D ^XMD
55 K ^TMP("FSC MAIL DETAIL",$J)
56 Q
57 ;
58ALERT(CALL,USER,MSG) ; from FSCTASKN
59 I '$L(USER) Q
60 N NUM,ON,XQA,XQADATA,XQAID,XQAMSG,XAQROU K XQA S ON=1
61 I '$G(^FSCD("ALERT","ALERT",USER)) S ON=0
62 S NUM=$G(^FSCD("ALERT","AUC",USER,CALL))
63 D
64 .I NUM S $P(^FSCD("ALERT",NUM,0),U,3)=MSG Q
65 .D NEWALERT(USER,CALL,MSG)
66 I ON Q
67 S XQA(USER)="",XQADATA="",XQAMSG="NOIS Calls",XQAROU="USER^FSCNAR",XQAID="FSC-A"
68 D SETUP^XQALERT
69 Q
70 ;
71NEWALERT(USER,CALL,MSG,NUM,DELIVERY) ; from FSCNAS, FSCRPCN
72 N DA,DIK
73 S CALL=$G(CALL),MSG=$G(MSG),DELIVERY=$G(DELIVERY)
74 S NUM=1+$P(^FSCD("ALERT",0),U,3)
75 L +^FSCD("ALERT",0):30 I '$T Q ; *** needs ok
76 F Q:'$D(^FSCD("ALERT",NUM,0)) S NUM=NUM+1
77 I DELIVERY S ^FSCD("ALERT",NUM,0)=USER_U_CALL_U_MSG_"^^"_DELIVERY
78 E S ^FSCD("ALERT",NUM,0)=USER_U_CALL_U_MSG_U_$$NOW^XLFDT
79 S $P(^FSCD("ALERT",0),U,3)=NUM,$P(^(0),U,4)=$P(^(0),U,4)+1
80 L -^FSCD("ALERT",0)
81 S DIK="^FSCD(""ALERT"",",DA=NUM D IX1^DIK
82 Q
Note: See TracBrowser for help on using the repository browser.