Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XMJMOR

XMJMOR.m

Go to the documentation of this file.
XMJMOR ;ISC-SF/GMB-Range actions ;12/04/2002  10:10
 ;;8.0;MailMan;**9**;Jun 28, 2002
 ; Replaces ^XMA0,^XMA01 (ISC-WASH/CAP)
DELETE(XMDUZ,XMK) ; Delete a range of messages
 N XMWHICH,XMMSG,XMABORT
 S XMABORT=0
 I $D(^TMP("XM",$J,".")) D
 . D SELMSG^XMJMORX1(XMDUZ,0,0,XMK,"XDEL",34302,34303,.XMMSG,.XMABORT)
 . ;K ^TMP("XM",$J,".")
 E  D
 . D WHICH(XMDUZ,XMK,34301,34303.1,.XMWHICH,.XMABORT) Q:XMABORT
 . D DELMSG^XMXMSGS(XMDUZ,XMK,XMWHICH,.XMMSG)
 . D:$D(XMERR) ZSHOW^XMJERR
 Q:XMABORT
 W:$D(XMMSG) !,XMMSG
 Q
FILTER(XMDUZ,XMK) ; Filter a range of messages
 N XMWHICH,XMMSG,XMABORT
 S XMABORT=0
 I $D(^TMP("XM",$J,".")) D
 . N XMKZ
 . D SELMSG(XMDUZ,XMK,"XFLTR^XMXMSGS2",34306,.XMMSG)
 . S XMKZ=""
 . F  S XMKZ=$O(^TMP("XM",$J,".",XMKZ)) Q:'XMKZ  K:'$D(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ)) ^TMP("XM",$J,".",XMKZ)
 E  D
 . D WHICH(XMDUZ,XMK,34305,0,.XMWHICH,.XMABORT) Q:XMABORT
 . D FLTRMSG^XMXMSGS(XMDUZ,XMK,XMWHICH,.XMMSG)
 . D:$D(XMERR) ZSHOW^XMJERR
 Q:XMABORT
 W:$D(XMMSG) !,XMMSG
 Q
FORWARD(XMDUZ,XMK) ; Forward a range of messages
 N XMWHICH,XMMSG,XMABORT,XMINSTR
 S XMABORT=0
 I $D(^TMP("XM",$J,".")) D  Q
 . N XMKZ
 . D INIT^XMXADDR
 . S XMKZ=$O(^TMP("XM",$J,".",""))
 . I '$O(^TMP("XM",$J,".",XMKZ)) D  Q
 . . D FWDONE(XMDUZ,$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ,"")),.XMINSTR,.XMABORT)
 . D TOWHOM^XMJMT(XMDUZ,$$EZBLD^DIALOG(34111),.XMINSTR,"",.XMABORT) Q:XMABORT  ; Forward
 . D SELMSG(XMDUZ,XMK,"XFWD^XMXMSGS1",34309,.XMMSG)
 . D CLEANUP^XMXADDR
 . D:$D(XMERR) ZSHOW^XMJERR
 . W:$D(XMMSG) !,XMMSG
 D WHICH(XMDUZ,XMK,34308,0,.XMWHICH,.XMABORT) Q:XMABORT
 D INIT^XMXADDR
 I $P(XMWHICH,",",2,99)="",$P(XMWHICH,",",1)=+XMWHICH D  Q
 . N XMZ
 . S XMZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",+XMWHICH,""))
 . I 'XMZ W !,$$EZBLD^DIALOG(34309.3) Q  ; No messages forwarded.
 . D FWDONE(XMDUZ,XMZ,.XMINSTR,.XMABORT)
 D TOWHOM^XMJMT(XMDUZ,$$EZBLD^DIALOG(34111),.XMINSTR,"",.XMABORT) Q:XMABORT  ; Forward
 S XMINSTR("ADDR FLAGS")="I"
 D FWDMSG^XMXMSGS(XMDUZ,XMK,XMWHICH,"",.XMINSTR,.XMMSG)
 D:$D(XMERR) ZSHOW^XMJERR
 W:$D(XMMSG) !,XMMSG
 Q
