[613] | 1 | VAQBUL ;ALB/JRP - BULLETINS;25-MAY-93
|
---|
| 2 | ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
|
---|
| 3 | SENDBULL(SUBJECT,SENTBY,FWRDBY,ROOT) ;BUILD AND SEND BULLETIN
|
---|
| 4 | ;INPUT : SUBJECT - Subject of message
|
---|
| 5 | ; SENTBY - 'User' sending message
|
---|
| 6 | ; FWRDBY - 'User' fowarding the message (defaults to SENTBY)
|
---|
| 7 | ; ROOT - Where the message text is stored (full global ref)
|
---|
| 8 | ; ROOT(Line#,0)=Line of text
|
---|
| 9 | ; XMY() - Recipient list
|
---|
| 10 | ;OUTPUT : XMZ - Message number of message sent
|
---|
| 11 | ; -1^Error_Text - Message not sent
|
---|
| 12 | ;
|
---|
| 13 | ;CHECK INPUT
|
---|
| 14 | Q:($G(SUBJECT)="") "-1^Did not pass subject of message"
|
---|
| 15 | Q:($G(SENTBY)="") "-1^Did not pass sender of message"
|
---|
| 16 | S:($G(FWRDBY)="") FWRDBY=SENTBY
|
---|
| 17 | Q:($G(ROOT)="") "-1^Did not pass array containing message"
|
---|
| 18 | Q:('$D(@ROOT)) "-1^Did not valid array reference"
|
---|
| 19 | Q:($O(@ROOT@(""))="") "-1^Array did not contain message"
|
---|
| 20 | Q:('$D(XMY)) "-1^Did not pass distribution list"
|
---|
| 21 | Q:($O(XMY(""))="") "-1^Distributionl list was empty"
|
---|
| 22 | ;DECLARE VARIABLES
|
---|
| 23 | N XMZ,XMDUN,LINE,OFFSET,TMP,X,XMCHAN
|
---|
| 24 | S XMCHAN=1
|
---|
| 25 | ;GET STUB MESSAGE
|
---|
| 26 | S XMZ=$$MAKESTUB^VAQCON1(SUBJECT,SENTBY)
|
---|
| 27 | I (XMZ<1) Q "-1^Could not get stub message"
|
---|
| 28 | ;COPY TEXT INTO MESSAGE
|
---|
| 29 | S LINE=1
|
---|
| 30 | S OFFSET=0
|
---|
| 31 | F S OFFSET=+$O(@ROOT@(OFFSET)) Q:('OFFSET) D
|
---|
| 32 | .S TMP=$G(@ROOT@(OFFSET,0))
|
---|
| 33 | .S X=$$ADDLINE^VAQCON1(TMP,XMZ,LINE)
|
---|
| 34 | .S LINE=LINE+1
|
---|
| 35 | ;SET ZERO NODE
|
---|
| 36 | S X=$$SETZERO^VAQCON1(XMZ,(LINE-1))
|
---|
| 37 | ;FOWARD (SEND) MESSAGE
|
---|
| 38 | S XMDUN=FWRDBY
|
---|
| 39 | D ENT1^XMD
|
---|
| 40 | Q XMZ
|
---|