FSCNOT ;SLC/STAFF NOIS Notification ;1/11/98 18:43
;;1.1;NOIS;;Sep 06, 1998
;
SETUP(CALL,LIST,LOC,USER,METHOD,EVENT) ; from FSCAFFIL, FSCEL, FSCLMPNB, FSCLP, FSCRPCN, FSCTASKU
N DA,DIE,DR,NUM
L +^FSCD("NOTIFY",0):30 I '$T Q ; *** needs ok
S NUM=1+$P(^FSCD("NOTIFY",0),U,3)
F Q:'$D(^FSCD("NOTIFY",NUM,0)) S NUM=NUM+1
S $P(^FSCD("NOTIFY",0),U,3)=NUM,$P(^(0),U,4)=$P(^(0),U,4)+1
S ^FSCD("NOTIFY",NUM,0)=CALL,^FSCD("NOTIFY","B",CALL,NUM)=""
L -^FSCD("NOTIFY",0)
S DA=NUM,DIE=7100.2,DR=""
D
.I $G(LIST) S DR=DR_"1///`"_LIST Q
.I $G(LOC) S DR=DR_"2///`"_LOC Q
.I $G(USER) D Q
..S DR=DR_"3///`"_+USER
..I $P(USER,U,2) S DR=DR_";6///1"
I '$L(DR) Q
I $L($G(METHOD)),$L($G(EVENT)) S DR=DR_";4///"_METHOD_";5///"_EVENT
L +^FSCD("NOTIFY",NUM):30 I '$T Q ; *** needs ok
D ^DIE
L -^FSCD("NOTIFY",NUM)
Q
;
NOTINFO(CALL,USER) ; from FSCLMPNR, FSCLMPON, FSCRPCN, FSCRPCON
; returns ^TMP("FSC NOTIFY",$J,notification #) = msg
; ^TMP("FSC NOTIFY",$J,"B",msg,notification #) = ""
N MSG,NUM
S NUM=0 F S NUM=$O(^FSCD("NOTIFY","B",CALL,NUM)) Q:NUM<1 D
.D MSG(NUM,$G(USER),.MSG)
.I $L(MSG) S ^TMP("FSC NOTIFY",$J,NUM)=MSG,^TMP("FSC NOTIFY",$J,"B",$E(MSG,1,60),NUM)=""
Q
;
MSG(NUM,USER,MSG) ;
N EMAIL,EVENT,LIST,LOC,METHOD,PERSON S OK=1,MSG=""
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)
I PERSON D Q
.I USER,USER'=PERSON Q
.S MSG=METHOD_" "_$$VALUE^FSCGET(PERSON,7100.2,3)_" when "_EVENT
I LIST D Q
.S PERSON=$P(^FSC("LIST",LIST,0),U,2),METHOD=$P(^(0),U,6),EVENT=$P(^(0),U,7)
.I 'PERSON Q
.I USER,USER'=PERSON Q
.S MSG=METHOD_" "_$$VALUE^FSCGET(PERSON,7100.2,3)_" (from list: "_$$VALUE^FSCGET(LIST,7100.2,1)_") when "_EVENT
I LOC D Q
.S PERSON=$P(^FSC("SITE",LOC,0),U,6),EMAIL=$P(^(0),U,10),METHOD=$P(^(0),U,4),EVENT=$P(^(0),U,5)
.I USER,USER'=PERSON Q
.I METHOD="MAIL" S PERSON=$S($L(EMAIL):EMAIL,PERSON:$$VALUE^FSCGET(PERSON,7100.2,3),1:"") I '$L(PERSON) Q
.S MSG=METHOD_" "_PERSON_" ("_$$VALUE^FSCGET(LOC,7100.2,2)_") when "_EVENT
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFSCNOT 2099 printed Dec 13, 2024@02:18:47 Page 2
FSCNOT ;SLC/STAFF NOIS Notification ;1/11/98 18:43
+1 ;;1.1;NOIS;;Sep 06, 1998
+2 ;
SETUP(CALL,LIST,LOC,USER,METHOD,EVENT) ; from FSCAFFIL, FSCEL, FSCLMPNB, FSCLP, FSCRPCN, FSCTASKU
+1 NEW DA,DIE,DR,NUM
+2 ; *** needs ok
LOCK +^FSCD("NOTIFY",0):30
IF '$TEST
QUIT
+3 SET NUM=1+$PIECE(^FSCD("NOTIFY",0),U,3)
+4 FOR
if '$DATA(^FSCD("NOTIFY",NUM,0))
QUIT
SET NUM=NUM+1
+5 SET $PIECE(^FSCD("NOTIFY",0),U,3)=NUM
SET $PIECE(^(0),U,4)=$PIECE(^(0),U,4)+1
+6 SET ^FSCD("NOTIFY",NUM,0)=CALL
SET ^FSCD("NOTIFY","B",CALL,NUM)=""
+7 LOCK -^FSCD("NOTIFY",0)
+8 SET DA=NUM
SET DIE=7100.2
SET DR=""
+9 Begin DoDot:1
+10 IF $GET(LIST)
SET DR=DR_"1///`"_LIST
QUIT
+11 IF $GET(LOC)
SET DR=DR_"2///`"_LOC
QUIT
+12 IF $GET(USER)
Begin DoDot:2
+13 SET DR=DR_"3///`"_+USER
+14 IF $PIECE(USER,U,2)
SET DR=DR_";6///1"
End DoDot:2
QUIT
End DoDot:1
+15 IF '$LENGTH(DR)
QUIT
+16 IF $LENGTH($GET(METHOD))
IF $LENGTH($GET(EVENT))
SET DR=DR_";4///"_METHOD_";5///"_EVENT
+17 ; *** needs ok
LOCK +^FSCD("NOTIFY",NUM):30
IF '$TEST
QUIT
+18 DO ^DIE
+19 LOCK -^FSCD("NOTIFY",NUM)
+20 QUIT
+21 ;
NOTINFO(CALL,USER) ; from FSCLMPNR, FSCLMPON, FSCRPCN, FSCRPCON
+1 ; returns ^TMP("FSC NOTIFY",$J,notification #) = msg
+2 ; ^TMP("FSC NOTIFY",$J,"B",msg,notification #) = ""
+3 NEW MSG,NUM
+4 SET NUM=0
FOR
SET NUM=$ORDER(^FSCD("NOTIFY","B",CALL,NUM))
if NUM<1
QUIT
Begin DoDot:1
+5 DO MSG(NUM,$GET(USER),.MSG)
+6 IF $LENGTH(MSG)
SET ^TMP("FSC NOTIFY",$JOB,NUM)=MSG
SET ^TMP("FSC NOTIFY",$JOB,"B",$EXTRACT(MSG,1,60),NUM)=""
End DoDot:1
+7 QUIT
+8 ;
MSG(NUM,USER,MSG) ;
+1 NEW EMAIL,EVENT,LIST,LOC,METHOD,PERSON
SET OK=1
SET MSG=""
+2 SET LIST=$PIECE(^FSCD("NOTIFY",NUM,0),U,2)
SET LOC=$PIECE(^(0),U,3)
SET PERSON=$PIECE(^(0),U,4)
SET METHOD=$PIECE(^(0),U,5)
SET EVENT=$PIECE(^(0),U,6)
+3 IF PERSON
Begin DoDot:1
+4 IF USER
IF USER'=PERSON
QUIT
+5 SET MSG=METHOD_" "_$$VALUE^FSCGET(PERSON,7100.2,3)_" when "_EVENT
End DoDot:1
QUIT
+6 IF LIST
Begin DoDot:1
+7 SET PERSON=$PIECE(^FSC("LIST",LIST,0),U,2)
SET METHOD=$PIECE(^(0),U,6)
SET EVENT=$PIECE(^(0),U,7)
+8 IF 'PERSON
QUIT
+9 IF USER
IF USER'=PERSON
QUIT
+10 SET MSG=METHOD_" "_$$VALUE^FSCGET(PERSON,7100.2,3)_" (from list: "_$$VALUE^FSCGET(LIST,7100.2,1)_") when "_EVENT
End DoDot:1
QUIT
+11 IF LOC
Begin DoDot:1
+12 SET PERSON=$PIECE(^FSC("SITE",LOC,0),U,6)
SET EMAIL=$PIECE(^(0),U,10)
SET METHOD=$PIECE(^(0),U,4)
SET EVENT=$PIECE(^(0),U,5)
+13 IF USER
IF USER'=PERSON
QUIT
+14 IF METHOD="MAIL"
SET PERSON=$SELECT($LENGTH(EMAIL):EMAIL,PERSON:$$VALUE^FSCGET(PERSON,7100.2,3),1:"")
IF '$LENGTH(PERSON)
QUIT
+15 SET MSG=METHOD_" "_PERSON_" ("_$$VALUE^FSCGET(LOC,7100.2,2)_") when "_EVENT
End DoDot:1
QUIT
+16 QUIT