FWDONE(XMDUZ,XMZ,XMINSTR,XMABORT) ; Forward just one message
 N XMZREC,XMRESTR
 S XMZREC=^XMB(3.9,XMZ,0)
 I '$$FORWARD^XMXSEC(XMDUZ,XMZ,XMZREC) D SHOW^XMJERR Q
 D GETRESTR^XMXSEC1(XMDUZ,XMZ,XMZREC,"",.XMRESTR) ; Get restrictions on the msg
 D TOWHOM^XMJMT(XMDUZ,$$EZBLD^DIALOG(34111),.XMINSTR,.XMRESTR,.XMABORT) Q:XMABORT  ; Forward
 D FWD^XMKP(XMDUZ,XMZ,.XMINSTR)
 D CLEANUP^XMXADDR
 W !,$$EZBLD^DIALOG(34309.2) ; Message forwarded.
 Q
LATER(XMDUZ,XMK) ; Later a range of messages
 N XMWHICH,XMMSG,XMABORT,XMWHEN
 S XMABORT=0
 I $D(^TMP("XM",$J,".")) D
 . D LTRDATE^XMJMD(.XMWHEN,.XMABORT) Q:XMABORT
 . D SELMSG(XMDUZ,XMK,"XLATER^XMXMSGS2",34312,.XMMSG)
 E  D
 . D WHICH(XMDUZ,XMK,34311,0,.XMWHICH,.XMABORT) Q:XMABORT
 . D LTRDATE^XMJMD(.XMWHEN,.XMABORT) Q:XMABORT
 . D LATERMSG^XMXMSGS(XMDUZ,XMK,XMWHICH,XMWHEN,.XMMSG)
 . D:$D(XMERR) ZSHOW^XMJERR
 Q:XMABORT
 W:$D(XMMSG) !,XMMSG
 Q
NEWTOGL(XMDUZ,XMK) ; New Toggle a range of messages
 N XMWHICH,XMMSG,XMABORT
 S XMABORT=0
 I $D(^TMP("XM",$J,".")) D
 . N XMKZ
 . D SELMSG(XMDUZ,XMK,"XNTOGL^XMXMSGS2",34315,.XMMSG)
 . S XMKZ=""
 . F  S XMKZ=$O(^TMP("XM",$J,".",XMKZ)) Q:'XMKZ  K:'$D(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ)) ^TMP("XM",$J,".",XMKZ)
 E  D
 . D WHICH(XMDUZ,XMK,34314,0,.XMWHICH,.XMABORT) Q:XMABORT
 . D NTOGLMSG^XMXMSGS(XMDUZ,XMK,XMWHICH,.XMMSG)
 . D:$D(XMERR) ZSHOW^XMJERR
 Q:XMABORT
 W:$D(XMMSG) !,XMMSG
 Q
PRINT(XMDUZ,XMK,XMPRTHDR) ; Print a range of messages
 N XMWHICH,XMMSG,XMRECIPS,XMABORT
 ; XMPRTHDR 1=Print header
 ;          0=don't (headerless print)
 ; XMRECIPS 0=Don't print recipients
 ;          1=Print summary recipients
 ;          2=Print detail recipients
 N XMSAVE,XMMSG,XMZLIST,I
 S XMABORT=0
 S:$G(XMPRTHDR)="" XMPRTHDR=1  ; default is to print with headers
 I $D(^TMP("XM",$J,".")) D
 . D LISTSEL(XMDUZ,XMK,.XMZLIST)
 E  D  Q:XMABORT
 . N XMWHICH
 . D WHICH(XMDUZ,XMK,$S(XMPRTHDR:34317,1:34317.1),0,.XMWHICH,.XMABORT) Q:XMABORT
 . D LIST(XMDUZ,XMK,.XMWHICH,.XMZLIST)
 I '$D(XMZLIST) W !!,$$EZBLD^DIALOG(34319) Q  ; No valid messages selected.
 I +XMZLIST(1)=XMZLIST(1) D PRTONE(XMDUZ,XMK,XMZLIST(1),XMPRTHDR,.XMABORT) Q
 D QRECIP^XMJMP(.XMRECIPS,.XMABORT) Q:XMABORT
 F I="DUZ","XMDUZ","XMV(","XMZLIST(","XMRECIPS","XMPRTHDR" S XMSAVE(I)=""
 D EN^XUTMDEVQ("PLISTX^XMJMP",$$EZBLD^DIALOG(34501),.XMSAVE) ; MailMan: Print
 Q:XMABORT!$G(POP)
 W:$D(XMMSG) !!,XMMSG
 Q
