| 1 | PXRMMSG ; SLC/PKR - Routine for sending MailMan messages. ;05/17/2002
 | 
|---|
| 2 |  ;;2.0;CLINICAL REMINDERS;;Feb 04, 2005
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 |  ;======================================================================
 | 
|---|
| 5 | SEND(XMSUB,USER) ;Send a MailMan message to the mail group defined
 | 
|---|
| 6 |  ;by the site and to the user. The text of the message is in
 | 
|---|
| 7 |  ;^TMP("PXRMXMZ",$J,N,0), where the are N lines of text. The subject
 | 
|---|
| 8 |  ;is the string XMSUB.
 | 
|---|
| 9 |  N MGIEN,MGROUP,NL,REF,XMDUZ,XMY,XMZ
 | 
|---|
| 10 |  ;
 | 
|---|
| 11 |  ;If this is a test run write out the message.
 | 
|---|
| 12 |  I $G(PXRMDEBG) D
 | 
|---|
| 13 |  . S REF="^TMP(""PXRMXMZ"",$J)"
 | 
|---|
| 14 |  . D AWRITE^PXRMUTIL(REF)
 | 
|---|
| 15 |  ;
 | 
|---|
| 16 |  ;Make sure the subject does not exceed 64 characters.
 | 
|---|
| 17 |  S XMSUB=$E(XMSUB,1,64)
 | 
|---|
| 18 |  ;
 | 
|---|
| 19 |  ;Make the sender the Postmaster.
 | 
|---|
| 20 |  S XMDUZ=0.5
 | 
|---|
| 21 |  ;
 | 
|---|
| 22 | RETRY ;Get the message number.
 | 
|---|
| 23 |  D XMZ^XMA2
 | 
|---|
| 24 |  I XMZ<1 G RETRY
 | 
|---|
| 25 |  ;
 | 
|---|
| 26 |  ;Load the message
 | 
|---|
| 27 |  M ^XMB(3.9,XMZ,2)=^TMP("PXRMXMZ",$J)
 | 
|---|
| 28 |  K ^TMP("PXRMXMZ",$J)
 | 
|---|
| 29 |  S NL=$O(^XMB(3.9,XMZ,2,""),-1)
 | 
|---|
| 30 |  S ^XMB(3.9,XMZ,2,0)="^3.92^"_+NL_U_+NL_U_DT
 | 
|---|
| 31 |  ;
 | 
|---|
| 32 |  ;Send message to requestor if USER is defined
 | 
|---|
| 33 |  I $G(USER)'="" S XMY(DUZ)="" D ENT1^XMD Q
 | 
|---|
| 34 |  ;Send the message to the site defined mail group or the user if
 | 
|---|
| 35 |  ;there is no mail group.
 | 
|---|
| 36 |  S MGIEN=$G(^PXRM(800,1,"MGFE"))
 | 
|---|
| 37 |  I MGIEN'="" D
 | 
|---|
| 38 |  . S MGROUP="G."_$$GET1^DIQ(3.8,MGIEN,.01)
 | 
|---|
| 39 |  . S XMY(MGROUP)=""
 | 
|---|
| 40 |  E  S XMY(DUZ)=""
 | 
|---|
| 41 |  D ENT1^XMD
 | 
|---|
| 42 |  Q
 | 
|---|
| 43 |  ;
 | 
|---|