PXMSG ;SLC/PKR - Routine for sending MailMan messages. ;04/07/2017
;;1.0;PCE PATIENT CARE ENCOUNTER;**211**;Aug 12, 1996;Build 454
;
;====================================================
SEND(NODE,SUBJECT,TO,FROM) ;Send a MailMan message whose text is in
;^TMP(NODE,$J,N,0). SUBJECT is the subject. TO is the optional
;list of addresses, setup exactly like the MailMan XMY array.
;If TO is not defined try to send to the PCE Managemnt mail
;group. If that is not defined send to the user. FROM is the
;optional message from, if it is not defined then from will be
;PCE Support. This can be free text or a DUZ.
N MGIEN,MGROUP,NL,REF,XMDUZ,XMSUB,XMY,XMZ
;
;Make sure the subject does not exceed 64 characters.
S XMSUB=$E(SUBJECT,1,64)
;
;Make the default sender PCE Support.
S XMDUZ=$S($G(FROM)="":"PCE Support",1:FROM)
;
RETRY ;Get the message number.
D XMZ^XMA2
I XMZ<1 G RETRY
;
;Load the message
M ^XMB(3.9,XMZ,2)=^TMP(NODE,$J)
K ^TMP(NODE,$J)
S NL=$O(^XMB(3.9,XMZ,2,""),-1)
S ^XMB(3.9,XMZ,2,0)="^3.92^"_+NL_U_+NL_U_DT
;
;Send message only to the TO list if it is defined.
I $D(TO)=10 M XMY=TO D ENT1^XMD Q
;Send the message to the site defined mail group or the user if
;there is no mail group.
S MGIEN=$G(^PX(815,1,650))
S MGROUP=$S(MGIEN'="":"G."_$$GET1^DIQ(3.8,MGIEN,.01),1:DUZ)
S XMY(MGROUP)=""
D ENT1^XMD
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXMSG 1392 printed Dec 13, 2024@02:29:43 Page 2
PXMSG ;SLC/PKR - Routine for sending MailMan messages. ;04/07/2017
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**211**;Aug 12, 1996;Build 454
+2 ;
+3 ;====================================================
SEND(NODE,SUBJECT,TO,FROM) ;Send a MailMan message whose text is in
+1 ;^TMP(NODE,$J,N,0). SUBJECT is the subject. TO is the optional
+2 ;list of addresses, setup exactly like the MailMan XMY array.
+3 ;If TO is not defined try to send to the PCE Managemnt mail
+4 ;group. If that is not defined send to the user. FROM is the
+5 ;optional message from, if it is not defined then from will be
+6 ;PCE Support. This can be free text or a DUZ.
+7 NEW MGIEN,MGROUP,NL,REF,XMDUZ,XMSUB,XMY,XMZ
+8 ;
+9 ;Make sure the subject does not exceed 64 characters.
+10 SET XMSUB=$EXTRACT(SUBJECT,1,64)
+11 ;
+12 ;Make the default sender PCE Support.
+13 SET XMDUZ=$SELECT($GET(FROM)="":"PCE Support",1:FROM)
+14 ;
RETRY ;Get the message number.
+1 DO XMZ^XMA2
+2 IF XMZ<1
GOTO RETRY
+3 ;
+4 ;Load the message
+5 MERGE ^XMB(3.9,XMZ,2)=^TMP(NODE,$JOB)
+6 KILL ^TMP(NODE,$JOB)
+7 SET NL=$ORDER(^XMB(3.9,XMZ,2,""),-1)
+8 SET ^XMB(3.9,XMZ,2,0)="^3.92^"_+NL_U_+NL_U_DT
+9 ;
+10 ;Send message only to the TO list if it is defined.
+11 IF $DATA(TO)=10
MERGE XMY=TO
DO ENT1^XMD
QUIT
+12 ;Send the message to the site defined mail group or the user if
+13 ;there is no mail group.
+14 SET MGIEN=$GET(^PX(815,1,650))
+15 SET MGROUP=$SELECT(MGIEN'="":"G."_$$GET1^DIQ(3.8,MGIEN,.01),1:DUZ)
+16 SET XMY(MGROUP)=""
+17 DO ENT1^XMD
+18 QUIT
+19 ;