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