FSCRPCN ;SLC/STAFF-NOIS RPC Notifications ;1/13/98 16:01
;;1.1;NOIS;;Sep 06, 1998
;
SIGNUP(IN,OUT) ; from FSCRPX (RPBSignupNotify)
N CALL,EVENT,LINE,METHOD,USER
S LINE=$G(^TMP("FSCRPC",$J,"INPUT",1))
S CALL=$P(LINE,U),METHOD=$P(LINE,U,2),EVENT=$P(LINE,U,3),USER=$P(LINE,U,4)
Q:'CALL Q:'$L(METHOD) Q:'$L(EVENT) Q:'USER
D SETUP^FSCNOT(CALL,,,USER_U_1,METHOD,EVENT)
Q
;
BE(IN,OUT) ; from FSCRPX (RPCBeNotified)
N CALL,EVENT,LINE,METHOD,NUM
S LINE=$G(^TMP("FSCRPC",$J,"INPUT",1))
S METHOD=$P(LINE,U,2),EVENT=$P(LINE,U,3)
Q:'$L(METHOD) Q:'$L(EVENT)
I $P(LINE,U) D
.S CALL=0 F S CALL=$O(^TMP("FSC CURRENT LIST",$J,"C",CALL)) Q:CALL<1 D CALLSET(CALL,METHOD,EVENT)
E D
.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)
Q
;
CALLSET(CALL,METHOD,EVENT) ;
N NUM
I $D(^FSCD("NOTIFY","ACUSER",CALL,DUZ)) S NUM=+^(DUZ) D Q
.S $P(^FSCD("NOTIFY",NUM,0),U,5,7)=METHOD_U_EVENT_U_1
D SETUP^FSCNOT(CALL,,,DUZ_U_1,METHOD,EVENT)
Q
;
FIND(IN,OUT) ; from FSCRPX (RPCFindNotification)
N LINE,USER
S LINE=$G(^TMP("FSCRPC",$J,"INPUT",1))
S USER=$P(LINE,U,2)
I 'USER Q
I $P(LINE,U) D ALL(USER)
E D ONLY(USER)
Q
;
ALL(USER) ;
N CALL,LNUM
K ^TMP("FSC LIST",$J),^TMP("FSC CURRENT LIST",$J)
D ALL^FSCLMPNF(USER)
S LNUM=0
S CALL="A" F S CALL=$O(^TMP("FSC LIST",$J,CALL),-1) Q:CALL<1 D
.S LNUM=LNUM+1
.S (^TMP("FSCRPC",$J,"OUTPUT",LNUM),^TMP("FSC CURRENT LIST",$J,LNUM+1000))=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
.S ^TMP("FSC CURRENT LIST",$J,"C",CALL)=LNUM+1000
K ^TMP("FSC LIST",$J)
Q
;
ONLY(USER) ;
N CALL,DONE,LNUM
K ^TMP("FSC LIST",$J)
S CALL=0 F S CALL=$O(^TMP("FSC CURRENT LIST",$J,"C",CALL)) Q:CALL<1 D
.I $D(^FSCD("NOTIFY","ACUSER",CALL,USER)) S ^TMP("FSC LIST",$J,CALL)="" Q
.S (DONE,LNUM)=0 F S LNUM=$O(^FSCD("NOTIFY","ACLIST",CALL,LNUM)) Q:LNUM<1 D Q:DONE
..I $D(^FSC("LIST","C",USER,LNUM)) S ^TMP("FSC LIST",$J,CALL)="",DONE=1
K ^TMP("FSC CURRENT LIST",$J)
S LNUM=0
S CALL="A" F S CALL=$O(^TMP("FSC LIST",$J,CALL),-1) Q:CALL<1 D
.S LNUM=LNUM+1
.S (^TMP("FSCRPC",$J,"OUTPUT",LNUM),^TMP("FSC CURRENT LIST",$J,LNUM+1000))=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
.S ^TMP("FSC CURRENT LIST",$J,"C",CALL)=LNUM+1000
K ^TMP("FSC LIST",$J)
Q
REMOVE(IN,OUT) ; from FSCRPX (RPCRemoveNotification)
N LINE
S LINE=$G(^TMP("FSCRPC",$J,"INPUT",1))
I '$L(LINE) Q
I +LINE=1 D REMLIST
E D REMCALLS
Q
REMLIST ;
N CALL,DA,DIK
S DIK="^FSCD(""NOTIFY"","
S CALL=0 F S CALL=$O(^TMP("FSC CURRENT LIST",$J,"C",CALL)) Q:CALL<1 D
.K ^TMP("FSC NOTIFY",$J)
.D NOTINFO^FSCNOT(CALL,DUZ)
.S DA=0 F S DA=$O(^TMP("FSC NOTIFY",$J,DA)) Q:DA<1 D ^DIK
K ^TMP("FSC NOTIFY",$J)
Q
;
REMCALLS ;
N CALL,DA,DIK,NUM
S DIK="^FSCD(""NOTIFY"","
S NUM=0 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S CALL=+^(NUM) I CALL D
.K ^TMP("FSC NOTIFY",$J)
.D NOTINFO^FSCNOT(CALL,DUZ)
.S DA=0 F S DA=$O(^TMP("FSC NOTIFY",$J,DA)) Q:DA<1 D ^DIK
K ^TMP("FSC NOTIFY",$J)
Q
;
NOTIFY(IN,OUT) ; from FSCRPX (RPCNotify)
N CALLFLAG,DELIVERY,LINE,METHOD,MSG,RECIP,YOURSELF K RECIP
S LINE=$G(^TMP("FSCRPC",$J,"INPUT",1))
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)
I '$L(METHOD) Q
D RECIP(.RECIP)
I 'YOURSELF S DELIVERY=""
E S RECIP(DUZ)=""
I METHOD="ALERT" D ALERT(CALLFLAG,DELIVERY,MSG,.RECIP)
I METHOD="MAIL" D MAIL(MSG,.RECIP)
Q
;
MAIL(XMSUB,XMY) ;
Q:'$D(XMSUB) I XMSUB[U S XMSUB=$$REPLACE^FSCRU(XMSUB,U,"~U~")
N CNT,LINE,NUM,XMTEXT,XMZ K ^TMP("FSC MAIL",$J)
S ^TMP("FSC MAIL",$J,1,0)=" "
S ^TMP("FSC MAIL",$J,2,0)=" *** NOIS INFORMATION ***"
S CNT=2
S NUM=1 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 I ^(NUM)="{Info}" Q
I NUM<1 Q
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
S XMTEXT="^TMP(""FSC MAIL"",$J,"
S XMY(DUZ)=""
D ^XMD I $G(XMZ) ; W !,"Message #",XMZ," sent." H 2
D KILL^XM K ^TMP("FSC MAIL",$J)
Q
;
ALERT(CALLFLAG,DELIVERY,XQAMSG,XQA) ;
N ALERT,CALL,NUM,XQADATA,XQAID,XQAROU
I $L(DELIVERY) S XQAMSG=XQAMSG_" from: Yourself, sent: "_$$FMTE^XLFDT(DT)
E S XQAMSG=XQAMSG_" from: "_$$VALUE^FSCGET(DUZ,7100,2.1)
I DELIVERY=DT S DELIVERY=""
D NEWALERT^FSCNOTS(DUZ,,XQAMSG,.ALERT,DELIVERY)
I CALLFLAG S CALL=0 F S CALL=$O(^TMP("FSC CURRENT LIST",$J,"C",CALL)) Q:CALL<1 D NEWSEND^FSCNAS(ALERT,CALL)
I 'CALLFLAG D
.S NUM=1 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 I ^(NUM)="{Info}" Q
.I NUM<1 Q
.F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S CALL=+^(NUM) I CALL D NEWSEND^FSCNAS(ALERT,CALL)
I DELIVERY Q
S XQADATA=ALERT,XQAROU="ALERT^FSCNAR",XQAID="FSC-M"
D SETUP^XQALERT
Q
;
RECIP(RECIP) ;
N LINE,NUM,OK
S NUM=1 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 I ^(NUM)="{SendTo}" Q
I NUM<1 Q
F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S LINE=^(NUM) Q:LINE="<<<>>>" Q:'$L(LINE) D
.I $L(LINE)>4,$E(LINE,1,2)="G." S OK=1
.E S LINE=+LINE S OK=1 I 'LINE S OK=0
.I OK S RECIP(LINE)=""
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFSCRPCN 5156 printed Nov 22, 2024@17:29:35 Page 2
FSCRPCN ;SLC/STAFF-NOIS RPC Notifications ;1/13/98 16:01
+1 ;;1.1;NOIS;;Sep 06, 1998
+2 ;
SIGNUP(IN,OUT) ; from FSCRPX (RPBSignupNotify)
+1 NEW CALL,EVENT,LINE,METHOD,USER
+2 SET LINE=$GET(^TMP("FSCRPC",$JOB,"INPUT",1))
+3 SET CALL=$PIECE(LINE,U)
SET METHOD=$PIECE(LINE,U,2)
SET EVENT=$PIECE(LINE,U,3)
SET USER=$PIECE(LINE,U,4)
+4 if 'CALL
QUIT
if '$LENGTH(METHOD)
QUIT
if '$LENGTH(EVENT)
QUIT
if 'USER
QUIT
+5 DO SETUP^FSCNOT(CALL,,,USER_U_1,METHOD,EVENT)
+6 QUIT
+7 ;
BE(IN,OUT) ; from FSCRPX (RPCBeNotified)
+1 NEW CALL,EVENT,LINE,METHOD,NUM
+2 SET LINE=$GET(^TMP("FSCRPC",$JOB,"INPUT",1))
+3 SET METHOD=$PIECE(LINE,U,2)
SET EVENT=$PIECE(LINE,U,3)
+4 if '$LENGTH(METHOD)
QUIT
if '$LENGTH(EVENT)
QUIT
+5 IF $PIECE(LINE,U)
Begin DoDot:1
+6 SET CALL=0
FOR
SET CALL=$ORDER(^TMP("FSC CURRENT LIST",$JOB,"C",CALL))
if CALL<1
QUIT
DO CALLSET(CALL,METHOD,EVENT)
End DoDot:1
+7 IF '$TEST
Begin DoDot:1
+8 SET NUM=1
FOR
SET NUM=$ORDER(^TMP("FSCRPC",$JOB,"INPUT",NUM))
if NUM<1
QUIT
SET CALL=+^(NUM)
IF CALL
DO CALLSET(CALL,METHOD,EVENT)
End DoDot:1
+9 QUIT
+10 ;
CALLSET(CALL,METHOD,EVENT) ;
+1 NEW NUM
+2 IF $DATA(^FSCD("NOTIFY","ACUSER",CALL,DUZ))
SET NUM=+^(DUZ)
Begin DoDot:1
+3 SET $PIECE(^FSCD("NOTIFY",NUM,0),U,5,7)=METHOD_U_EVENT_U_1
End DoDot:1
QUIT
+4 DO SETUP^FSCNOT(CALL,,,DUZ_U_1,METHOD,EVENT)
+5 QUIT
+6 ;
FIND(IN,OUT) ; from FSCRPX (RPCFindNotification)
+1 NEW LINE,USER
+2 SET LINE=$GET(^TMP("FSCRPC",$JOB,"INPUT",1))
+3 SET USER=$PIECE(LINE,U,2)
+4 IF 'USER
QUIT
+5 IF $PIECE(LINE,U)
DO ALL(USER)
+6 IF '$TEST
DO ONLY(USER)
+7 QUIT
+8 ;
ALL(USER) ;
+1 NEW CALL,LNUM
+2 KILL ^TMP("FSC LIST",$JOB),^TMP("FSC CURRENT LIST",$JOB)
+3 DO ALL^FSCLMPNF(USER)
+4 SET LNUM=0
+5 SET CALL="A"
FOR
SET CALL=$ORDER(^TMP("FSC LIST",$JOB,CALL),-1)
if CALL<1
QUIT
Begin DoDot:1
+6 SET LNUM=LNUM+1
+7 SET (^TMP("FSCRPC",$JOB,"OUTPUT",LNUM),^TMP("FSC CURRENT LIST",$JOB,LNUM+1000))=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
+8 SET ^TMP("FSC CURRENT LIST",$JOB,"C",CALL)=LNUM+1000
End DoDot:1
+9 KILL ^TMP("FSC LIST",$JOB)
+10 QUIT
+11 ;
ONLY(USER) ;
+1 NEW CALL,DONE,LNUM
+2 KILL ^TMP("FSC LIST",$JOB)
+3 SET CALL=0
FOR
SET CALL=$ORDER(^TMP("FSC CURRENT LIST",$JOB,"C",CALL))
if CALL<1
QUIT
Begin DoDot:1
+4 IF $DATA(^FSCD("NOTIFY","ACUSER",CALL,USER))
SET ^TMP("FSC LIST",$JOB,CALL)=""
QUIT
+5 SET (DONE,LNUM)=0
FOR
SET LNUM=$ORDER(^FSCD("NOTIFY","ACLIST",CALL,LNUM))
if LNUM<1
QUIT
Begin DoDot:2
+6 IF $DATA(^FSC("LIST","C",USER,LNUM))
SET ^TMP("FSC LIST",$JOB,CALL)=""
SET DONE=1
End DoDot:2
if DONE
QUIT
End DoDot:1
+7 KILL ^TMP("FSC CURRENT LIST",$JOB)
+8 SET LNUM=0
+9 SET CALL="A"
FOR
SET CALL=$ORDER(^TMP("FSC LIST",$JOB,CALL),-1)
if CALL<1
QUIT
Begin DoDot:1
+10 SET LNUM=LNUM+1
+11 SET (^TMP("FSCRPC",$JOB,"OUTPUT",LNUM),^TMP("FSC CURRENT LIST",$JOB,LNUM+1000))=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
+12 SET ^TMP("FSC CURRENT LIST",$JOB,"C",CALL)=LNUM+1000
End DoDot:1
+13 KILL ^TMP("FSC LIST",$JOB)
+14 QUIT
REMOVE(IN,OUT) ; from FSCRPX (RPCRemoveNotification)
+1 NEW LINE
+2 SET LINE=$GET(^TMP("FSCRPC",$JOB,"INPUT",1))
+3 IF '$LENGTH(LINE)
QUIT
+4 IF +LINE=1
DO REMLIST
+5 IF '$TEST
DO REMCALLS
+6 QUIT
REMLIST ;
+1 NEW CALL,DA,DIK
+2 SET DIK="^FSCD(""NOTIFY"","
+3 SET CALL=0
FOR
SET CALL=$ORDER(^TMP("FSC CURRENT LIST",$JOB,"C",CALL))
if CALL<1
QUIT
Begin DoDot:1
+4 KILL ^TMP("FSC NOTIFY",$JOB)
+5 DO NOTINFO^FSCNOT(CALL,DUZ)
+6 SET DA=0
FOR
SET DA=$ORDER(^TMP("FSC NOTIFY",$JOB,DA))
if DA<1
QUIT
DO ^DIK
End DoDot:1
+7 KILL ^TMP("FSC NOTIFY",$JOB)
+8 QUIT
+9 ;
REMCALLS ;
+1 NEW CALL,DA,DIK,NUM
+2 SET DIK="^FSCD(""NOTIFY"","
+3 SET NUM=0
FOR
SET NUM=$ORDER(^TMP("FSCRPC",$JOB,"INPUT",NUM))
if NUM<1
QUIT
SET CALL=+^(NUM)
IF CALL
Begin DoDot:1
+4 KILL ^TMP("FSC NOTIFY",$JOB)
+5 DO NOTINFO^FSCNOT(CALL,DUZ)
+6 SET DA=0
FOR
SET DA=$ORDER(^TMP("FSC NOTIFY",$JOB,DA))
if DA<1
QUIT
DO ^DIK
End DoDot:1
+7 KILL ^TMP("FSC NOTIFY",$JOB)
+8 QUIT
+9 ;
NOTIFY(IN,OUT) ; from FSCRPX (RPCNotify)
+1 NEW CALLFLAG,DELIVERY,LINE,METHOD,MSG,RECIP,YOURSELF
KILL RECIP
+2 SET LINE=$GET(^TMP("FSCRPC",$JOB,"INPUT",1))
+3 SET CALLFLAG=$PIECE(LINE,U)
SET METHOD=$PIECE(LINE,U,2)
SET YOURSELF=$PIECE(LINE,U,3)
SET DELIVERY=$PIECE(LINE,U,4)
SET MSG=$PIECE(LINE,U,5,99)
+4 IF '$LENGTH(METHOD)
QUIT
+5 DO RECIP(.RECIP)
+6 IF 'YOURSELF
SET DELIVERY=""
+7 IF '$TEST
SET RECIP(DUZ)=""
+8 IF METHOD="ALERT"
DO ALERT(CALLFLAG,DELIVERY,MSG,.RECIP)
+9 IF METHOD="MAIL"
DO MAIL(MSG,.RECIP)
+10 QUIT
+11 ;
MAIL(XMSUB,XMY) ;
+1 if '$DATA(XMSUB)
QUIT
IF XMSUB[U
SET XMSUB=$$REPLACE^FSCRU(XMSUB,U,"~U~")
+2 NEW CNT,LINE,NUM,XMTEXT,XMZ
KILL ^TMP("FSC MAIL",$JOB)
+3 SET ^TMP("FSC MAIL",$JOB,1,0)=" "
+4 SET ^TMP("FSC MAIL",$JOB,2,0)=" *** NOIS INFORMATION ***"
+5 SET CNT=2
+6 SET NUM=1
FOR
SET NUM=$ORDER(^TMP("FSCRPC",$JOB,"INPUT",NUM))
if NUM<1
QUIT
IF ^(NUM)="{Info}"
QUIT
+7 IF NUM<1
QUIT
+8 FOR
SET NUM=$ORDER(^TMP("FSCRPC",$JOB,"INPUT",NUM))
if NUM<1
QUIT
SET LINE=^(NUM)
if LINE="<<<>>>"
QUIT
SET CNT=CNT+1
SET ^TMP("FSC MAIL",$JOB,CNT,0)=LINE
+9 SET XMTEXT="^TMP(""FSC MAIL"",$J,"
+10 SET XMY(DUZ)=""
+11 ; W !,"Message #",XMZ," sent." H 2
DO ^XMD
IF $GET(XMZ)
+12 DO KILL^XM
KILL ^TMP("FSC MAIL",$JOB)
+13 QUIT
+14 ;
ALERT(CALLFLAG,DELIVERY,XQAMSG,XQA) ;
+1 NEW ALERT,CALL,NUM,XQADATA,XQAID,XQAROU
+2 IF $LENGTH(DELIVERY)
SET XQAMSG=XQAMSG_" from: Yourself, sent: "_$$FMTE^XLFDT(DT)
+3 IF '$TEST
SET XQAMSG=XQAMSG_" from: "_$$VALUE^FSCGET(DUZ,7100,2.1)
+4 IF DELIVERY=DT
SET DELIVERY=""
+5 DO NEWALERT^FSCNOTS(DUZ,,XQAMSG,.ALERT,DELIVERY)
+6 IF CALLFLAG
SET CALL=0
FOR
SET CALL=$ORDER(^TMP("FSC CURRENT LIST",$JOB,"C",CALL))
if CALL<1
QUIT
DO NEWSEND^FSCNAS(ALERT,CALL)
+7 IF 'CALLFLAG
Begin DoDot:1
+8 SET NUM=1
FOR
SET NUM=$ORDER(^TMP("FSCRPC",$JOB,"INPUT",NUM))
if NUM<1
QUIT
IF ^(NUM)="{Info}"
QUIT
+9 IF NUM<1
QUIT
+10 FOR
SET NUM=$ORDER(^TMP("FSCRPC",$JOB,"INPUT",NUM))
if NUM<1
QUIT
SET CALL=+^(NUM)
IF CALL
DO NEWSEND^FSCNAS(ALERT,CALL)
End DoDot:1
+11 IF DELIVERY
QUIT
+12 SET XQADATA=ALERT
SET XQAROU="ALERT^FSCNAR"
SET XQAID="FSC-M"
+13 DO SETUP^XQALERT
+14 QUIT
+15 ;
RECIP(RECIP) ;
+1 NEW LINE,NUM,OK
+2 SET NUM=1
FOR
SET NUM=$ORDER(^TMP("FSCRPC",$JOB,"INPUT",NUM))
if NUM<1
QUIT
IF ^(NUM)="{SendTo}"
QUIT
+3 IF NUM<1
QUIT
+4 FOR
SET NUM=$ORDER(^TMP("FSCRPC",$JOB,"INPUT",NUM))
if NUM<1
QUIT
SET LINE=^(NUM)
if LINE="<<<>>>"
QUIT
if '$LENGTH(LINE)
QUIT
Begin DoDot:1
+5 IF $LENGTH(LINE)>4
IF $EXTRACT(LINE,1,2)="G."
SET OK=1
+6 IF '$TEST
SET LINE=+LINE
SET OK=1
IF 'LINE
SET OK=0
+7 IF OK
SET RECIP(LINE)=""
End DoDot:1
+8 QUIT
+9 ;