XMB ;ISC-SF/GMB-Send Bulletin APIs ;04/17/2002 07:38
;;8.0;MailMan;;Jun 28, 2002
; Was (WASH ISC)/THM/RWF/CAP
;
; Entry points are (DBIA 10069):
; ^XMB Create and deliver a bulletin in the background (task).
; EN^XMB Create a bulletin in the foreground (now) and send it in
; the background (task)
; BULL^XMB Interactive create and send a bulletin
;
; The recipients of the bulletin include any entries in the XMY
; array that the caller has defined and the members of mail group
; that are included in the definition of the entry in the Bulletin
; file (#3.6) at the time of delivery. There must be valid
; recipients or the message will not be delivered.
;
; I/O Variables:
; XMB (in) Bulletin name (an entry in File #3.6)
; XMB(parameter#) (in, optional) Value to be stuffed into the bulletin
; for each required parameter
; eg. XMB(1)=data for parameter#1
; XMTEXT (in, optional) Name of array containing
; additional bulletin text
; XMY (in, optional) Array of additional recipients of a
; bulletin
; XMDUZ (in, optional) Sender # or string saying who or what
; sent the bulletin (default=DUZ)
; XMDT (in, optional) Date/time to send bulletin (default=now)
; XMYBLOB (in, optional) MIME array
; XMZ (out) Message number (if successful)
;
; Entry ^XMB:
; Needs: XMB
; Accepts: XMDUZ,XMTEXT,XMY,XMDT,XMYBLOB
; Returns: (XMB=-1 if bulletin does not exist in file 3.6)
; Kills: XMTEXT,XMY
N XMINSTR,XMATTACH,XMTASK
K XMERR,^TMP("XMERR",$J)
I '$O(^XMB(3.6,"B",XMB,"")) S XMB=-1 Q
I '$G(DUZ) N DUZ D DUZ^XUP(.5)
I $G(XMDUZ)=""!($G(XMDUZ)=0) S XMDUZ=DUZ
I XMDUZ'?.N S %=XMDUZ N XMDUZ S XMDUZ=% K %
D:$D(XMYBLOB) SETBLOB(.XMYBLOB,.XMATTACH)
D:$D(XMDT) SETLATER(XMDT,.XMINSTR)
I XMDUZ'?.N D SETFROM^XMD(.XMDUZ,.XMINSTR) Q:$G(XMMG)["Error ="
D INITAPI^XMVVITAE
S:$D(XMTEXT) XMTEXT=$$CREF^DILF(XMTEXT)
S:$D(XMDF) XMINSTR("ADDR FLAGS")="R" ; Ignore addressee restrictions
S:$D(XMBTMP) XMINSTR("ADDR FLAGS")=$G(XMINSTR("ADDR FLAGS"))_"I" ; Don't initialize (kill) the ^TMP addressee global
D TASKBULL^XMXBULL(XMDUZ,XMB,.XMB,.XMTEXT,.XMY,.XMINSTR,.XMTASK,.XMATTACH)
K:$D(XMERR) XMERR,^TMP("XMERR",$J)
K XMTEXT,XMY
Q
EN ;Interactive Bulletin Entry Point
; Needs: XMB
; Accepts: XMDUZ,XMTEXT,XMY,XMDT,XMYBLOB
; Returns: XMZ,(XMB=-1 if bulletin does not exist in file 3.6)
; Kills: XMB,XMTEXT,XMY
N XMBIEN,XMINSTR
K XMERR,^TMP("XMERR",$J)
S XMBIEN=$O(^XMB(3.6,"B",XMB,"")) I XMBIEN="" S XMB=-1 Q
I '$G(DUZ) N DUZ D DUZ^XUP(.5)
I $G(XMDUZ)=""!($G(XMDUZ)=0) S XMDUZ=DUZ
I XMDUZ'?.N S %=XMDUZ N XMDUZ S XMDUZ=% K %
D:$D(XMYBLOB) SETBLOB(.XMYBLOB,.XMATTACH)
I XMDUZ'?.N D SETFROM^XMD(.XMDUZ,.XMINSTR) Q:$G(XMMG)["Error ="
S:$D(XMTEXT) XMTEXT=$$CREF^DILF(XMTEXT)
S:$D(XMDF) XMINSTR("ADDR FLAGS")="R" ; Ignore addressee restrictions
S:$D(XMBTMP) XMINSTR("ADDR FLAGS")=$G(XMINSTR("ADDR FLAGS"))_"I" ; Don't initialize (kill) the ^TMP addressee global
D SEND^XMXBULL(XMDUZ,XMBIEN,.XMB,.XMTEXT,.XMY,.XMINSTR,.XMZ,.XMATTACH)
K:$D(XMERR) XMERR,^TMP("XMERR",$J)
K XMB,XMTEXT,XMY
Q
SETBLOB(XMYBLOB,XMATTACH) ;
N %X,%Y
S %X="XMYBLOB(",%Y="XMATTACH(""IMAGE""," D %XY^%RCR
Q
SETLATER(XMDT,XMINSTR) ;
S XMINSTR("LATER")=$$XMDATE^XMXPARM("XMDT",XMDT)
I $D(XMERR) K XMINSTR("LATER"),XMERR,^TMP("XMERR",$J)
Q
BULL ; Manually post a bulletin
D BULLETIN^XMJMBULL
Q
ZTSK ; Entry point for TaskMan to transmit messages to a site.
; Needed for transition from v7.1 to v8.0. Once site has transitioned,
; this entry point can be deleted.
S ZTREQ="@"
S XMINST=XMB("XMSCR")
Q:$$OBE^XMTDR(XMINST)
S XMTREC=$G(^XMBS(4.2999,XMINST,4))
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)
S ^XMBS(4.2999,XMINST,5)=XMB("SCRIPT")
K XMB,XMTREC
G TASK^XMTDR
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXMB 4076 printed Oct 16, 2024@18:11:49 Page 2
XMB ;ISC-SF/GMB-Send Bulletin APIs ;04/17/2002 07:38
+1 ;;8.0;MailMan;;Jun 28, 2002
+2 ; Was (WASH ISC)/THM/RWF/CAP
+3 ;
+4 ; Entry points are (DBIA 10069):
+5 ; ^XMB Create and deliver a bulletin in the background (task).
+6 ; EN^XMB Create a bulletin in the foreground (now) and send it in
+7 ; the background (task)
+8 ; BULL^XMB Interactive create and send a bulletin
+9 ;
+10 ; The recipients of the bulletin include any entries in the XMY
+11 ; array that the caller has defined and the members of mail group
+12 ; that are included in the definition of the entry in the Bulletin
+13 ; file (#3.6) at the time of delivery. There must be valid
+14 ; recipients or the message will not be delivered.
+15 ;
+16 ; I/O Variables:
+17 ; XMB (in) Bulletin name (an entry in File #3.6)
+18 ; XMB(parameter#) (in, optional) Value to be stuffed into the bulletin
+19 ; for each required parameter
+20 ; eg. XMB(1)=data for parameter#1
+21 ; XMTEXT (in, optional) Name of array containing
+22 ; additional bulletin text
+23 ; XMY (in, optional) Array of additional recipients of a
+24 ; bulletin
+25 ; XMDUZ (in, optional) Sender # or string saying who or what
+26 ; sent the bulletin (default=DUZ)
+27 ; XMDT (in, optional) Date/time to send bulletin (default=now)
+28 ; XMYBLOB (in, optional) MIME array
+29 ; XMZ (out) Message number (if successful)
+30 ;
+31 ; Entry ^XMB:
+32 ; Needs: XMB
+33 ; Accepts: XMDUZ,XMTEXT,XMY,XMDT,XMYBLOB
+34 ; Returns: (XMB=-1 if bulletin does not exist in file 3.6)
+35 ; Kills: XMTEXT,XMY
+36 NEW XMINSTR,XMATTACH,XMTASK
+37 KILL XMERR,^TMP("XMERR",$JOB)
+38 IF '$ORDER(^XMB(3.6,"B",XMB,""))
SET XMB=-1
QUIT
+39 IF '$GET(DUZ)
NEW DUZ
DO DUZ^XUP(.5)
+40 IF $GET(XMDUZ)=""!($GET(XMDUZ)=0)
SET XMDUZ=DUZ
+41 IF XMDUZ'?.N
SET %=XMDUZ
NEW XMDUZ
SET XMDUZ=%
KILL %
+42 if $DATA(XMYBLOB)
DO SETBLOB(.XMYBLOB,.XMATTACH)
+43 if $DATA(XMDT)
DO SETLATER(XMDT,.XMINSTR)
+44 IF XMDUZ'?.N
DO SETFROM^XMD(.XMDUZ,.XMINSTR)
if $GET(XMMG)["Error ="
QUIT
+45 DO INITAPI^XMVVITAE
+46 if $DATA(XMTEXT)
SET XMTEXT=$$CREF^DILF(XMTEXT)
+47 ; Ignore addressee restrictions
if $DATA(XMDF)
SET XMINSTR("ADDR FLAGS")="R"
+48 ; Don't initialize (kill) the ^TMP addressee global
if $DATA(XMBTMP)
SET XMINSTR("ADDR FLAGS")=$GET(XMINSTR("ADDR FLAGS"))_"I"
+49 DO TASKBULL^XMXBULL(XMDUZ,XMB,.XMB,.XMTEXT,.XMY,.XMINSTR,.XMTASK,.XMATTACH)
+50 if $DATA(XMERR)
KILL XMERR,^TMP("XMERR",$JOB)
+51 KILL XMTEXT,XMY
+52 QUIT
EN ;Interactive Bulletin Entry Point
+1 ; Needs: XMB
+2 ; Accepts: XMDUZ,XMTEXT,XMY,XMDT,XMYBLOB
+3 ; Returns: XMZ,(XMB=-1 if bulletin does not exist in file 3.6)
+4 ; Kills: XMB,XMTEXT,XMY
+5 NEW XMBIEN,XMINSTR
+6 KILL XMERR,^TMP("XMERR",$JOB)
+7 SET XMBIEN=$ORDER(^XMB(3.6,"B",XMB,""))
IF XMBIEN=""
SET XMB=-1
QUIT
+8 IF '$GET(DUZ)
NEW DUZ
DO DUZ^XUP(.5)
+9 IF $GET(XMDUZ)=""!($GET(XMDUZ)=0)
SET XMDUZ=DUZ
+10 IF XMDUZ'?.N
SET %=XMDUZ
NEW XMDUZ
SET XMDUZ=%
KILL %
+11 if $DATA(XMYBLOB)
DO SETBLOB(.XMYBLOB,.XMATTACH)
+12 IF XMDUZ'?.N
DO SETFROM^XMD(.XMDUZ,.XMINSTR)
if $GET(XMMG)["Error ="
QUIT
+13 if $DATA(XMTEXT)
SET XMTEXT=$$CREF^DILF(XMTEXT)
+14 ; Ignore addressee restrictions
if $DATA(XMDF)
SET XMINSTR("ADDR FLAGS")="R"
+15 ; Don't initialize (kill) the ^TMP addressee global
if $DATA(XMBTMP)
SET XMINSTR("ADDR FLAGS")=$GET(XMINSTR("ADDR FLAGS"))_"I"
+16 DO SEND^XMXBULL(XMDUZ,XMBIEN,.XMB,.XMTEXT,.XMY,.XMINSTR,.XMZ,.XMATTACH)
+17 if $DATA(XMERR)
KILL XMERR,^TMP("XMERR",$JOB)
+18 KILL XMB,XMTEXT,XMY
+19 QUIT
SETBLOB(XMYBLOB,XMATTACH) ;
+1 NEW %X,%Y
+2 SET %X="XMYBLOB("
SET %Y="XMATTACH(""IMAGE"","
DO %XY^%RCR
+3 QUIT
SETLATER(XMDT,XMINSTR) ;
+1 SET XMINSTR("LATER")=$$XMDATE^XMXPARM("XMDT",XMDT)
+2 IF $DATA(XMERR)
KILL XMINSTR("LATER"),XMERR,^TMP("XMERR",$JOB)
+3 QUIT
BULL ; Manually post a bulletin
+1 DO BULLETIN^XMJMBULL
+2 QUIT
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,
+2 ; this entry point can be deleted.
+3 SET ZTREQ="@"
+4 SET XMINST=XMB("XMSCR")
+5 if $$OBE^XMTDR(XMINST)
QUIT
+6 SET XMTREC=$GET(^XMBS(4.2999,XMINST,4))
+7 SET ^XMBS(4.2999,XMINST,4)=$PIECE(XMTREC,U,1,2)_U_XMB("SCRIPT",0)_U_XMB("TRIES")_U_U_XMB("ITERATIONS")_U_XMB("FIRST SCRIPT")_U_$PIECE(XMB("SCRIPT"),U,6)
+8 SET ^XMBS(4.2999,XMINST,5)=XMB("SCRIPT")
+9 KILL XMB,XMTREC
+10 GOTO TASK^XMTDR
+11 QUIT