source: FOIAVistA/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/_ZTLOAD3.m@ 1499

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

initial load of FOIAVistA 6/30/08 version

File size: 2.9 KB
Line 
1%ZTLOAD3 ;SEA/RDS - TaskMan: Task Requeue ;06/14/2001 09:49
2 ;;8.0;KERNEL;**67,127,136,192**;JUL 10, 1995
3 ;
4INPUT ;check for error conditions
5 N %H,%T,X,X1,Y,ZT,ZT1,ZT2,ZT3,ZTH,ZTL,ZTOS,ZTREC,ZTREC1,ZTREC2,ZTREC25
6 S ZTSK=$G(ZTSK) K ZTSK(0),ZTREQ ;Kill ZTREQ so we don't kill the entry
7 L +^%ZTSK(ZTSK) S ZTREC=$G(^%ZTSK(ZTSK,0)) I ZTREC="" G BAD
8 I $D(ZTDTH)#2,ZTDTH]"",ZTDTH'?1.5N1","1.5N,ZTDTH'?7N.".".N,ZTDTH'="@","SHD"'[$E(ZTDTH,$L(ZTDTH)) G BAD
9 ;
10DQ ;make sure task is not pending
11 D UNSCH^%ZTLOAD6
12 I $D(^%ZTSK(ZTSK,0))[0 G BAD
13 ;
14ZTDTH ;determine task's next start time
15 S:$P(ZTREC,"^",16)="" $P(ZTREC,"^",16)=$P(ZTREC,"^",5) ;Save original create time
16 S $P(ZTREC,"^",5)=$H ;Set a new create time
17 I $D(ZTDTH)[0 S ZTDTH=$P(ZTREC,"^",6) G ZTRTN ;Use original time.
18 I ZTDTH="" S ZTDTH=$H G ZTRTN
19 I ZTDTH?1.5N1","1.5N G ZTRTN
20 I ZTDTH?7N.".".N S ZTDTH=$$FMTH^%ZTLOAD7(ZTDTH) G ZTRTN
21 I ZTDTH="@" G ZTRTN
22 S ZTH=$$H3^%ZTM($P(ZTREC,"^",6)),ZTL=$E(ZTDTH,$L(ZTDTH)) ;From start time
23DT I ZTL="S" S ZTH=ZTH+ZTDTH
24 I ZTL="H" S ZTH=(ZTDTH*3600)+ZTH
25 I ZTL="D" S ZTH=(ZTDTH*86400)+ZTH
26DTX I ZTH<$$H3^%ZTM($H) G DT
27 S ZTDTH=$$H0^%ZTM(ZTH)
28 ;
29ZTRTN ;determine whether entry point should change
30 I $D(ZTRTN)[0 G ZTIO
31 I ZTRTN="" G ZTIO
32 I ZTRTN'[U S ZTRTN=U_ZTRTN
33 S ZT=$P(ZTREC,U,1,2)
34 I ZT'=ZTRTN S $P(ZTREC,U,1,2)=ZTRTN I ZT="ZTSK^XQ1" S $P(ZTREC,U,7,9)="R^^"
35 ;
36ZTIO ;determine whether i/o device should change
37 N ZTREC2,ZTREC25
38 S ZTREC2=$G(^%ZTSK(ZTSK,.2)),ZT=$P(ZTREC2,U)
39 I $D(ZTIO)[0 G ZTIO1
40 I ZTIO="" G ZTIO1
41 I $P(ZTIO,";")'=$P(ZT,";") S $P(ZTREC2,U,6)="",ZTREC25=""
42 I ZTIO="@" S $P(ZTREC2,U)="" G ZTIO1
43 I ZTIO'=ZT S $P(ZTREC2,U)=ZTIO
44 ;
45ZTIO1 ;set hunt group suppression flag
46 S $P(ZTREC2,U,5)=$S($D(ZTIO(1))[0:"",ZTIO(1)="D":"DIRECT",1:"")
47 ;
48ZTDESC ;determine whether description should change
49 I $S($D(ZTDESC)[0:1,ZTDESC="":1,1:0) S ZTDESC=$G(^%ZTSK(ZTSK,.03))
50 I ZTDESC=""!(ZTDESC="No Description (%ZTLOAD)") S ZTDESC="No Description (REQ~%ZTLOAD)"
51 S ^%ZTSK(ZTSK,.03)=ZTDESC
52 ;
53RECORD ;record changes in Task File entry
54 I $D(ZTREC2)#2 S ^%ZTSK(ZTSK,.2)=ZTREC2
55 I $D(ZTREC25)#2 S ^%ZTSK(ZTSK,.25)=ZTREC25
56 I ZTDTH'="@" S $P(ZTREC,U,6)=ZTDTH ;Reset the Scheduled time piece
57 S ^%ZTSK(ZTSK,0)=ZTREC
58 S $P(^%ZTSK(ZTSK,.1),U,1,3)=$S(ZTDTH'="@":"1^"_$H_"^REQUEUED",1:"H^"_$H_"^EDITED BUT NOT REQUEUED")
59 ;
60ZTSAVE ;See if new data to save
61 K %H,%T,X,X1,Y,ZT,ZT1,ZT2,ZT3,ZTH,ZTL,ZTOS,ZTREC,ZTREC1,ZTREC2,ZTREC25
62 K ZTDESC,ZTIO,ZTRTN
63 I $D(ZTSAVE) K:$G(ZTSAVE)="KILL" ^%ZTSK(ZTSK,.3) D ZTSAVE^%ZTLOAD1
64SCHED ;schedule task, cleanup, quit
65 I ZTDTH'="@" S ZT=$$H3^%ZTLOAD1(ZTDTH),^%ZTSK(ZTSK,.04)=ZT,^%ZTSCH(ZT,ZTSK)=""
66 K %X,%Y,X,X1,Y,ZT1,ZT2,ZT3,ZTDTH,ZTSAVE
67 L -^%ZTSK(ZTSK) S ZTSK(0)=1
68 Q
69 ;
70BAD L -^%ZTSK(ZTSK) S ZTSK(0)=0
71 Q
72REQP(ZT1) ;Reschedule a persistent task. Called from ZTM
73 N ZTSK,ZT2,ZT3,ZTDTH,ZTSAVE S ZTDTH=$H,ZTSK=ZT1
74 L +^%ZTSK(ZTSK):20 Q:'$T
75 I $D(^%ZTSK(ZTSK,0))[0 Q ;SEND ALERT TO USER
76 G SCHED
Note: See TracBrowser for help on using the repository browser.