VistA-WorldVistAEHR/r/MAILMAN-XM/XMXPRT.m

62 lines
2.4 KiB
Mathematica

XMXPRT ;ISC-SF/GMB-Print messages ;12/04/2002 13:52
;;8.0;MailMan;**10**;Jun 28, 2002
; For messages printed to the P-MESSAGE device,
; XMAPSUBJ = message subject
; XMY = message addressees
PRINT1(XMDUZ,XMZ,XMPRTTO,XMINSTR,ZTSK,XMAPSUBJ,XMY) ; Print one message
N XMWHICH,XMRECIPS,XMPRTHDR,ZTSAVE,ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTUCI
D PINIT(.XMINSTR,.XMPRTHDR,.XMRECIPS,.XMWHICH,.ZTDTH)
F I="XMV(","DUZ","XMDUZ","XMZ","XMWHICH","XMRECIPS","XMPRTHDR","XMAPSUBJ","XMY(" S ZTSAVE(I)=""
;S:$D(XMSECURE) (ZTSAVE("XMSECURE"),ZTSAVE("XMSECURE("))=""
S ZTIO=XMPRTTO
S ZTDESC=$$EZBLD^DIALOG(34501) ; MailMan: Print
S ZTRTN="XPMSG^XMXPRT"
D ^%ZTLOAD
Q
PRINTM(XMDUZ,XMPRTTO,XMINSTR,ZTSK,XMAPSUBJ,XMY) ; Print more than one message
N XMWHICH,XMRECIPS,XMPRTHDR,ZTSAVE,ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTUCI
D PINIT(.XMINSTR,.XMPRTHDR,.XMRECIPS,.XMWHICH,.ZTDTH)
I "^0^*^"'[(U_XMWHICH_U) S XMWHICH="*"
F I="XMV(","DUZ","XMDUZ","XMZ","XMWHICH","XMRECIPS","XMPRTHDR","^TMP(""XM"",$J,""XMZ"",","XMAPSUBJ","XMY(" S ZTSAVE(I)=""
;S:$D(XMSECURE) (ZTSAVE("XMSECURE"),ZTSAVE("XMSECURE("))=""
S ZTIO=XMPRTTO
S ZTDESC=$$EZBLD^DIALOG(34501) ; MailMan: Print
S ZTRTN="XPRANGE^XMXPRT"
D ^%ZTLOAD
Q
PINIT(XMINSTR,XMPRTHDR,XMRECIPS,XMWHICH,XMWHEN) ;
; XMPRTHDR 1=Print header (default)
; 0=don't (headerless print)
; XMRECIPS 0=Don't print recipients (default)
; 1=Print summary recipients
; 2=Print detail recipients
S XMPRTHDR=+$G(XMINSTR("HDR"),1)
S XMRECIPS=+$G(XMINSTR("RECIPS"))
S XMWHICH=$G(XMINSTR("RESPS"),"*")
S XMWHEN=$G(XMINSTR("WHEN"),"NOW")
S XMWHEN=$S(XMWHEN="NOW":$H,1:$$FMTH^XLFDT(XMWHEN))
Q
PMSG(XMDUZ,XMZ,XMWHICH,XMRECIPS,XMPRTHDR,XMFIRST) ;
XPMSG ;
N XMK,XMKN,XMZREC,XMRESPS,XMPTR
S ZTREQ="@"
S XMK=+$O(^XMB(3.7,"M",XMZ,XMDUZ,""))
S XMKN=$S(XMK:$P(^XMB(3.7,XMDUZ,2,XMK,0),U,1),1:$$EZBLD^DIALOG(34014)) ; * N/A *
D RESPONSE^XMJMP(XMDUZ,XMZ,.XMRESPS,.XMPTR)
S:XMWHICH="*" XMWHICH=$S(XMRESPS:"0-"_XMRESPS,1:0)
S XMZREC=^XMB(3.9,XMZ,0)
I $E(IOST,1,2)="C-"!'$G(XMFIRST,1) W @IOF
D:XMPRTHDR IDHDR^XMJMP(XMDUZ)
D PRINTIT^XMJMP1(XMDUZ,XMK,XMKN,XMZ,XMZREC,XMRESPS,XMPTR,XMWHICH,XMRECIPS,0,XMPRTHDR)
Q
PRANGE(XMDUZ,XMWHICH,XMRECIPS,XMPRTHDR) ;
XPRANGE ; Print a range of messages.
N XMZ,XMFIRST
S XMZ=""
S XMFIRST=1
F S XMZ=$O(^TMP("XM",$J,"XMZ",XMZ)) Q:'XMZ D
. Q:'$D(^XMB(3.9,XMZ,0))
. D PMSG(XMDUZ,XMZ,XMWHICH,XMRECIPS,XMPRTHDR,.XMFIRST)
. S XMFIRST=0
Q