VistA-WorldVistAEHR/r/NOIS-FSC/FSCTASKU.m

53 lines
1.6 KiB
Mathematica

FSCTASKU ;SLC/STAFF-NOIS Task Update ;1/17/98 16:52
;;1.1;NOIS;;Sep 06, 1998
;
UPDATE ; dequeued from FSCTASK
; FSCCALL is saved
I $D(ZTQUEUED) S ZTREQ="@"
S FSCDEV=1
D UPDATE^FSCTASKA(FSCCALL)
D LOCATION(FSCCALL)
D SPEC(FSCCALL)
D AFFL(FSCCALL)
D UPDATE^FSCLP(FSCCALL)
D NOTIFY^FSCNOTS(FSCCALL)
Q
;
LOCATION(CALL) ;
N LOC,STATUS
S LOC=$P(^FSCD("CALL",CALL,0),U,5),STATUS=$P(^(0),U,2)
Q:'$L($P(^FSC("SITE",LOC,0),U,4)) I $P(^(0),U,5)="CLOSED",STATUS'=2 Q
I $D(^FSCD("NOTIFY","ACLOC",CALL,LOC)) Q
D SETUP^FSCNOT(CALL,,LOC)
Q
;
SPEC(CALL) ;
N EVENT,METHOD,SPEC
S SPEC=$P(^FSCD("CALL",CALL,0),U,9) I 'SPEC Q
S METHOD=$P(^FSC("SPEC",SPEC,0),U,14),EVENT=$P(^(0),U,15) Q:'$L(METHOD) Q:'$L(EVENT)
I $D(^FSCD("NOTIFY","ACUSER",CALL,SPEC)) Q
D SETUP^FSCNOT(CALL,,,SPEC,METHOD,EVENT)
Q
;
AFFL(CALL) ; from FSCTASKA
N MISC,ONETW,PACK,PACKGP,RTD,ZERO
S ZERO=$G(^FSCD("CALL",CALL,0)),ONETW=$G(^(120))
S PACK=$P(ONETW,U,9),PACKGP=$P(ONETW,U,13),MISC=$S($P(ZERO,U,10)=5:1,1:""),RTD=$S($P(ZERO,U,17):1,1:"")
I RTD D AFFLCHK(CALL,2,PACK,PACKGP)
I 'MISC D AFFLCHK(CALL,1,PACK,PACKGP)
Q
;
AFFLCHK(CALL,TYPE,PACK,PACKGP) ;
N EVENT,METHOD,USER
S USER=0 F S USER=$O(^FSC("SPEC","AF",TYPE,USER)) Q:USER'>0 D
.I $$CHECK(CALL,USER,PACK,PACKGP) D
..S METHOD=$P(^FSC("SPEC",USER,0),U,14),EVENT=$P(^(0),U,15) Q:'$L(METHOD) Q:'$L(EVENT)
..D SETUP^FSCNOT(CALL,,,USER,METHOD,EVENT)
Q
;
CHECK(CALL,USER,PACK,PACKGP) ; $$(call,user,package,package group) -> 0 or 1 if ok to tag for notify
I $D(^FSCD("NOTIFY","ACUSER",CALL,USER)) Q 0
I PACKGP,$P($G(^FSC("SPEC",USER,20,+$O(^FSC("SPEC","AG",PACKGP,USER,0)),0)),U,3) Q 1
I PACK,$O(^FSC("SPEC","AP",PACK,USER,0)) Q 1
Q 0