- PXRMMSG ;SLC/PKR - Routine for sending MailMan messages. ;23-Mar-2015 10:37;DU
- ;;2.0;CLINICAL REMINDERS;**1001,17,18,1005**;Feb 04, 2005;Build 23
- ;
- ;======================================================================
- 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)
- ;
- ;Make the default sender Clinical Reminders.
- S XMDUZ=$S($G(FROM)="":"Clinical Reminders Support",1:FROM)
- ;
- RETRY ;Get the message number.
- I +$G(PXRMITEM)=999999 Q ;IHS/MSC/MGH Patch 1001
- 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 to TO list if it is defined.
- I $D(TO)=11 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
- ;
- PXRMMSG ;SLC/PKR - Routine for sending MailMan messages. ;23-Mar-2015 10:37;DU
- +1 ;;2.0;CLINICAL REMINDERS;**1001,17,18,1005**;Feb 04, 2005;Build 23
- +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 ;Make the default sender Clinical Reminders.
- +18 SET XMDUZ=$SELECT($GET(FROM)="":"Clinical Reminders Support",1:FROM)
- +19 ;
- RETRY ;Get the message number.
- +1 ;IHS/MSC/MGH Patch 1001
- IF +$GET(PXRMITEM)=999999
- QUIT
- +2 DO XMZ^XMA2
- +3 IF XMZ<1
- GOTO RETRY
- +4 ;
- +5 ;Load the message
- +6 MERGE ^XMB(3.9,XMZ,2)=^TMP(NODE,$JOB)
- +7 KILL ^TMP(NODE,$JOB)
- +8 SET NL=$ORDER(^XMB(3.9,XMZ,2,""),-1)
- +9 SET ^XMB(3.9,XMZ,2,0)="^3.92^"_+NL_U_+NL_U_DT
- +10 ;
- +11 ;Send message to TO list if it is defined.
- +12 IF $DATA(TO)=11
- MERGE XMY=TO
- DO ENT1^XMD
- QUIT
- +13 ;Send the message to the site defined mail group or the user if
- +14 ;there is no mail group.
- +15 SET MGIEN=$GET(^PXRM(800,1,"MGFE"))
- +16 SET MGROUP=$SELECT(MGIEN'="":"G."_$$GET1^DIQ(3.8,MGIEN,.01),1:DUZ)
- +17 SET XMY(MGROUP)=""
- +18 DO ENT1^XMD
- +19 QUIT
- +20 ;