PXRMMSG ;SLC/PKR - Routine for sending MailMan messages. ;04/14/2015
;;2.0;CLINICAL REMINDERS;**17,18,53,47**;Feb 04, 2005;Build 291
;
;======================================================================
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 Clinical Reminders 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
;Clinical Reminders Support. This can be free text or a DUZ.
N MGIEN,MGROUP,NL,REF,XMDUZ,XMSUB,XMY,XMZ
;
;If this is a test run write out the message.
I $G(PXRMDEBG) D
. S REF="^TMP(NODE,$J)"
. D AWRITE^PXRMUTIL(REF)
;
;Make sure the subject does not exceed 64 characters.
S XMSUB=$E(SUBJECT,1,64)
;
;If FROM is defined as DUZ make sure it is a valid user.
S FROM=$G(FROM)
I (FROM=DUZ),($$NEWS^XMXUTIL(FROM,1)=-1) S FROM="DUZ="_DUZ_", this is not a valid MailMan user."
;
;Make the default sender Clinical Reminders.
S XMDUZ=$S(FROM="":"Clinical Reminders 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(^PXRM(800,1,"MGFE"))
S MGROUP=$S(MGIEN'="":"G."_$$GET1^DIQ(3.8,MGIEN,.01),1:DUZ)
S XMY(MGROUP)=""
D ENT1^XMD
Q
;
;==========================================
SENDIM(BUILD) ;Send install message for a build.
N FROM,NODE,SYSTEM,SUBJECT,TO
S NODE=BUILD
K ^TMP(NODE,$J)
;DBIA #1131 for ^XMB("NETNAME")
S FROM=BUILD_" Install@"_^XMB("NETNAME")
;DBIA #2541
S SYSTEM=$$KSP^XUPARAM("WHERE")
I $$PROD^XUPROD(1) S TO("G.CLINICAL REMINDERS SUPPORT@DOMAIN.EXT")=""
E D
. N MGIEN,MGROUP
. S MGIEN=$G(^PXRM(800,1,"MGFE"))
. S MGROUP=$S(MGIEN'="":"G."_$$GET1^DIQ(3.8,MGIEN,.01),1:DUZ)
. S TO(MGROUP)=""
S SUBJECT="Install of "_BUILD
S ^TMP(NODE,$J,1,0)="Build "_BUILD_" has been installed."
S ^TMP(NODE,$J,2,0)="System is "_SYSTEM_"."
D SEND^PXRMMSG(NODE,SUBJECT,.TO,FROM)
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXRMMSG 2450 printed Dec 13, 2024@01:46:45 Page 2
PXRMMSG ;SLC/PKR - Routine for sending MailMan messages. ;04/14/2015
+1 ;;2.0;CLINICAL REMINDERS;**17,18,53,47**;Feb 04, 2005;Build 291
+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 Clinical Reminders 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 ;Clinical Reminders Support. This can be free text or a DUZ.
+7 NEW MGIEN,MGROUP,NL,REF,XMDUZ,XMSUB,XMY,XMZ
+8 ;
+9 ;If this is a test run write out the message.
+10 IF $GET(PXRMDEBG)
Begin DoDot:1
+11 SET REF="^TMP(NODE,$J)"
+12 DO AWRITE^PXRMUTIL(REF)
End DoDot:1
+13 ;
+14 ;Make sure the subject does not exceed 64 characters.
+15 SET XMSUB=$EXTRACT(SUBJECT,1,64)
+16 ;
+17 ;If FROM is defined as DUZ make sure it is a valid user.
+18 SET FROM=$GET(FROM)
+19 IF (FROM=DUZ)
IF ($$NEWS^XMXUTIL(FROM,1)=-1)
SET FROM="DUZ="_DUZ_", this is not a valid MailMan user."
+20 ;
+21 ;Make the default sender Clinical Reminders.
+22 SET XMDUZ=$SELECT(FROM="":"Clinical Reminders Support",1:FROM)
+23 ;
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(^PXRM(800,1,"MGFE"))
+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 ;
+20 ;==========================================
SENDIM(BUILD) ;Send install message for a build.
+1 NEW FROM,NODE,SYSTEM,SUBJECT,TO
+2 SET NODE=BUILD
+3 KILL ^TMP(NODE,$JOB)
+4 ;DBIA #1131 for ^XMB("NETNAME")
+5 SET FROM=BUILD_" Install@"_^XMB("NETNAME")
+6 ;DBIA #2541
+7 SET SYSTEM=$$KSP^XUPARAM("WHERE")
+8 IF $$PROD^XUPROD(1)
SET TO("G.CLINICAL REMINDERS SUPPORT@DOMAIN.EXT")=""
+9 IF '$TEST
Begin DoDot:1
+10 NEW MGIEN,MGROUP
+11 SET MGIEN=$GET(^PXRM(800,1,"MGFE"))
+12 SET MGROUP=$SELECT(MGIEN'="":"G."_$$GET1^DIQ(3.8,MGIEN,.01),1:DUZ)
+13 SET TO(MGROUP)=""
End DoDot:1
+14 SET SUBJECT="Install of "_BUILD
+15 SET ^TMP(NODE,$JOB,1,0)="Build "_BUILD_" has been installed."
+16 SET ^TMP(NODE,$JOB,2,0)="System is "_SYSTEM_"."
+17 DO SEND^PXRMMSG(NODE,SUBJECT,.TO,FROM)
+18 QUIT
+19 ;