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

VAQBUL.m

Go to the documentation of this file.
  1. VAQBUL ;ALB/JRP - BULLETINS;25-MAY-93
  1. ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
  1. SENDBULL(SUBJECT,SENTBY,FWRDBY,ROOT) ;BUILD AND SEND BULLETIN
  1. ;INPUT : SUBJECT - Subject of message
  1. ; SENTBY - 'User' sending message
  1. ; FWRDBY - 'User' fowarding the message (defaults to SENTBY)
  1. ; ROOT - Where the message text is stored (full global ref)
  1. ; ROOT(Line#,0)=Line of text
  1. ; XMY() - Recipient list
  1. ;OUTPUT : XMZ - Message number of message sent
  1. ; -1^Error_Text - Message not sent
  1. ;
  1. ;CHECK INPUT
  1. Q:($G(SUBJECT)="") "-1^Did not pass subject of message"
  1. Q:($G(SENTBY)="") "-1^Did not pass sender of message"
  1. S:($G(FWRDBY)="") FWRDBY=SENTBY
  1. Q:($G(ROOT)="") "-1^Did not pass array containing message"
  1. Q:('$D(@ROOT)) "-1^Did not valid array reference"
  1. Q:($O(@ROOT@(""))="") "-1^Array did not contain message"
  1. Q:('$D(XMY)) "-1^Did not pass distribution list"
  1. Q:($O(XMY(""))="") "-1^Distributionl list was empty"
  1. ;DECLARE VARIABLES
  1. N XMZ,XMDUN,LINE,OFFSET,TMP,X,XMCHAN
  1. S XMCHAN=1
  1. ;GET STUB MESSAGE
  1. S XMZ=$$MAKESTUB^VAQCON1(SUBJECT,SENTBY)
  1. I (XMZ<1) Q "-1^Could not get stub message"
  1. ;COPY TEXT INTO MESSAGE
  1. S LINE=1
  1. S OFFSET=0
  1. F S OFFSET=+$O(@ROOT@(OFFSET)) Q:('OFFSET) D
  1. .S TMP=$G(@ROOT@(OFFSET,0))
  1. .S X=$$ADDLINE^VAQCON1(TMP,XMZ,LINE)
  1. .S LINE=LINE+1
  1. ;SET ZERO NODE
  1. S X=$$SETZERO^VAQCON1(XMZ,(LINE-1))
  1. ;FOWARD (SEND) MESSAGE
  1. S XMDUN=FWRDBY
  1. D ENT1^XMD
  1. Q XMZ