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

XMB.m

Go to the documentation of this file.
  1. XMB ;ISC-SF/GMB-Send Bulletin APIs ;04/17/2002 07:38
  1. ;;8.0;MailMan;;Jun 28, 2002
  1. ; Was (WASH ISC)/THM/RWF/CAP
  1. ;
  1. ; Entry points are (DBIA 10069):
  1. ; ^XMB Create and deliver a bulletin in the background (task).
  1. ; EN^XMB Create a bulletin in the foreground (now) and send it in
  1. ; the background (task)
  1. ; BULL^XMB Interactive create and send a bulletin
  1. ;
  1. ; The recipients of the bulletin include any entries in the XMY
  1. ; array that the caller has defined and the members of mail group
  1. ; that are included in the definition of the entry in the Bulletin
  1. ; file (#3.6) at the time of delivery. There must be valid
  1. ; recipients or the message will not be delivered.
  1. ;
  1. ; I/O Variables:
  1. ; XMB (in) Bulletin name (an entry in File #3.6)
  1. ; XMB(parameter#) (in, optional) Value to be stuffed into the bulletin
  1. ; for each required parameter
  1. ; eg. XMB(1)=data for parameter#1
  1. ; XMTEXT (in, optional) Name of array containing
  1. ; additional bulletin text
  1. ; XMY (in, optional) Array of additional recipients of a
  1. ; bulletin
  1. ; XMDUZ (in, optional) Sender # or string saying who or what
  1. ; sent the bulletin (default=DUZ)
  1. ; XMDT (in, optional) Date/time to send bulletin (default=now)
  1. ; XMYBLOB (in, optional) MIME array
  1. ; XMZ (out) Message number (if successful)
  1. ;
  1. ; Entry ^XMB:
  1. ; Needs: XMB
  1. ; Accepts: XMDUZ,XMTEXT,XMY,XMDT,XMYBLOB
  1. ; Returns: (XMB=-1 if bulletin does not exist in file 3.6)
  1. ; Kills: XMTEXT,XMY
  1. N XMINSTR,XMATTACH,XMTASK
  1. K XMERR,^TMP("XMERR",$J)
  1. I '$O(^XMB(3.6,"B",XMB,"")) S XMB=-1 Q
  1. I '$G(DUZ) N DUZ D DUZ^XUP(.5)
  1. I $G(XMDUZ)=""!($G(XMDUZ)=0) S XMDUZ=DUZ
  1. I XMDUZ'?.N S %=XMDUZ N XMDUZ S XMDUZ=% K %
  1. D:$D(XMYBLOB) SETBLOB(.XMYBLOB,.XMATTACH)
  1. D:$D(XMDT) SETLATER(XMDT,.XMINSTR)
  1. I XMDUZ'?.N D SETFROM^XMD(.XMDUZ,.XMINSTR) Q:$G(XMMG)["Error ="
  1. D INITAPI^XMVVITAE
  1. S:$D(XMTEXT) XMTEXT=$$CREF^DILF(XMTEXT)
  1. S:$D(XMDF) XMINSTR("ADDR FLAGS")="R" ; Ignore addressee restrictions
  1. S:$D(XMBTMP) XMINSTR("ADDR FLAGS")=$G(XMINSTR("ADDR FLAGS"))_"I" ; Don't initialize (kill) the ^TMP addressee global
  1. D TASKBULL^XMXBULL(XMDUZ,XMB,.XMB,.XMTEXT,.XMY,.XMINSTR,.XMTASK,.XMATTACH)
  1. K:$D(XMERR) XMERR,^TMP("XMERR",$J)
  1. K XMTEXT,XMY
  1. Q
  1. EN ;Interactive Bulletin Entry Point
  1. ; Needs: XMB
  1. ; Accepts: XMDUZ,XMTEXT,XMY,XMDT,XMYBLOB
  1. ; Returns: XMZ,(XMB=-1 if bulletin does not exist in file 3.6)
  1. ; Kills: XMB,XMTEXT,XMY
  1. N XMBIEN,XMINSTR
  1. K XMERR,^TMP("XMERR",$J)
  1. S XMBIEN=$O(^XMB(3.6,"B",XMB,"")) I XMBIEN="" S XMB=-1 Q
  1. I '$G(DUZ) N DUZ D DUZ^XUP(.5)
  1. I $G(XMDUZ)=""!($G(XMDUZ)=0) S XMDUZ=DUZ
  1. I XMDUZ'?.N S %=XMDUZ N XMDUZ S XMDUZ=% K %
  1. D:$D(XMYBLOB) SETBLOB(.XMYBLOB,.XMATTACH)
  1. I XMDUZ'?.N D SETFROM^XMD(.XMDUZ,.XMINSTR) Q:$G(XMMG)["Error ="
  1. S:$D(XMTEXT) XMTEXT=$$CREF^DILF(XMTEXT)
  1. S:$D(XMDF) XMINSTR("ADDR FLAGS")="R" ; Ignore addressee restrictions
  1. S:$D(XMBTMP) XMINSTR("ADDR FLAGS")=$G(XMINSTR("ADDR FLAGS"))_"I" ; Don't initialize (kill) the ^TMP addressee global
  1. D SEND^XMXBULL(XMDUZ,XMBIEN,.XMB,.XMTEXT,.XMY,.XMINSTR,.XMZ,.XMATTACH)
  1. K:$D(XMERR) XMERR,^TMP("XMERR",$J)
  1. K XMB,XMTEXT,XMY
  1. Q
  1. SETBLOB(XMYBLOB,XMATTACH) ;
  1. N %X,%Y
  1. S %X="XMYBLOB(",%Y="XMATTACH(""IMAGE""," D %XY^%RCR
  1. Q
  1. SETLATER(XMDT,XMINSTR) ;
  1. S XMINSTR("LATER")=$$XMDATE^XMXPARM("XMDT",XMDT)
  1. I $D(XMERR) K XMINSTR("LATER"),XMERR,^TMP("XMERR",$J)
  1. Q
  1. BULL ; Manually post a bulletin
  1. D BULLETIN^XMJMBULL
  1. Q
  1. ZTSK ; Entry point for TaskMan to transmit messages to a site.
  1. ; Needed for transition from v7.1 to v8.0. Once site has transitioned,
  1. ; this entry point can be deleted.
  1. S ZTREQ="@"
  1. S XMINST=XMB("XMSCR")
  1. Q:$$OBE^XMTDR(XMINST)
  1. S XMTREC=$G(^XMBS(4.2999,XMINST,4))
  1. S ^XMBS(4.2999,XMINST,4)=$P(XMTREC,U,1,2)_U_XMB("SCRIPT",0)_U_XMB("TRIES")_U_U_XMB("ITERATIONS")_U_XMB("FIRST SCRIPT")_U_$P(XMB("SCRIPT"),U,6)
  1. S ^XMBS(4.2999,XMINST,5)=XMB("SCRIPT")
  1. K XMB,XMTREC
  1. G TASK^XMTDR
  1. Q