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

151 lines
6.8 KiB
Mathematica
Raw Permalink Normal View History

2009-11-29 13:37:14 -05:00
XMXLIST1 ;ISC-SF/GMB-List message: multiple conditions (cont.) ;08/30/2000 15:29
;;8.0;MailMan;;Jun 28, 2002
; Look in all of the user's baskets.
NEWA(XMDUZ,XMTYPE,XMORDER,XMFLDS,XMAMT,XMSTART,XMF,XMTROOT) ; New messages in all baskets
N XMCNT,XMK,XMKN,XMZ
S XMCNT=0
S XMK=+$G(XMSTART("XMK")) I XMK S XMK=XMK-.01
S XMZ=$G(XMSTART("XMZ"))
F S XMK=$O(^XMB(3.7,XMDUZ,XMTYPE,XMK)) Q:'XMK D Q:XMCNT=XMAMT
. S XMKN=$P(^XMB(3.7,XMDUZ,2,XMK,0),U,1)
. F S XMZ=$O(^XMB(3.7,XMDUZ,XMTYPE,XMK,XMZ),XMORDER) Q:'XMZ D Q:XMCNT=XMAMT
. . I '$D(^XMB(3.7,XMDUZ,2,XMK,1,XMZ,0)) D ADDITN^XMUT4A(XMDUZ,XMTYPE,XMK,XMZ)
. . I '$D(^XMB(3.9,XMZ,0)) D ZAPIT^XMXMSGS2(XMDUZ,XMK,XMZ) Q
. . I $D(XMF) Q:'$$GOODMSG^XMJMFB(XMDUZ,XMK,XMZ,.XMF)
. . S XMCNT=XMCNT+1
. . S @(XMTROOT_XMCNT_")")=XMZ
. . Q:'$D(XMFLDS)
. . D FIELDS(XMDUZ,XMK,XMKN,XMZ,.XMFLDS,XMTROOT,XMCNT)
. . I XMFLDS["SEQN" D KSEQN(XMDUZ,XMK,XMZ,.XMFLDS,XMTROOT,XMCNT)
S XMSTART("XMK")=XMK
S XMSTART("XMZ")=XMZ
S @(XMTROOT_"0)")=XMCNT_U_XMAMT
; Any more?
I 'XMK S @(XMTROOT_"0)")=@(XMTROOT_"0)")_"^0" Q
I '$O(^XMB(3.7,XMDUZ,XMTYPE,XMK)),'$O(^XMB(3.7,XMDUZ,XMT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
. . S @(XMTROOT_XMCNT_")")=XMZ
. . Q:'$D(XMFLDS)
. . D FIELDS(XMDUZ,XMK,XMKN,XMZ,.XMFLDS,XMTROOT,XMCNT)
. . I XMFLDS["SEQN" D SEQN(XMDUZ,XMKZ,.XMFLDS,XMTROOT,XMCNT)
S XMSTART("XMK")=XMK
S XMSTART("XMKZ")=XMKZ
S @(XMTROOT_"0)")=XMCNT_U_XMAMT
; Any more?
I 'XMK S @(XMTROOT_"0)")=@(XMTROOT_"0)")_"^0" Q
I '$O(^XMB(3.7,XMDUZ,2,XMK)),'$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ),XMORDER) S @(XMTROOT_"0)")=@(XMTROOT_"0)")_"^0" Q
I '$D(XMF) S @(XMTROOT_"0)")=@(XMTROOT_"0)")_"^1" Q
N XMORE
S XMORE=0,XMK=XMK-.01
F S XMK=$O(^XMB(3.7,XMDUZ,2,XMK)) Q:'XMK D Q:XMORE
. F S XMKZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ),XMORDER) Q:'XMKZ S XMZ=$O(^(XMKZ,"")) D Q:XMORE
. . I '$D(^XMB(3.7,XMDUZ,2,XMK,1,XMZ,0)) D ADDITC^XMUT4A(XMDUZ,XMK,XMZ,XMKZ)
. . I '$D(^XMB(3.9,XMZ,0)) D ZAPIT^XMXMSGS2(XMDUZ,XMK,XMZ) Q
. . I $$GOODMSG^XMJMFB(XMDUZ,XMK,XMZ,.XMF) S XMORE=1
S @(XMTROOT_"0)")=@(XMTROOT_"0)")_U_XMORE
Q
REGAZ(XMDUZ,XMORDER,XMFLDS,XMAMT,XMSTART,XMF,XMTROOT) ; Messages (by IEN) in all baskets
N XMCNT,XMK,XMKN,XMZ
S XMCNT=0
S XMK=+$G(XMSTART("XMK")) I XMK S XMK=XMK-.01
S XMZ=$G(XMSTART("XMZ"))
F S XMK=$O(^XMB(3.7,XMDUZ,2,XMK)) Q:'XMK D Q:XMCNT=XMAMT
. S XMKN=$P(^XM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MFLDS,XMTROOT,XMCNT) ;
N XMZREC,XMLOOK,XMVAL
I XMFLDS["BSKT" D
. S XMLOOK=$P($P(XMFLDS,"BSKT",2),";",1)
. S @(XMTROOT_XMCNT_",""BSKT"")")=XMK_$S(XMLOOK["I":"",1:U_XMKN)
. I XMLOOK["X" S @(XMTROOT_"""BSKT"",XMKN,XMCNT)")=""
I XMFLDS["FROM" D
. I '$D(XMZREC) S XMZREC=$G(^XMB(3.9,XMZ,0))
. S XMLOOK=$P($P(XMFLDS,"FROM",2),";",1)
. I XMLOOK["I" S @(XMTROOT_XMCNT_",""FROM"")")=$P(XMZREC,U,2) Q:XMLOOK'["X"
. S XMVAL=$$FROM^XMXUTIL2(XMZREC)
. I $E(XMVAL)="<" S XMVAL=$E(XMVAL,2,$L(XMVAL)-1)
. I XMLOOK'["I" S @(XMTROOT_XMCNT_",""FROM"")")=$P(XMZREC,U,2)_U_XMVAL Q:XMLOOK'["X"
. S @(XMTROOT_"""FROM"",XMVAL,XMCNT)")=""
I XMFLDS["DATE" D
. I '$D(XMZREC) S XMZREC=$G(^XMB(3.9,XMZ,0))
. S XMLOOK=$P($P(XMFLDS,"DATE",2),";",1)
. I XMLOOK'["X" D Q
. . I XMLOOK["I" S @(XMTROOT_XMCNT_",""DATE"")")=$P(XMZREC,U,3) Q
. . I XMLOOK["F" D Q
. . . S XMVAL=$P(XMZREC,U,3)
. . . I XMVAL'?7N.E S XMVAL=$$CONVERT^XMXUTIL1(XMVAL,1) I XMVAL=-1 S XMVAL=$P(XMZREC,U,3)
. . . S @(XMTROOT_XMCNT_",""DATE"")")=$P(XMZREC,U,3)_U_XMVAL
. . S @(XMTROOT_XMCNT_",""DATE"")")=$P(XMZREC,U,3)_U_$$DATE^XMXUTIL2(XMZREC)
. S XMVAL=$P(XMZREC,U,3)
. I XMVAL'?7N.E S XMVAL=$$CONVERT^XMXUTIL1(XMVAL,1)
. S @(XMTROOT_"""DATE"",XMVAL,XMCNT)")=""
. I XMLOOK["I" S @(XMTROOT_XMCNT_",""DATE"")")=$P(XMZREC,U,3) Q
. I XMLOOK["F" S @(XMTROOT_XMCNT_",""DATE"")")=$P(XMZREC,U,3)_U_XMVAL Q
. S @(XMTROOT_XMCNT_",""DATE"")")=$P(XMZREC,U,3)_U_$$DATE^XMXUTIL2(XMZREC)
I XMFLDS["SUBJ" D
. I '$D(XMZREC) S XMZREC=$G(^XMB(3.9,XMZ,0))
. S XMLOOK=$P($P(XMFLDS,"SUBJ",2),";",1)
. I XMLOOK'["X" S @(XMTROOT_XMCNT_",""SUBJ"")")=$$SUBJ^XMXUTIL2(XMZREC) Q
. S XMVAL=$$SUBJ^XMXUTIL2(XMZREC)
. S @(XMTROOT_XMCNT_",""SUBJ"")")=XMVAL
. S @(XMTROOT_"""SUBJ"",XMVAL,XMCNT)")=""
I XMFLDS["PRI" D
. I '$D(XMZREC) S XMZREC=$G(^XMB(3.9,XMZ,0))
. S @(XMTROOT_XMCNT_",""PRI"")")=$$PRI^XMXUTIL2(XMZREC)
I XMFLDS["LINE" S @(XMTROOT_XMCNT_",""LINE"")")=$$LINE^XMXUTIL2(XMZ)
I XMFLDS["NEW" S @(XMTROOT_XMCNT_",""NEW"")")=$$NEW^XMXUTIL2(XMDUZ,XMK,XMZ)
I XMFLDS["RESP" S @(XMTROOT_XMCNT_",""RESP"")")=$$RESP^XMXUTIL2(XMZ)
I XMFLDS["READ" S @(XMTROOT_XMCNT_",""READ"")")=$$ZREAD^XMXUTIL2(XMDUZ,XMZ)
Q
KSEQN(XMDUZ,XMK,XMZ,XMFLDS,XMTROOT,XMCNT) ;
S @(XMTROOT_XMCNT_",""SEQN"")")=$$KSEQN^XMXUTIL2(XMDUZ,XMK,XMZ)
Q
SEQN(XMDUZ,XMKZ,XMFLDS,XMTROOT,XMCNT) ;
S @(XMTROOT_XMCNT_",""SEQN"")")=XMKZ
Q