FSCTASKN ;SLC/STAFF-NOIS Task Notification ;1/13/98 17:11
;;1.1;NOIS;;Sep 06, 1998
;
NOTIFY ; from FSCTASKA
N ADDRESS,ARRAY,CALL,DA,DIK,EVENT,LIST,LISTNAME,METHOD,MSG,NOTIFY,NUM,USER K ARRAY
S LIST=0 F S LIST=$O(^FSC("LIST","AU","A",LIST)) Q:LIST<1 D
.Q:$P($G(^FSC("LIST",LIST,0)),U,7)'="ADDED" Q:'$L($P(^(0),U,6)) S LISTNAME=$P(^(0),U)
.S NUM=0 F S NUM=$O(^FSCD("NOTIFY","ALIST",LIST,NUM)) Q:NUM<1 D
..S NOTIFY=$G(^FSCD("NOTIFY",NUM,0)),CALL=+NOTIFY I 'CALL Q
..D GET^FSCNOTS(NOTIFY,.USER,.METHOD,.EVENT,.ADDRESS)
..S MSG="Call added to "_LISTNAME_" "_$$FMTE^XLFDT(DT)_"."
..D
...I METHOD="MAIL" D Q
....I $L(ADDRESS) S ARRAY(ADDRESS)="",ARRAY(ADDRESS,1)="I" Q
....S ARRAY(USER)="",ARRAY(USER,1)="I"
...I METHOD="ALERT" D ALERT^FSCNOTS(CALL,USER,MSG) Q
..S DA=NUM,DIK="^FSCD(""NOTIFY""," D ^DIK
..I $L($O(ARRAY(0))) D MAIL^FSCNOTS(CALL,.ARRAY,MSG) K ARRAY
Q
;
CHKALERT ; from FSCTASKA
N USER
S USER=0 F S USER=$O(^FSCD("ALERT","ALERT",USER)) Q:USER'>0 D NEWALERT(USER)
Q
;
NEWALERT(USER) ;
N XQA,XQADATA,XQAID,XQAMSG,XQAROU K XQA,^TMP("FSC CHKALERT",$J)
D USER^XQALERT("^TMP(""FSC CHKALERT"",$J)",USER,2900101)
I '$O(^TMP("FSC CHKALERT",$J,0))!'$O(^XTV(8992,USER,"XQA",0)) D
.S XQA(USER)="",XQADATA="",XQAMSG="NOIS Calls",XQAROU="USER^FSCNAR",XQAID="FSC-A"
.D SETUP^XQALERT
K ^TMP("FSC CHKALERT",$J)
Q
;
DELIVERY(UPDATE) ; from FSCTASKA
N ALERT,DA,DATE,DIE,DR,NUM,XQA,XQADATA,XQAID,XQAMSG,XQAROU K XQA
S XQAROU="ALERT^FSCNAR",DIE="^FSCD(""ALERT"","
S DATE=0 F S DATE=$O(^FSCD("ALERT","AD",DATE)) Q:DATE<1 Q:DATE>UPDATE D
.S NUM=0 F S NUM=$O(^FSCD("ALERT","AD",DATE,NUM)) Q:NUM<1 D
..S ALERT=$G(^FSCD("ALERT",NUM,0)) I '$L(ALERT) Q
..I $P(ALERT,U,4) Q
..S DA=NUM,DR="3///"_$$NOW^XLFDT_";4///@"
..L +^FSCD("ALERT",NUM,0):30 I '$T Q ; *** skip
..D ^DIE
..L -^FSCD("ALERT",NUM,0)
..S XQAROU="ALERT^FSCNAR",XQADATA=NUM,XQA(+ALERT)="",XQAMSG=$P(ALERT,U,3),XQAID="FSC-A"
..I $O(XQA(0)) D SETUP^XQALERT
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFSCTASKN 2005 printed Oct 16, 2024@18:20:55 Page 2
FSCTASKN ;SLC/STAFF-NOIS Task Notification ;1/13/98 17:11
+1 ;;1.1;NOIS;;Sep 06, 1998
+2 ;
NOTIFY ; from FSCTASKA
+1 NEW ADDRESS,ARRAY,CALL,DA,DIK,EVENT,LIST,LISTNAME,METHOD,MSG,NOTIFY,NUM,USER
KILL ARRAY
+2 SET LIST=0
FOR
SET LIST=$ORDER(^FSC("LIST","AU","A",LIST))
if LIST<1
QUIT
Begin DoDot:1
+3 if $PIECE($GET(^FSC("LIST",LIST,0)),U,7)'="ADDED"
QUIT
if '$LENGTH($PIECE(^(0),U,6))
QUIT
SET LISTNAME=$PIECE(^(0),U)
+4 SET NUM=0
FOR
SET NUM=$ORDER(^FSCD("NOTIFY","ALIST",LIST,NUM))
if NUM<1
QUIT
Begin DoDot:2
+5 SET NOTIFY=$GET(^FSCD("NOTIFY",NUM,0))
SET CALL=+NOTIFY
IF 'CALL
QUIT
+6 DO GET^FSCNOTS(NOTIFY,.USER,.METHOD,.EVENT,.ADDRESS)
+7 SET MSG="Call added to "_LISTNAME_" "_$$FMTE^XLFDT(DT)_"."
+8 Begin DoDot:3
+9 IF METHOD="MAIL"
Begin DoDot:4
+10 IF $LENGTH(ADDRESS)
SET ARRAY(ADDRESS)=""
SET ARRAY(ADDRESS,1)="I"
QUIT
+11 SET ARRAY(USER)=""
SET ARRAY(USER,1)="I"
End DoDot:4
QUIT
+12 IF METHOD="ALERT"
DO ALERT^FSCNOTS(CALL,USER,MSG)
QUIT
End DoDot:3
+13 SET DA=NUM
SET DIK="^FSCD(""NOTIFY"","
DO ^DIK
+14 IF $LENGTH($ORDER(ARRAY(0)))
DO MAIL^FSCNOTS(CALL,.ARRAY,MSG)
KILL ARRAY
End DoDot:2
End DoDot:1
+15 QUIT
+16 ;
CHKALERT ; from FSCTASKA
+1 NEW USER
+2 SET USER=0
FOR
SET USER=$ORDER(^FSCD("ALERT","ALERT",USER))
if USER'>0
QUIT
DO NEWALERT(USER)
+3 QUIT
+4 ;
NEWALERT(USER) ;
+1 NEW XQA,XQADATA,XQAID,XQAMSG,XQAROU
KILL XQA,^TMP("FSC CHKALERT",$JOB)
+2 DO USER^XQALERT("^TMP(""FSC CHKALERT"",$J)",USER,2900101)
+3 IF '$ORDER(^TMP("FSC CHKALERT",$JOB,0))!'$ORDER(^XTV(8992,USER,"XQA",0))
Begin DoDot:1
+4 SET XQA(USER)=""
SET XQADATA=""
SET XQAMSG="NOIS Calls"
SET XQAROU="USER^FSCNAR"
SET XQAID="FSC-A"
+5 DO SETUP^XQALERT
End DoDot:1
+6 KILL ^TMP("FSC CHKALERT",$JOB)
+7 QUIT
+8 ;
DELIVERY(UPDATE) ; from FSCTASKA
+1 NEW ALERT,DA,DATE,DIE,DR,NUM,XQA,XQADATA,XQAID,XQAMSG,XQAROU
KILL XQA
+2 SET XQAROU="ALERT^FSCNAR"
SET DIE="^FSCD(""ALERT"","
+3 SET DATE=0
FOR
SET DATE=$ORDER(^FSCD("ALERT","AD",DATE))
if DATE<1
QUIT
if DATE>UPDATE
QUIT
Begin DoDot:1
+4 SET NUM=0
FOR
SET NUM=$ORDER(^FSCD("ALERT","AD",DATE,NUM))
if NUM<1
QUIT
Begin DoDot:2
+5 SET ALERT=$GET(^FSCD("ALERT",NUM,0))
IF '$LENGTH(ALERT)
QUIT
+6 IF $PIECE(ALERT,U,4)
QUIT
+7 SET DA=NUM
SET DR="3///"_$$NOW^XLFDT_";4///@"
+8 ; *** skip
LOCK +^FSCD("ALERT",NUM,0):30
IF '$TEST
QUIT
+9 DO ^DIE
+10 LOCK -^FSCD("ALERT",NUM,0)
+11 SET XQAROU="ALERT^FSCNAR"
SET XQADATA=NUM
SET XQA(+ALERT)=""
SET XQAMSG=$PIECE(ALERT,U,3)
SET XQAID="FSC-A"
+12 IF $ORDER(XQA(0))
DO SETUP^XQALERT
End DoDot:2
End DoDot:1
+13 QUIT