source: FOIAVistA/trunk/r/MAILMAN-XM/XMXAPIG.m@ 1757

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

initial load of FOIAVistA 6/30/08 version

File size: 3.7 KB
Line 
1XMXAPIG ;ISC-SF/GMB-Mail Group APIs ;03/25/2003 14:48
2 ;;8.0;MailMan;**16**;Jun 28, 2002
3 ; All entry points covered by DBIA 3006
4 ; Variables input:
5 ; XMGROUP Group's IEN or exact name
6ADDMBRS(XMDUZ,XMGRP,XMMBR,XMINSTR,XMTSK) ; Add members to groups
7 ; XMGRP Same as XMGROUP, or array XMGRP(XMGROUP)=""
8 ; XMMBR Member or array of members to add.
9 I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
10 K XMERR,^TMP("XMERR",$J)
11 D XMDUZ^XMXPARM(.XMDUZ,.XMV)
12 I $D(XMINSTR) D XMINSTR(.XMINSTR)
13 Q:$D(XMERR)
14 D ADDMBRS^XMXGRP(XMDUZ,.XMGRP,.XMMBR,.XMINSTR,.XMTSK)
15 Q
16JOIN(XMDUZ,XMGROUP,XMINSTR,XMTSK) ; User chooses to join a group.
17 I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
18 K XMERR,^TMP("XMERR",$J)
19 D XMDUZ^XMXPARM(.XMDUZ,.XMV)
20 I $D(XMINSTR) D XMINSTR(.XMINSTR)
21 D JOIN^XMXGRP(XMDUZ,XMGROUP,.XMINSTR,.XMTSK)
22 Q
23DROP(XMDUZ,XMGROUP) ; User chooses to drop from a group.
24 I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
25 K XMERR,^TMP("XMERR",$J)
26 D XMDUZ^XMXPARM(.XMDUZ,.XMV) Q:$D(XMERR)
27 D DROP^XMXGRP(XMDUZ,XMGROUP)
28 Q
29XMINSTR(XMINSTR) ;
30 S:$D(XMINSTR("SELF BSKT")) XMINSTR("SELF BSKT")=$$XMK^XMXPARM(XMDUZ,"XMINSTR(""SELF BSKT"")",XMINSTR("SELF BSKT"),1)
31 I $D(XMINSTR("FLAGS")) D XMFLAG^XMXPARM("XMINSTR(""FLAGS"")",XMINSTR("FLAGS"),"AF")
32 S:$D(XMINSTR("FDATE")) XMINSTR("FDATE")=$$XMDATE^XMXPARMB("XMINSTR(""FDATE"")",XMINSTR("FDATE"))
33 S:$D(XMINSTR("TDATE")) XMINSTR("TDATE")=$$XMDATE^XMXPARMB("XMINSTR(""TDATE"")",XMINSTR("TDATE"))
34 Q
35GOTLOCAL(XMGROUP,XMDAYS,XMMBRS) ; Function: Any active local members? (1=yes; 0=no)
36 ; XMDAYS (optional) add'l requirement that the member must have used
37 ; MailMan within the last XMDAYS days.
38 ; XMMBRS (optional) add'l requirement that this many local members must
39 ; be in the group. (default is 1)
40 N XMGIEN,XMSCREEN,XMLIST
41 K XMERR,^TMP("XMERR",$J)
42 S XMGIEN=$$IEN(XMGROUP) Q:$D(XMERR) 0
43 ; User must have access code and mailbox
44 S XMSCREEN="N XM S XM=+^(0) I $L($P($G(^VA(200,XM,0)),U,3)),$D(^XMB(3.7,XM,2))"
45 I $G(XMDAYS) S XMSCREEN=XMSCREEN_",$P($G(^(""L"")),U,2)'<"_$$FMADD^XLFDT(DT,-XMDAYS)
46 I '$G(XMMBRS) S XMMBRS=1
47 D LIST^DIC(3.81,","_XMGIEN_",","@","I",XMMBRS,"","","",XMSCREEN,"","XMLIST")
48 Q:+XMLIST("DILIST",0)=XMMBRS 1
49 ; none found
50 K:$D(DIERR) DIERR,^TMP("DIERR",$J)
51 N XMPARM,XMDIALOG
52 S XMPARM(1)=$$NAME(XMGIEN),XMDIALOG=39503 ;Mail group '|1|' has no active local members
53 I $G(XMDAYS) S XMPARM(2)=$$FMTE^XLFDT($$FMADD^XLFDT(DT,-XMDAYS),5),XMDIALOG=39504 ;Mail group '|1|' has no local members active since '|2|'
54 I $G(XMMBRS) S XMPARM(3)=XMMBRS,XMDIALOG=XMDIALOG+.1
55 ;39503.1-Mail group '|1|' does not have at least |3| active local members
56 ;39504.1-Mail group '|1|' does not have at least |3| local members who have been active since '|2|'.
57 D ERRSET^XMXUTIL(XMDIALOG,.XMPARM)
58 Q 0
59IEN(XMGROUP) ; INTERNAL USE ONLY function, given group's ien or exact name, returns ien
60 I +XMGROUP=XMGROUP D Q XMGROUP
61 . I $D(^XMB(3.8,XMGROUP,0)) Q
62 . D ERRSET^XMXUTIL(39502,XMGROUP) ;Mail group IEN '|1|' not found.
63 . S XMGROUP=0
64 N XMGIEN
65 S XMGIEN=$O(^XMB(3.8,"B",XMGROUP,0)) Q:XMGIEN XMGIEN
66 D ERRSET^XMXUTIL(39501,XMGROUP) ;Mail group '|1|' not found.
67 Q 0
68NAME(XMGIEN) ; INTERNAL USE ONLY function, given group's ien, returns name
69 Q $P($G(^XMB(3.8,XMGIEN,0)),U,1)
70MEMBER(XMDUZ,XMGROUP,XMCHKSUB) ; Is user a member of the group?
71 ; XMCHKSUB - Check member groups, too? (0=no; 1=yes)
72 N XMGIEN,XMCHECKD
73 K XMERR,^TMP("XMERR",$J)
74 S XMGIEN=$$IEN(XMGROUP) Q:$D(XMERR) 0
75 I '$G(XMCHKSUB) Q $D(^XMB(3.8,XMGIEN,1,"B",XMDUZ))>0
76 Q $$SUBMBR(XMDUZ,XMGIEN)
77SUBMBR(XMDUZ,XMGIEN) ;
78 I $D(^XMB(3.8,XMGIEN,1,"B",XMDUZ)) Q 1
79 N XMI,XMMBR
80 S XMCHECKD(XMGIEN)=""
81 S XMI=0
82 F S XMI=$O(^XMB(3.8,XMGIEN,5,"B",XMI)) Q:'XMI D Q:$G(XMMBR)
83 . Q:'$D(^XMB(3.8,XMI))
84 . Q:$D(XMCHECKD(XMI))
85 . S XMMBR=$$SUBMBR(XMDUZ,XMI)
86 Q +$G(XMMBR)
Note: See TracBrowser for help on using the repository browser.