LISTSEL(XMDUZ,XMK,XMZLIST) ;
 N XMKZ,J,XMZ
 S (XMKZ,J)=0
 F  S XMKZ=$O(^TMP("XM",$J,".",XMKZ)) Q:'XMKZ  D
 . S XMZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ,"")) Q:'XMZ
 . I J=0 S J=1,XMZLIST(1)=XMZ Q
 . I $L(XMZLIST(J))+$L(XMZ)>240 S J=J+1,XMZLIST(J)=XMZ Q
 . S XMZLIST(J)=XMZLIST(J)_","_XMZ
 Q
LIST(XMDUZ,XMK,XMWHICH,XMZLIST) ;
 N I,J,XMRANGE,XMKZ,XMZ,XMLAST
 S J=0
 F I=1:1:$L(XMWHICH,",") D
 . S XMRANGE=$P(XMWHICH,",",I)
 . Q:'XMRANGE
 . S XMKZ=$P(XMRANGE,"-",1)-.1
 . S XMLAST=$S(XMRANGE["-":$P(XMRANGE,"-",2),1:XMRANGE)
 . F  S XMKZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ)) Q:'XMKZ!(XMKZ>XMLAST)  D
 . . S XMZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ,"")) Q:'XMZ
 . . I J=0 S J=1,XMZLIST(1)=XMZ Q
 . . I $L(XMZLIST(J))+$L(XMZ)>240 S J=J+1,XMZLIST(J)=XMZ Q
 . . S XMZLIST(J)=XMZLIST(J)_","_XMZ
 Q
PRTONE(XMDUZ,XMK,XMZ,XMPRTHDR,XMABORT) ;
 D PONE^XMJMP(XMDUZ,XMK,XMZ,XMPRTHDR,.XMABORT)
 W !!,$$EZBLD^DIALOG($S(XMABORT:34318.4,1:34318.1)) ; Message (not) printed.
 Q
SAVE(XMDUZ,XMK) ; Save a range of messages to another basket
 N XMWHICH,XMMSG,XMABORT,XMKTO,XMDIC
 S XMABORT=0
 S XMDIC("B")="@"  ; no default basket
 I $D(^TMP("XM",$J,".")) D
 . D SELBSKT^XMJBU(XMDUZ,$$EZBLD^DIALOG(34325),"L",.XMDIC,.XMKTO) ; Save messages to which basket?
 . I XMKTO=U S XMMSG=$$EZBLD^DIALOG(34324.3) Q  ; No messages saved.
 . I XMKTO=XMK S XMMSG=$$EZBLD^DIALOG(34326) Q  ; Same basket.  No messages saved.
 . D SELMSG(XMDUZ,XMK,"XMOVE^XMXMSGS2",34324,.XMMSG)
 . K ^TMP("XM",$J,".")
 E  D
 . D WHICH(XMDUZ,XMK,34323,0,.XMWHICH,.XMABORT) Q:XMABORT
 . D SELBSKT^XMJBU(XMDUZ,$$EZBLD^DIALOG(34325),"L",.XMDIC,.XMKTO) ; Save messages to which basket?
 . I XMKTO=U S XMMSG=$$EZBLD^DIALOG(34324.3) Q  ; No messages saved.
 . I XMKTO=XMK S XMMSG=$$EZBLD^DIALOG(34326) Q  ; Same basket.  No messages saved.
 . D MOVEMSG^XMXMSGS(XMDUZ,XMK,XMWHICH,XMKTO,.XMMSG)
 . D:$D(XMERR) ZSHOW^XMJERR
 Q:XMABORT
 W:$D(XMMSG) !,XMMSG
 Q
TERM(XMDUZ,XMK) ; Terminate a range of messages
 N XMWHICH,XMMSG,XMABORT
 S XMABORT=0
 I $D(^TMP("XM",$J,".")) D
 . D SELMSG^XMJMORX1(XMDUZ,0,0,XMK,"XTERM",34329,34330,.XMMSG,.XMABORT)
 . ;K ^TMP("XM",$J,".")
 E  D
 . D WHICH(XMDUZ,XMK,34328,34330.1,.XMWHICH,.XMABORT) Q:XMABORT
 . D TERMMSG^XMXMSGS(XMDUZ,XMK,XMWHICH,.XMMSG)
 . D:$D(XMERR) ZSHOW^XMJERR
 Q:XMABORT
 Q:'$D(XMMSG)
 W !,XMMSG
 I XMMSG W !,$$EZBLD^DIALOG($S(XMK<1:34331.1,1:34331)) ; You won't see future responses.  (In WASTE basket)
 Q
