close Warning: Can't use blame annotator:
svn blame failed on WorldVistAEHR/trunk/r/MAILMAN-XM/XMJMFB.m: 'GenericSWIGWrapper' object has no attribute '_wrap'

source: WorldVistAEHR/trunk/r/MAILMAN-XM/XMJMFB.m@ 837

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

initial load of WorldVistAEHR

File size: 9.2 KB
RevLine 
1XMJMFB ;ISC-SF/GMB-Find message: multiple conditions ;07/12/2002 10:40
2 ;;8.0;MailMan;;Jun 28, 2002
3 ; Replaces ^XMAL0,^XMAL0A (ISC-WASH/JSH/CAP)
4 ; XMF("BSKT") =number - Look in this basket ONLY
5 ; =* - Look in all baskets
6 ; XMF("SUBJ") Subject contains this string
7 ; XMF("SUBJ","S") Look for this string in the subject
8 ; XMF("FLINE") Message has this many or more lines
9 ; XMF("TLINE") Message has this many or fewer lines
10 ; XMF("FROM") Message is from this person
11 ; XMF("TO") Message is to this person
12 ; XMF("FDATE") Message was sent on or after this date
13 ; XMF("TDATE") Message was sent on or before this date
14 ; XMF("RFROM") Message has a response from this person
15 ; XMF("TEXT") Message contains this string
16 ; XMF("TEXT","S") Look for this string in the message
17 ; XMF("TEXT","L") =1 - Look in message only
18 ; =2 - Look in both message and responses
19 ; =3 - Look in responses only
20 ; XMF("TEXT","C") =0 - Search is not case-sensitive
21 ; =1 - Search is case-sensitive
22FIND1(XMDUZ,XMF,XMWAIT) ;
23 N XMK,XMKN,XMKZ,XMCNT,XMABORT,XMLEN,XMFIRST,XMPAGE,XMDETAIL,XMPMAX,XMMORE,XMZOOM,XMCD,XMOPT,XMOX
24 K ^TMP("XM",$J,"MSG"),^TMP("XM",$J,".")
25 S XMKZ="",(XMPAGE,XMCNT,XMZOOM,XMCD,XMABORT)=0,(XMDETAIL,XMMORE)=1,XMPMAX=IOSL-3
26 D INIT1(XMDUZ,.XMF,XMDETAIL,XMPMAX,.XMK,.XMKN,.XMLEN)
27 D SETOPT^XMJMLR1(XMDUZ,$S(XMDUZ'=.5:0,XMK<1000:0,1:XMK),.XMOPT,.XMOX)
28 F D Q:XMABORT
29 . I XMCD S XMCD=0,XMDETAIL='XMDETAIL D INIT1(XMDUZ,.XMF,XMDETAIL,XMPMAX,.XMK,.XMKN,.XMLEN)
30 . D DISPLAY1(XMDUZ,.XMF,XMDETAIL,.XMK,XMKN,.XMKZ,.XMCNT,.XMFIRST,.XMPAGE,.XMMORE,.XMLEN,XMZOOM,XMPMAX)
31 . I XMCNT=0 S XMABORT=1 Q
32 . D CHOOSE^XMJMLN(XMDUZ,0,XMK,.XMKZ,.XMFIRST,.XMPAGE,XMMORE,.XMLEN,.XMZOOM,.XMOPT,.XMOX,"READMSG^XMJMFB",.XMABORT)
33 . S:'$D(^TMP("XM",$J,"MSG")) XMABORT=1
34 I XMCNT=0 D
35 . W $C(7),$$EZBLD^DIALOG(34401) ; No matches found.
36 . Q:'$G(XMWAIT)
37 . W ! D WAIT^XMXUTIL
38 K ^TMP("XM",$J,"MSG"),^TMP("XM",$J,".")
39 Q
40INIT1(XMDUZ,XMF,XMDETAIL,XMPMAX,XMK,XMKN,XMLEN) ;
41 S:$D(XMF("SUBJ")) XMF("SUBJ","S")=$$UP^XLFSTR(XMF("SUBJ"))
42 S:$D(XMF("TEXT")) XMF("TEXT","S")=$S('XMF("TEXT","C"):$$UP^XLFSTR(XMF("TEXT")),1:XMF("TEXT"))
43 S XMK=XMF("BSKT")
44 S XMKN=$P(^XMB(3.7,XMDUZ,2,XMK,0),U)
45 D INIT^XMJML(XMDUZ,XMK,XMKN,XMDETAIL,.XMLEN,1)
46 Q
47DISPLAY1(XMDUZ,XMF,XMDETAIL,XMK,XMKN,XMKZ,XMCNT,XMFIRST,XMPAGE,XMMORE,XMLEN,XMZOOM,XMPMAX) ;
48 N XMREC,XMZ
49 S XMFIRST(XMPAGE)=XMKZ
50 D HEADER^XMJML(XMDETAIL,.XMLEN,$$EZBLD^DIALOG(34404,XMKN)) ; XMKN_ Basket Search
51 I XMZOOM D Q
52 . F S XMKZ=$O(^TMP("XM",$J,".",XMKZ),XMV("ORDER")) Q:XMKZ="" D Q:$Y>XMPMAX
53 . . S XMREC=^TMP("XM",$J,"MSG",XMKZ)
54 . . D LISTMSG^XMJML($P(XMREC,U,1),$P(XMREC,U,2),XMKZ,$P(XMREC,U,3),XMDETAIL,.XMLEN)
55 F S XMKZ=$O(^TMP("XM",$J,"MSG",XMKZ),XMV("ORDER")) Q:XMKZ="" D Q:$Y>XMPMAX
56 . S XMREC=^TMP("XM",$J,"MSG",XMKZ)
57 . D LISTMSG^XMJML($P(XMREC,U,1),$P(XMREC,U,2),XMKZ,$P(XMREC,U,3),XMDETAIL,.XMLEN)
58 Q:$Y>XMPMAX!'XMMORE
59 D CHKNLST1(XMDUZ,.XMF,XMDETAIL,XMK,XMKN,.XMKZ,.XMCNT,XMPMAX,.XMLEN)
60 S:XMKZ'>0 XMMORE=0
61 W:'XMMORE !,$$EZBLD^DIALOG(34402) ; Search finished.
62 Q
63CHKNLST1(XMDUZ,XMF,XMDETAIL,XMK,XMKN,XMKZ,XMCNT,XMPMAX,XMLEN) ; Check and List
64 N XMZ
65 S:XMKZ="" XMKZ=$O(^TMP("XM",$J,"MSG",""),-XMV("ORDER"))
66 F S XMKZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ),XMV("ORDER")) Q:XMKZ'>0 D Q:$Y>XMPMAX
67 . S XMZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ,0))
68 . I '$D(^XMB(3.7,XMDUZ,2,XMK,1,XMZ,0)) D ADDITC^XMUT4A(XMDUZ,XMK,XMZ,XMKZ)
69 . Q:'$$GOODMSG(XMDUZ,XMK,XMZ,.XMF)
70 . S XMCNT=XMCNT+1
71 . D LISTMSG^XMJML(XMK,XMKN,XMKZ,XMZ,XMDETAIL,.XMLEN)
72 . S ^TMP("XM",$J,"MSG",XMKZ)=XMK_U_XMKN_U_XMZ
73 Q
74FINDALL(XMDUZ,XMF) ;
75 N XMK,XMKN,XMKZZ,XMKZ,XMCNT,XMABORT,XMLEN,XMFIRST,XMPAGE,XMDETAIL,XMPMAX,XMMORE,XMZOOM,XMCD,XMOPT,XMOX
76 S (XMKZ,XMKZZ)="",(XMK,XMPAGE,XMCNT,XMZOOM,XMCD,XMABORT)=0,(XMDETAIL,XMMORE)=1,XMPMAX=IOSL-3
77 D INITA(XMDUZ,.XMF,.XMK,.XMKN,.XMKZZ,.XMLEN,.XMABORT) Q:XMABORT
78 D SETOPT^XMJMLR1(XMDUZ,0,.XMOPT,.XMOX)
79 K ^TMP("XM",$J,"MSG"),^TMP("XM",$J,".")
80 F D Q:XMABORT
81 . D DISPLAYA(XMDUZ,.XMF,.XMDETAIL,.XMK,XMKN,.XMKZZ,.XMKZ,.XMCNT,.XMFIRST,.XMPAGE,.XMMORE,.XMLEN,XMZOOM,XMPMAX)
82 . D CHOOSE^XMJMLN(XMDUZ,1,0,.XMKZ,.XMFIRST,.XMPAGE,XMMORE,.XMLEN,.XMZOOM,.XMOPT,.XMOX,"READMSG^XMJMFB",.XMABORT)
83 . S:'$D(^TMP("XM",$J,"MSG")) XMABORT=1
84 K ^TMP("XM",$J,"MSG"),^TMP("XM",$J,".")
85 Q
86INITA(XMDUZ,XMF,XMK,XMKN,XMKZZ,XMLEN,XMABORT) ;
87 S:$D(XMF("SUBJ")) XMF("SUBJ","S")=$$UP^XLFSTR(XMF("SUBJ"))
88 S:$D(XMF("TEXT")) XMF("TEXT","S")=$S('XMF("TEXT","C"):$$UP^XLFSTR(XMF("TEXT")),1:XMF("TEXT"))
89 S XMLEN("XMKZ")=0
90 F S XMK=$O(^XMB(3.7,XMDUZ,2,XMK)) Q:XMK'>0 D Q:$D(XMKN)
91 . F S XMKZZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZZ),XMV("ORDER")) Q:XMKZZ'>0 D Q:$D(XMKN)
92 . . S XMZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZZ,0))
93 . . Q:'$$GOODMSG(XMDUZ,XMK,XMZ,.XMF)
94 . . S XMKN=$P(^XMB(3.7,XMDUZ,2,XMK,0),U)
95 I $D(XMKN) S XMKZZ=XMKZZ-XMV("ORDER") Q
96 S XMABORT=1
97 W $C(7),$$EZBLD^DIALOG(34401),! ; No matches found.
98 D WAIT^XMXUTIL
99 Q
100DISPLAYA(XMDUZ,XMF,XMDETAIL,XMK,XMKN,XMKZZ,XMKZ,XMCNT,XMFIRST,XMPAGE,XMMORE,XMLEN,XMZOOM,XMPMAX) ;
101 N XMREC,XMZ
102 S XMFIRST(XMPAGE)=XMKZ
103 I XMCD D
104 . S XMCD=0,XMDETAIL='XMDETAIL
105 . D INIT^XMJML(XMDUZ,XMK,XMKN,XMDETAIL,.XMLEN)
106 E I $L(XMCNT+XMPMAX)>XMLEN("XMKZ") D
107 . S XMLEN("XMKZ")=$L(XMCNT+XMPMAX)
108 . D INIT^XMJML(XMDUZ,XMK,XMKN,XMDETAIL,.XMLEN)
109 D HEADER^XMJML(XMDETAIL,.XMLEN,$$EZBLD^DIALOG(34405)) ; All Baskets Search
110 I XMZOOM D Q
111 . F S XMKZ=$O(^TMP("XM",$J,".",XMKZ)) Q:XMKZ="" D Q:$Y>XMPMAX
112 . . S XMREC=^TMP("XM",$J,"MSG",XMKZ)
113 . . D LISTMSG^XMJML($P(XMREC,U,1),$P(XMREC,U,2),XMKZ,$P(XMREC,U,3),XMDETAIL,.XMLEN)
114 F S XMKZ=$O(^TMP("XM",$J,"MSG",XMKZ)) Q:XMKZ="" D Q:$Y>XMPMAX
115 . S XMREC=^TMP("XM",$J,"MSG",XMKZ)
116 . D LISTMSG^XMJML($P(XMREC,U,1),$P(XMREC,U,2),XMKZ,$P(XMREC,U,3),XMDETAIL,.XMLEN)
117 Q:$Y>XMPMAX!'XMMORE
118 S XMK=XMK-.01
119 F S XMK=$O(^XMB(3.7,XMDUZ,2,XMK)) Q:XMK'>0 D Q:$Y>XMPMAX
120 . S XMKN=$P(^XMB(3.7,XMDUZ,2,XMK,0),U)
121 . D CHKNLSTA(XMDUZ,.XMF,XMDETAIL,XMK,XMKN,.XMKZZ,.XMCNT,XMPMAX,.XMLEN)
122 I XMK'>0,XMKZZ'>0 S XMMORE=0
123 S XMKZ=XMCNT
124 W:'XMMORE !,$$EZBLD^DIALOG(34402) ; Search finished.
125 Q
126CHKNLSTA(XMDUZ,XMF,XMDETAIL,XMK,XMKN,XMKZZ,XMCNT,XMPMAX,XMLEN) ; Check and List
127 N XMZ
128 F S XMKZZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZZ),XMV("ORDER")) Q:XMKZZ'>0 D Q:$Y>XMPMAX
129 . S XMZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZZ,0))
130 . I '$D(^XMB(3.7,XMDUZ,2,XMK,1,XMZ,0)) D ADDITC^XMUT4A(XMDUZ,XMK,XMZ,XMKZZ)
131 . Q:'$$GOODMSG(XMDUZ,XMK,XMZ,.XMF)
132 . I $L(XMKN)>$G(XMLEN("BSKT")) D
133 . . S XMLEN("BSKT")=$$MIN^XLFMTH($L(XMKN),10)
134 . . D INIT^XMJML(XMDUZ,XMK,XMKN,XMDETAIL,.XMLEN)
135 . S XMCNT=XMCNT+1
136 . D LISTMSG^XMJML(XMK,XMKN,XMCNT,XMZ,XMDETAIL,.XMLEN)
137 . S ^TMP("XM",$J,"MSG",XMCNT)=XMK_U_XMKN_U_XMZ
138 Q
139GOODMSG(XMDUZ,XMK,XMZ,XMF) ;
140 N XMZREC,XMNOGOOD,XMZFROM,XMZDATE
141 S XMZREC=$G(^XMB(3.9,XMZ,0))
142 I XMZREC="",XMK D ZAPIT^XMXMSGS2(XMDUZ,XMK,XMZ) Q 0
143 I $D(XMF("SUBJ")),$$UP^XLFSTR($P(XMZREC,U,1))'[XMF("SUBJ","S") Q 0
144 I $D(XMF("FROM")) Q:'$$GOODFROM(XMZREC,XMF("FROM")) 0
145 I $D(XMF("FLINE"))!$D(XMF("TLINE")) D Q:XMNOGOOD 0
146 . N XMLINES
147 . S XMNOGOOD=1
148 . S XMLINES=$$LINE^XMXUTIL2(XMZ)
149 . I $D(XMF("FLINE")),XMLINES<XMF("FLINE") Q
150 . I $D(XMF("TLINE")),XMF("TLINE")<XMLINES Q
151 . S XMNOGOOD=0
152 I $D(XMF("FDATE"))!$D(XMF("TDATE")) D Q:XMNOGOOD 0
153 . S XMNOGOOD=1
154 . S XMZDATE=$P(XMZREC,U,3)
155 . S:XMZDATE'=+XMZDATE XMZDATE=$$CONVERT^XMXUTIL1(XMZDATE)
156 . S XMZDATE=$P(XMZDATE,".")
157 . I $D(XMF("FDATE")),XMZDATE<XMF("FDATE") Q
158 . I $D(XMF("TDATE")),XMF("TDATE")<XMZDATE Q
159 . S XMNOGOOD=0
160 I $D(XMF("TO")) D Q:XMNOGOOD 0
161 . I $D(^XMB(3.9,XMZ,6,"B",XMF("TO"))) S XMNOGOOD=0 Q
162 . I $L(XMF("TO"))>30,$D(^XMB(3.9,XMZ,6,"B",$E(XMF("TO"),1,30))),XMF("TO")=$P($G(^XMB(3.9,XMZ,6,+$O(^XMB(3.9,XMZ,6,"B",$E(XMF("TO"),1,30),0)),0)),U,1) S XMNOGOOD=0 Q
163 . S XMNOGOOD=1
164 . Q:XMF("TO")'["@"
165 . N XMTOX,XMTO
166 . S XMTO=""
167 . F S XMTO=$O(^XMB(3.9,XMZ,6,"B",XMTO)) Q:XMTO="" D Q:'XMNOGOOD
168 . . Q:XMTO'["@"
169 . . S XMTOX=$$UP^XLFSTR(XMTO)
170 . . Q:$P(XMTOX,"@")'[$P(XMF("TO"),"@")
171 . . Q:$P(XMTOX,"@",2)'[$P(XMF("TO"),"@",2)
172 . . S XMNOGOOD=0
173 I $D(XMF("RFROM")) D Q:XMNOGOOD 0
174 . N XMIEN,XMZR
175 . S XMNOGOOD=1
176 . S XMIEN=0
177 . F S XMIEN=$O(^XMB(3.9,XMZ,3,XMIEN)) Q:'XMIEN S XMZR=^(XMIEN,0) I $$GOODFROM($G(^XMB(3.9,XMZR,0)),XMF("RFROM")) S XMNOGOOD=0 Q
178 I $D(XMF("TEXT")) D Q:XMNOGOOD 0
179 . S XMNOGOOD=1
180 . I XMF("TEXT","L")<3 D Q:XMF("TEXT","L")=1!(XMNOGOOD=0)
181 . . S:$$GOODTEXT(XMZ,XMF("TEXT","S"),XMF("TEXT","C")) XMNOGOOD=0
182 . N XMIEN,XMZR
183 . S XMIEN=0
184 . F S XMIEN=$O(^XMB(3.9,XMZ,3,XMIEN)) Q:'XMIEN S XMZR=^(XMIEN,0) I $$GOODTEXT(XMZR,XMF("TEXT","S"),XMF("TEXT","C")) S XMNOGOOD=0 Q
185 Q 1
186GOODFROM(XMZREC,XMF) ; Returns 1 if msg is from XMF; 0 if not
187 N XMZFROM
188 S XMZFROM=$P(XMZREC,U,2)
189 I XMF=+XMF,XMF=XMZFROM Q 1
190 Q:XMF'["@" 0
191 S XMZFROM=$$UP^XLFSTR(XMZFROM)
192 Q:$P(XMZFROM,"@")'[$P(XMF,"@") 0
193 Q:$P(XMZFROM,"@",2)'[$P(XMF,"@",2) 0
194 Q 1
195GOODTEXT(XMZ,XMF,XMFMATTR) ; Returns positive number if msg contains XMF; 0 if not
196 N I
197 S I=.999999
198 I XMFMATTR D
199 . F S I=$O(^XMB(3.9,XMZ,2,I)) Q:'I Q:^(I,0)[XMF
200 E D
201 . F S I=$O(^XMB(3.9,XMZ,2,I)) Q:'I Q:$$UP^XLFSTR(^(I,0))[XMF
202 Q +I
203READMSG ; (XMDUZ,XMKZ,XMREC) <- needed!
204 N XMK,XMKN,XMZ,XMRDR ; $G(XMRDR) is checked in READMSG^XMJBM
205 S XMK=$P(XMREC,U,1),XMKN=$P(XMREC,U,2),XMZ=$P(XMREC,U,3)
206 D READMSG^XMJBM(XMDUZ,XMK,XMKN,XMZ)
207 Q:$D(^XMB(3.7,"M",XMZ,XMDUZ,XMK))
208 I XMF("BSKT")=XMK K ^TMP("XM",$J,"MSG",XMKZ) Q
209 S XMK=+$O(^XMB(3.7,"M",XMZ,XMDUZ,0))
210 S ^TMP("XM",$J,"MSG",XMKZ)=XMK_U_$S(XMK=0:$$EZBLD^DIALOG(34014),1:$P(^XMB(3.7,XMDUZ,2,XMK,0),U))_U_XMZ ; * N/A *
211 Q
Note: See TracBrowser for help on using the repository browser.