source: FOIAVistA/trunk/r/MAILMAN-XM/XMXPARM.m@ 1119

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

initial load of FOIAVistA 6/30/08 version

File size: 8.3 KB
Line 
1XMXPARM ;ISC-SF/GMB-Parameter check ;03/26/2003 08:00
2 ;;8.0;MailMan;**15**;Jun 28, 2002
3ACTMSGS(XMDUZ,XMK,XMKZA) ;
4 K XMERR,^TMP("XMERR",$J)
5 D XMDUZ(.XMDUZ,.XMV)
6 I $G(XMK)'="" S XMK=$$XMK(XMDUZ,"XMK",XMK)
7 D XMKZA^XMXPARM1(.XMKZA)
8 Q
9ACTMSG(XMDUZ,XMK,XMKZ) ;
10 K XMERR,^TMP("XMERR",$J)
11 D XMDUZ(.XMDUZ,.XMV)
12 I $G(XMK)'="" D
13 . S XMK=$$XMK(XMDUZ,"XMK",XMK)
14 . D XMKZ^XMXPARM1(XMK,.XMKZ)
15 E D XMZ(.XMKZ)
16 Q
17ANSRMSG(XMDUZ,XMK,XMKZ,XMSUBJ,XMBODY,XMTO,XMINSTR) ;
18 D ACTMSG(.XMDUZ,.XMK,.XMKZ)
19 I $G(XMSUBJ)'="" S XMSUBJ=$$XMSUBJ("XMSUBJ",$G(XMSUBJ))
20 D XMBODY^XMXPARM1(.XMBODY)
21 D:$D(XMTO) XMTO^XMXPARM1(.XMTO,$G(XMINSTR("ADDR FLAGS"))["I") ; truly optional
22 D:$D(XMINSTR) XMINSTR(.XMINSTR)
23 Q
24BULLETIN(XMDUZ,XMBN,XMPARM,XMBODY,XMTO,XMINSTR,XMATTACH) ;
25 K XMERR,^TMP("XMERR",$J)
26 D XMDUZ(.XMDUZ,.XMV)
27 D XMBN^XMXPARM1(.XMBN)
28 D:$D(XMBODY) XMBODY^XMXPARM1(.XMBODY,1)
29 D:$D(XMTO) XMTO^XMXPARM1(.XMTO,$G(XMINSTR("ADDR FLAGS"))["I") ; truly optional
30 D:$D(XMINSTR) XMINSTR(.XMINSTR)
31 Q
32FWDMSG(XMDUZ,XMK,XMKZA,XMTO,XMINSTR) ;
33 D ACTMSGS(.XMDUZ,.XMK,.XMKZA)
34 D XMTO^XMXPARM1(.XMTO,$G(XMINSTR("ADDR FLAGS"))["I") ; need at least one
35 D:$D(XMINSTR) XMINSTR(.XMINSTR)
36 Q
37LATERMSG(XMDUZ,XMK,XMKZA,XMINSTR) ;
38 D ACTMSGS(.XMDUZ,.XMK,.XMKZA)
39 I $D(XMINSTR("LATER")) D Q
40 . ;I XMINSTR("LATER")="@" Q
41 . S XMINSTR("LATER")=$$XMDATE("XMINSTR(""LATER"")",XMINSTR("LATER"))
42 I $G(XMINSTR)'="" D Q
43 . ;I XMINSTR="@" Q
44 . S XMINSTR=$$XMDATE("LATER",XMINSTR)
45 D ERRSET^XMXUTIL(39419) ;Later date must be supplied.
46 Q
47MOVEMSG(XMDUZ,XMK,XMKZA,XMKTO) ;
48 D ACTMSGS(.XMDUZ,.XMK,.XMKZA)
49 D XMKTO(XMDUZ,.XMKTO)
50 Q
51PRTMSG(XMDUZ,XMK,XMKZA,XMPRTTO,XMINSTR,XMSUBJ,XMTO) ;
52 D ACTMSGS(.XMDUZ,.XMK,.XMKZA)
53 Q:'$D(XMINSTR)
54 I $D(XMINSTR("WHEN")) S XMINSTR("WHEN")=$$XMDATE("XMINSTR(""WHEN"")",XMINSTR("WHEN"))
55 I $D(XMINSTR("HDR")) D XMCODE^XMXPARM1("XMINSTR(""HDR"")",XMINSTR("HDR"),"^0^1^")
56 I $D(XMINSTR("RECIPS")) D XMCODE^XMXPARM1("XMINSTR(""RECIPS"")",XMINSTR("RECIPS"),"^0^1^2^")
57 I $G(XMSUBJ)'="" S XMSUBJ=$$XMSUBJ("XMSUBJ",$G(XMSUBJ))
58 I $D(XMTO) D XMTO^XMXPARM1(.XMTO,$G(XMINSTR("ADDR FLAGS"))["I") ; ok
59 Q
60REPLYMSG(XMDUZ,XMK,XMKZ,XMBODY,XMINSTR) ;
61 D ACTMSG(.XMDUZ,.XMK,.XMKZ)
62 D XMBODY^XMXPARM1(.XMBODY)
63 D:$D(XMINSTR) XMINSTR(.XMINSTR)
64 I $G(XMINSTR("NET REPLY")),$G(XMINSTR("NET SUBJ"))'="" S XMINSTR("NET SUBJ")=$$XMSUBJ("XMINSTR(""NET SUBJ"")",XMINSTR("NET SUBJ"))
65 Q
66SENDMSG(XMDUZ,XMSUBJ,XMBODY,XMTO,XMINSTR,XMATTACH) ;
67 K XMERR,^TMP("XMERR",$J)
68 D XMDUZ(.XMDUZ,.XMV)
69 S XMSUBJ=$$XMSUBJ("XMSUBJ",$G(XMSUBJ))
70 D XMBODY^XMXPARM1(.XMBODY)
71 D XMTO^XMXPARM1(.XMTO,$G(XMINSTR("ADDR FLAGS"))["I") ; need at least one
72 D:$D(XMINSTR) XMINSTR(.XMINSTR)
73 D:$D(XMATTACH) XMATTACH^XMXPARM1(.XMATTACH)
74 Q
75VAPORMSG(XMDUZ,XMK,XMKZA,XMINSTR) ;
76 D ACTMSGS(.XMDUZ,.XMK,.XMKZA)
77 I $D(XMINSTR("VAPOR")) D Q
78 . I XMINSTR("VAPOR")="@" Q
79 . S XMINSTR("VAPOR")=$$XMDATE("XMINSTR(""VAPOR"")",XMINSTR("VAPOR"))
80 I $G(XMINSTR)'="" D Q
81 . I XMINSTR="@" Q
82 . S XMINSTR=$$XMDATE("VAPOR",XMINSTR)
83 D ERRSET^XMXUTIL(39417) ;Vaporize date must be supplied.
84 Q
85ADDRNSND(XMDUZ,XMZ,XMTO,XMINSTR) ;
86 K XMERR,^TMP("XMERR",$J)
87 D XMDUZ(.XMDUZ,.XMV)
88 D XMZ(.XMZ)
89 D XMTO^XMXPARM1(.XMTO,$G(XMINSTR("ADDR FLAGS"))["I") ; need at least one
90 D:$D(XMINSTR) XMINSTR(.XMINSTR)
91 Q
92MOVEBODY(XMZ,XMBODY) ;
93 K XMERR,^TMP("XMERR",$J)
94 D XMZ(.XMZ)
95 D XMBODY^XMXPARM1(.XMBODY)
96 Q
97VSUBJ(XMSUBJ) ;
98 K XMERR,^TMP("XMERR",$J)
99 S XMSUBJ=$$XMSUBJ("XMSUBJ",$G(XMSUBJ))
100 Q
101ITOWHOM(XMDUZ,XMZ,XMTYPE,XMINSTR) ;
102 K XMERR,^TMP("XMERR",$J)
103 D XMDUZ(.XMDUZ,.XMV)
104 D XMFLAG("XMTYPE",XMTYPE,"SF")
105 I XMTYPE'="S",XMINSTR("ADDR FLAGS")'["R" D XMZ(.XMZ)
106 D:$D(XMINSTR) XMINSTR(.XMINSTR)
107 Q
108TOWHOM(XMDUZ,XMZ,XMTYPE,XMTO,XMINSTR) ;
109 D ITOWHOM(.XMDUZ,.XMZ,.XMTYPE,.XMINSTR)
110 D XMTO^XMXPARM1(XMTO,$G(XMINSTR("ADDR FLAGS"))["I") ; need at least one
111 Q
112XMDUZ(XMDUZ,XMV) ;
113 S:$G(XMDUZ)="" XMDUZ=DUZ
114 D CHKUSER^XMXPARM1(.XMDUZ)
115 ; Need XMV "NAME","DUZ NAME", "NETNAME", "VERSION"
116 ; ^XMB("NETNAME"),^XMB("NUM"),^XMB("VIA")
117 I XMDUZ'=DUZ D
118 . I $D(^XUSEC("XMNOPRIV",DUZ)) D Q ;You have been given the XMNOPRIV
119 . . D ERRSET^XMXUTIL(38053) ;key and may not become anyone's surrogate.
120 . I XMDUZ'=.6,'$D(^XMB(3.7,"AB",DUZ,XMDUZ)) D Q
121 . . ;You are not authorized to be a surrogate of DUZ |1|.
122 . . D ERRSET^XMXUTIL(39401,XMDUZ)
123 I $D(XMV("VERSION")),$G(XMV("DUZ NAME"))=$$NAME^XMXUTIL(DUZ),$G(XMV("NAME"))=$$NAME^XMXUTIL(XMDUZ) Q
124 D INITAPI^XMVVITAE
125 Q
126XMSUBJ(XMPARM,XMSUBJ) ; Validate a prospective message subject
127 ;I $G(XMSUBJ)="" D ERRSET^XMXUTIL(39402) Q "" ;No subject.
128 I XMSUBJ?.E1C.E S XMSUBJ=$$CTRL^XMXUTIL1(XMSUBJ)
129 I $E(XMSUBJ,1)=" "!($E(XMSUBJ,$L(XMSUBJ))=" ") S XMSUBJ=$$STRIP^XMXUTIL1(XMSUBJ)
130 I XMSUBJ[" " S XMSUBJ=$$MAXBLANK^XMXUTIL1(XMSUBJ)
131 I $G(XMSUBJ)="" Q $$EZBLD^DIALOG(34012) ;* No Subject *
132 I $L(XMSUBJ)+(2*($L(XMSUBJ,U)-1))>65!($L(XMSUBJ)<3) D Q XMSUBJ
133 . D ERRSET^XMXUTIL(39403) ;Subject must be from 3 to 65 characters long.
134 I XMSUBJ?1"R".N D Q XMSUBJ
135 . D ERRSET^XMXUTIL(39404) ;Subject 'Rnnn' reserved.
136 ;D CHK^DIE(3.9,.01,"H",XMSUBJ)
137 Q XMSUBJ
138XMINSTR(XMINSTR) ; Validate special instructions
139 S:$D(XMINSTR("RCPT BSKT")) XMINSTR("RCPT BSKT")=$$XMKN^XMXPARMB(XMDUZ,"XMINSTR(""RCPT BSKT"")",XMINSTR("RCPT BSKT"),1)
140 S:$D(XMINSTR("SELF BSKT")) XMINSTR("SELF BSKT")=$$XMK(XMDUZ,"XMINSTR(""SELF BSKT"")",XMINSTR("SELF BSKT"),1)
141 I $D(XMINSTR("SHARE DATE")) S XMINSTR("SHARE DATE")=$$XMDATE("XMINSTR(""SHARE DATE"")",XMINSTR("SHARE DATE"))
142 S:$D(XMINSTR("SHARE BSKT")) XMINSTR("SHARE BSKT")=$$XMK(.6,"XMINSTR(""SHARE BSKT"")",XMINSTR("SHARE BSKT"),1)
143 I $D(XMINSTR("VAPOR")) S XMINSTR("VAPOR")=$$XMDATE("XMINSTR(""VAPOR"")",XMINSTR("VAPOR"))
144 I $D(XMINSTR("LATER")) S XMINSTR("LATER")=$$XMDATE("XMINSTR(""LATER"")",XMINSTR("LATER"))
145 I $D(XMINSTR("FROM")) S XMINSTR("FROM")=$$XMFROM("XMINSTR(""FROM"")",XMINSTR("FROM"))
146 I $D(XMINSTR("FWD BY")) S XMINSTR("FWD BY")=$$XMFROM("XMINSTR(""FWD BY"")",XMINSTR("FWD BY"))
147 D:$D(XMINSTR("FLAGS")) XMFLAG("XMINSTR(""FLAGS"")",XMINSTR("FLAGS"),"CIPRSX")
148 I $D(XMINSTR("SCR KEY"))!$D(XMINSTR("SCR HINT")) D
149 . D XMKEY^XMXPARM1($G(XMINSTR("SCR KEY")))
150 . D XMHINT^XMXPARM1($G(XMINSTR("SCR HINT")))
151 D:$D(XMINSTR("TYPE")) XMTYPE(XMINSTR("TYPE"))
152 D:$D(XMINSTR("STRIP")) XMSTRIP^XMXPARM1(XMINSTR("STRIP"))
153 Q
154XMDATE(XMPARM,XMDATE) ;
155 N %DT,Y,X
156 S X=XMDATE
157 S %DT="FT",%DT(0)="NOW"
158 D ^%DT
159 Q:Y>0 Y
160 N XMP
161 S XMP("PARAM","ID")=XMPARM
162 S XMP("PARAM","VALUE")=XMDATE
163 D ERRSET^XMXUTIL(39409,.XMP) ;Must be a date in the future.
164 Q XMDATE
165XMFROM(XMPARM,XMFROM) ;
166 N XMHOLD
167 Q:XMFROM=.5 XMFROM
168 I +XMFROM=XMFROM!(XMFROM[U)!($L(XMFROM)>65)!(XMFROM="") D Q XMFROM
169 . N XMP S XMP("PARAM","ID")=XMPARM,XMP("PARAM","VALUE")=XMFROM
170 . ;S XMP("PARAM","FILE")=X,XMP("PARAM","FIELD")=Y
171 . ;Must be from 1 to 65 characters, no # or ^.
172 . D ERRSET^XMXUTIL(39410,.XMP)
173 S XMHOLD=XMFROM
174 S XMFROM=$$CTRL^XMXUTIL1(XMFROM)
175 S XMFROM=$$STRIP^XMXUTIL1(XMFROM)
176 S XMFROM=$$MAXBLANK^XMXUTIL1(XMFROM)
177 Q:XMFROM["POSTMASTER" XMFROM
178 ; "B^BB^C^D" = name^alias^initial^nickname
179 I $$FIND1^DIC(200,"","O",$$UP^XLFSTR(XMFROM),"B^BB^C^D")!$D(DIERR) D Q XMHOLD
180 . N XMP S XMP("PARAM","ID")=XMPARM,XMP("PARAM","VALUE")=XMHOLD
181 . ;S XMP("PARAM","FILE")=X,XMP("PARAM","FIELD")=Y
182 . D ERRSET^XMXUTIL(39411,.XMP) ;May not be a real person.
183 Q XMFROM
184XMTYPE(XMTYPE) ; Validate a message type
185 I $L(XMTYPE)'=1 D Q
186 . N XMP S XMP("PARAM","ID")="XMINSTR(""TYPE"")",XMP("PARAM","VALUE")=XMTYPE
187 . ;S XMPARM("PARAM","FILE")=3.9,XMPARM("PARAM","FIELD")=1.7
188 . D ERRSET^XMXUTIL(39412,.XMP) ;Must be 1 character.
189 D XMFLAG("XMINSTR(""TYPE"")",XMTYPE,"BDKOSX")
190 Q
191XMFLAG(XMPARM,XMFLAG,FLAGSET) ;
192 N XMLEFT
193 S XMLEFT=$TR(XMFLAG,FLAGSET,"")
194 Q:XMLEFT=""
195 N XMP S XMP("PARAM","ID")=XMPARM,XMP("PARAM","VALUE")=XMFLAG,XMP(1)=XMLEFT
196 D ERRSET^XMXUTIL(39413,.XMP) ;|1| is not valid.
197 Q
198XMKTO(XMDUZ,XMKTO) ;
199 I $G(XMKTO)="" D Q
200 . N XMP S XMP("PARAM","ID")="XMKTO",XMP("PARAM","VALUE")=""
201 . D ERRSET^XMXUTIL(39416,.XMP) ;Destination basket must be supplied.
202 S XMKTO=$$XMK(XMDUZ,"XMKTO",XMKTO)
203 Q
204XMK(XMDUZ,XMPARM,XMK,XMOPTNL) ;
205 I +XMK=XMK,$D(^XMB(3.7,XMDUZ,2,XMK)) Q XMK
206 ; Just in case a name was passed...
207 N XMKN
208 S XMKN=XMK
209 S XMK=$$FIND1^DIC(3.701,","_XMDUZ_",","OQ",XMKN)
210 Q:XMK XMK
211 I '$D(DIERR),$G(XMOPTNL) Q XMKN ; Basket not found. Will create on delivery.
212 N XMP S XMP("PARAM","ID")=XMPARM,XMP("PARAM","VALUE")=XMKN,XMP(1)=XMKN
213 ;Basket name '|1|' ambiguous / not found.
214 D ERRSET^XMXUTIL($S($D(DIERR):39414,1:39415),.XMP)
215 Q XMKN
216XMZ(XMZ) ;
217 I $G(XMZ),$D(^XMB(3.9,XMZ,0)) Q
218 D ERRSET^XMXUTIL(34353,XMZ) ;Message '|1|' does not exist.
219 Q
Note: See TracBrowser for help on using the repository browser.