[613] | 1 | XMJMD ;ISC-SF/GMB-Later Messages ;12/04/2002 13:46
|
---|
| 2 | ;;8.0;MailMan;**10**;Jun 28, 2002
|
---|
| 3 | ; Replaces ^XMB1 (ISC-WASH/THM/CAP)
|
---|
| 4 | ; Entry points are:
|
---|
| 5 | ; EDIT Change/Delete Later'd messages for a particular user
|
---|
| 6 | ; REPORT Report on Later'd messages for a particular user
|
---|
| 7 | ; LATER Add/Edit Later'd Dates for a particular user/message
|
---|
| 8 | ; LTRADD Add Later'd delivery date for a particular user/message
|
---|
| 9 | ; DELUSER Delete all Later'd messages for a particular user
|
---|
| 10 | ; DELMSG Delete all Later'd dates for a particular message
|
---|
| 11 | ;
|
---|
| 12 | ; Entry points used by MailMan options (not covered by DBIA):
|
---|
| 13 | ; EDIT XMLATER-EDIT
|
---|
| 14 | ; REPORT XMLATER-REPORT
|
---|
| 15 | REPORT ; Report on later'd messages
|
---|
| 16 | N ZTSAVE,ZTDESC,ZTRTN,I
|
---|
| 17 | D CHECK^XMVVITAE
|
---|
| 18 | S ZTDESC=$$EZBLD^DIALOG(34639) ; MailMan: Report on Later'd Messages
|
---|
| 19 | S ZTRTN="RPTLATER^XMJMD"
|
---|
| 20 | F I="XMDUZ","XMV(""NAME"")" S ZTSAVE(I)=""
|
---|
| 21 | D EN^XUTMDEVQ(ZTRTN,ZTDESC,.ZTSAVE)
|
---|
| 22 | Q
|
---|
| 23 | RPTLATER ;
|
---|
| 24 | ; XMDUZ,XMV("NAME") are provided
|
---|
| 25 | N XMZ,XMABORT,XMWHEN,XMIEN,XMREC,XMZREC,XMPAGE,XMLEN,XMK,XMKN
|
---|
| 26 | S XMLEN("DATE")=$L($$FMTE^XLFDT($E($$NOW^XLFDT,1,12),"5Z"))
|
---|
| 27 | S XMLEN("XMZ")=$L($O(^XMB(3.9,":"),-1))
|
---|
| 28 | S:XMLEN("XMZ")<7 XMLEN("XMZ")=7
|
---|
| 29 | S XMLEN("BSKT")=10
|
---|
| 30 | S XMLEN("SUBJ")=79-XMLEN("DATE")-XMLEN("XMZ")-XMLEN("BSKT")-6
|
---|
| 31 | S (XMPAGE,XMABORT)=0
|
---|
| 32 | W:$E(IOST,1,2)="C-" @IOF
|
---|
| 33 | D RPTHDR(.XMLEN,.XMPAGE)
|
---|
| 34 | S XMIEN=""
|
---|
| 35 | F S XMIEN=$O(^XMB(3.73,"C",XMDUZ,XMIEN)) Q:XMIEN="" D Q:XMABORT
|
---|
| 36 | . S XMREC=$G(^XMB(3.73,XMIEN,0)) I XMREC="" K ^XMB(3.73,"C",XMDUZ,XMIEN) Q
|
---|
| 37 | . S XMZ=+$P(XMREC,U,3)
|
---|
| 38 | . S XMZREC=$G(^XMB(3.9,XMZ,0)) I XMZREC="" D DELDATE(XMIEN) Q
|
---|
| 39 | . S XMWHEN=$P(XMREC,U,1)
|
---|
| 40 | . S XMK=$O(^XMB(3.7,"M",XMZ,XMDUZ,""))
|
---|
| 41 | . S XMKN=$S('XMK:$$EZBLD^DIALOG(34014),1:$P($G(^XMB(3.7,XMDUZ,2,XMK,0)),U)) ; * N/A *
|
---|
| 42 | . I $Y+3>IOSL D Q:XMABORT
|
---|
| 43 | . . I $E(IOST,1,2)="C-" D PAGE^XMXUTIL(.XMABORT) Q:XMABORT
|
---|
| 44 | . . W @IOF D RPTHDR(.XMLEN,.XMPAGE)
|
---|
| 45 | . W !,$$LJ^XLFSTR($$FMTE^XLFDT($E(XMWHEN,1,12),"5Z"),XMLEN("DATE"))," ",$$LJ^XLFSTR($E(XMKN,1,XMLEN("BSKT")),XMLEN("BSKT"))," ",$J(XMZ,XMLEN("XMZ"))," ",$E($$SUBJ^XMXUTIL2(XMZREC),1,XMLEN("SUBJ"))
|
---|
| 46 | W:$O(^XMB(3.73,"C",XMDUZ,""))="" !,$$EZBLD^DIALOG(34630) ; No Later'd Messages
|
---|
| 47 | I $E(IOST,1,2)="C-",'XMABORT D WAIT^XMXUTIL
|
---|
| 48 | I $D(ZTQUEUED) S ZTREQ="@"
|
---|
| 49 | Q
|
---|
| 50 | RPTHDR(XMLEN,XMPAGE) ;
|
---|
| 51 | S XMPAGE=XMPAGE+1
|
---|
| 52 | W $$EZBLD^DIALOG(34631,XMV("NAME")),?70,$$EZBLD^DIALOG(34542,XMPAGE) ; Later'd Messages Report for: / Page
|
---|
| 53 | W !,$$LJ^XLFSTR($$EZBLD^DIALOG(34632),XMLEN("DATE"))," ",$$LJ^XLFSTR($$EZBLD^DIALOG(34011),XMLEN("BSKT"))," ",$$RJ^XLFSTR($$EZBLD^DIALOG(34633),XMLEN("XMZ"))," ",$$EZBLD^DIALOG(34002) ; Date / Basket / Msg ID / Subject
|
---|
| 54 | W !,$$REPEAT^XLFSTR("-",79)
|
---|
| 55 | Q
|
---|
| 56 | DELUSER(XMDUZ) ; Delete all Later'd messages for a particular user
|
---|
| 57 | N XMIEN
|
---|
| 58 | S XMIEN=""
|
---|
| 59 | F S XMIEN=$O(^XMB(3.73,"C",XMDUZ,XMIEN)) Q:XMIEN="" D DELDATE(XMIEN)
|
---|
| 60 | Q
|
---|
| 61 | DELDATE(XMIEN) ; Delete a particular Later'd message date
|
---|
| 62 | N DIK
|
---|
| 63 | S DIK="^XMB(3.73,",DA=XMIEN
|
---|
| 64 | D ^DIK
|
---|
| 65 | Q
|
---|
| 66 | DELMSG(XMZ) ; Delete all Later'd dates for a particular message
|
---|
| 67 | N XMDUZ,XMIEN
|
---|
| 68 | S (XMDUZ,XMIEN)=""
|
---|
| 69 | F S XMDUZ=$O(^XMB(3.73,"AC",XMZ,XMDUZ)) Q:XMDUZ="" D
|
---|
| 70 | . F S XMIEN=$O(^XMB(3.73,"AC",XMZ,XMDUZ,XMIEN)) Q:XMIEN="" D DELDATE(XMIEN)
|
---|
| 71 | Q
|
---|
| 72 | LATER(XMDUZ,XMZ) ; For a particular message,
|
---|
| 73 | ; let user edit any existing latered times or add a new one.
|
---|
| 74 | N XMABORT,XMWHEN
|
---|
| 75 | S XMABORT=0
|
---|
| 76 | I $D(^XMB(3.73,"AC",XMZ,XMDUZ)) D
|
---|
| 77 | . W @IOF
|
---|
| 78 | . D LATER^XMJMQ1(XMDUZ,XMZ,"","","","",.XMABORT)
|
---|
| 79 | . S XMABORT=0
|
---|
| 80 | . N DIR,XMIEN,XMADD,XMCHG,XMDEL
|
---|
| 81 | . S XMIEN=$O(^XMB(3.73,"AC",XMZ,XMDUZ,0))
|
---|
| 82 | . I $O(^XMB(3.73,"AC",XMZ,XMDUZ,XMIEN)) S XMIEN=0
|
---|
| 83 | . S XMADD=$$EZBLD^DIALOG(34634) ; A:Add another date on which this message should appear new
|
---|
| 84 | . S XMCHG=$$EZBLD^DIALOG($S(XMIEN:34635,1:34635.1)) ; C:Change this / a date
|
---|
| 85 | . S XMDEL=$$EZBLD^DIALOG($S(XMIEN:34636,1:34636.1)) ; D:Delete this / a date
|
---|
| 86 | . S DIR(0)="SO^"_XMADD_";"_XMCHG_";"_XMDEL
|
---|
| 87 | . D ^DIR I $D(DIRUT) S XMABORT=1 Q
|
---|
| 88 | . I Y=$P(XMADD,":",1) D Q
|
---|
| 89 | . . D LTRDATE(.XMWHEN,.XMABORT) Q:XMABORT
|
---|
| 90 | . . D LTRADD(XMDUZ,XMZ,XMWHEN)
|
---|
| 91 | . I 'XMIEN D WHICH(XMDUZ,XMZ,.XMIEN,.XMABORT) Q:XMABORT
|
---|
| 92 | . I Y=$P(XMCHG,":",1) D CHGDATE(XMIEN) Q
|
---|
| 93 | . D DELDATE(XMIEN) ; Delete this date
|
---|
| 94 | . W $$EZBLD^DIALOG(34637) ; " ... deleted."
|
---|
| 95 | E D
|
---|
| 96 | . D LTRDATE(.XMWHEN,.XMABORT) Q:XMABORT
|
---|
| 97 | . D LTRADD(XMDUZ,XMZ,XMWHEN)
|
---|
| 98 | Q
|
---|
| 99 | EDIT ; Change/delete later'd messages
|
---|
| 100 | I '$D(^XMB(3.73,"C",XMDUZ)) W !!,$C(7),$$EZBLD^DIALOG(34638) Q ; You have no Later'd messages.
|
---|
| 101 | D LTREDIT($G(XMDUZ,DUZ))
|
---|
| 102 | Q
|
---|
| 103 | LTREDIT(XMDUZ,XMZ) ;
|
---|
| 104 | N X,Y,XMIEN,XMDEL,DIR,DIE,DR,DA,DIRUT,XMABORT
|
---|
| 105 | S XMABORT=0
|
---|
| 106 | D WHICH(XMDUZ,.XMZ,.XMIEN,.XMABORT) Q:XMABORT
|
---|
| 107 | ; The user has chosen a record to edit (and change the later'd date)
|
---|
| 108 | S XMDEL=$$EZBLD^DIALOG(34636) ; D:Delete this date
|
---|
| 109 | S DIR(0)="S^"_$$EZBLD^DIALOG(34635)_";"_XMDEL ; C:Change this date
|
---|
| 110 | D ^DIR Q:$D(DIRUT)
|
---|
| 111 | I Y=$P(XMDEL,":",1) D Q
|
---|
| 112 | . D DELDATE(XMIEN) ; Delete this date
|
---|
| 113 | . W $$EZBLD^DIALOG(34637) ; " ... deleted."
|
---|
| 114 | K DIR,X,Y,DIRUT
|
---|
| 115 | D CHGDATE(XMIEN) ; Change this date
|
---|
| 116 | Q
|
---|
| 117 | WHICH(XMDUZ,XMZ,XMIEN,XMABORT) ;
|
---|
| 118 | N DIC,D,X,Y
|
---|
| 119 | W !
|
---|
| 120 | S DIC="^XMB(3.73,"
|
---|
| 121 | S DIC(0)="NEU"
|
---|
| 122 | S D="C"
|
---|
| 123 | I $D(XMZ) S DIC("S")="I $D(^XMB(3.73,""AC"","_XMZ_","_$G(XMDUZ,DUZ)_",Y))"
|
---|
| 124 | E S DIC("S")="I $D(^XMB(3.73,""C"","_$G(XMDUZ,DUZ)_",Y))"
|
---|
| 125 | S X=$G(XMDUZ,DUZ)
|
---|
| 126 | D IX^DIC I Y=-1 S XMABORT=1 Q
|
---|
| 127 | S XMIEN=+Y
|
---|
| 128 | Q
|
---|
| 129 | CHGDATE(DA) ; Change a date
|
---|
| 130 | N DIE,DR,DIDEL
|
---|
| 131 | S DIDEL=3.73
|
---|
| 132 | S DIE=3.73
|
---|
| 133 | S DR=.01
|
---|
| 134 | D ^DIE
|
---|
| 135 | Q
|
---|
| 136 | LTRDATE(Y,XMABORT) ;
|
---|
| 137 | N DIR
|
---|
| 138 | S DIR(0)="3.73,.01"
|
---|
| 139 | S DIR("B")="T+1"
|
---|
| 140 | D ^DIR I $D(DIRUT) S XMABORT=1 Q
|
---|
| 141 | Q
|
---|
| 142 | LTRADD(XMDUZ,XMZ,XMWHEN) ;
|
---|
| 143 | N XMFDA
|
---|
| 144 | Q:$D(^XMB(3.73,"AB",XMWHEN,XMDUZ,XMZ)) ; Already scheduled?
|
---|
| 145 | S XMFDA(3.73,"+1,",.01)=XMWHEN
|
---|
| 146 | ;S XMFDA(3.73,"+1,",1)=XMDUZ Not needed, because done by trigger
|
---|
| 147 | S XMFDA(3.73,"+1,",2)=XMZ
|
---|
| 148 | D UPDATE^DIE("","XMFDA")
|
---|
| 149 | Q
|
---|