VAPOR(XMDUZ,XMK) ; Set Vaporize date for a range of messages
 N XMWHICH,XMMSG,XMABORT,XMWHEN
 S XMABORT=0
 I $D(^TMP("XM",$J,".")) D
 . D VAPRDATE(.XMWHEN,.XMABORT) Q:XMABORT
 . D SELMSG^XMJMORX1(XMDUZ,0,0,XMK,"XVAPOR^XMXMSGS2",$S(XMWHEN="@":34337.2,1:34337),$S(XMWHEN="@":34338.2,1:34338),.XMMSG,.XMABORT)
 E  D
 . D VAPRDATE(.XMWHEN,.XMABORT) Q:XMABORT
 . D WHICH(XMDUZ,XMK,$S(XMWHEN="@":34336.1,1:34336),$S(XMWHEN="@":34338.3,1:34338.1),.XMWHICH,.XMABORT) Q:XMABORT
 . D VAPORMSG^XMXMSGS(XMDUZ,XMK,XMWHICH,XMWHEN,.XMMSG)
 . D:$D(XMERR) ZSHOW^XMJERR
 Q:XMABORT
 W:$D(XMMSG) !,XMMSG
 Q
VAPRDATE(XMWHEN,XMABORT) ;
 N DIR,X,Y
 S DIR(0)="DO^NOW::EFT"
 D BLD^DIALOG(37317.1,"","","DIR(""A"")")
 D BLD^DIALOG(34339,"","","DIR(""?"")")
 D ^DIR
 I X="@" S XMWHEN="@" Q
 I $D(DIRUT) S XMABORT=1 Q
 S XMWHEN=Y
 Q
XMTPRI(XMDUZ,XMK) ; Toggle transmission priority for a range of msgs
 ; XMDUZ better be .5 and XMK better be > 999!
 N XMTPRI,XMWHICH,XMMSG,XMABORT
 S XMABORT=0
 I $D(^TMP("XM",$J,".")) D
 . D ASKPRI^XMJMORX(.XMTPRI,.XMABORT) Q:XMABORT
 . D SELMSG^XMJMORX1(XMDUZ,0,0,XMK,"XXP^XMXMSGS1",34334,34335,.XMMSG,.XMABORT)
 E  D
 . D WHICH(XMDUZ,XMK,34333,34335.1,.XMWHICH,.XMABORT) Q:XMABORT
 . D ASKPRI^XMJMORX(.XMTPRI,.XMABORT) Q:XMABORT
 . D XPMSG^XMXMSGS(XMDUZ,XMK,XMWHICH,XMTPRI,.XMMSG)
 . D:$D(XMERR) ZSHOW^XMJERR
 Q:XMABORT
 W:$D(XMMSG) !,XMMSG
 Q
WHICH(XMDUZ,XMK,XMPROMPT,XMCONFRM,XMWHICH,XMABORT) ;
 N DIR,X,Y,XMHI,XMLO
 S XMLO=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",""))
 S XMHI=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",""),-1)
 S DIR("A")=$$EZBLD^DIALOG(XMPROMPT) ; ... which messages?
 S DIR("??")="XM-U-M-CHOOSE RANGE"
 S DIR(0)="LC^"_XMLO_":"_XMHI
 D ^DIR I $D(DIRUT) S XMABORT=1 Q
 S XMWHICH=Y
 I XMCONFRM D CONFIRM(XMCONFRM,.XMABORT)
 Q
CONFIRM(XMCONFRM,XMABORT) ;
 N DIR
 D BLD^DIALOG(XMCONFRM,"","","DIR(""A"")") ; Do you really want to ... these messages?
 S DIR("B")=$$EZBLD^DIALOG(39053) ; No
 S DIR(0)="Y"
 D ^DIR I $D(DIRUT)!'Y S XMABORT=1
 Q
POSTPRIV() ;
 Q:$$POSTPRIV^XMXSEC 1
 D SHOW^XMJERR
 Q 0
SELMSG(XMDUZ,XMK,XMRTN,XMSUM,XMMSG) ;
 N XMCNT,XMKZ,XMZ,XMKALL
 S (XMCNT,XMKZ)=0
 F  S XMKZ=$O(^TMP("XM",$J,".",XMKZ)) Q:'XMKZ  D
 . S XMZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ,"")) Q:'XMZ
 . D @XMRTN
 S XMMSG=$$EZBLD^DIALOG($S(XMCNT=1:XMSUM+.1,1:XMSUM),XMCNT)
 D INCRDECR^XMXMSGS(XMDUZ,.XMCNT)
 Q