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

BARMAIL.m

Go to the documentation of this file.
  1. BARMAIL ; IHS/SD/LSL - PATCH ANNOUNCEMENT UTILITY ;
  1. ;;1.8;IHS ACCOUNTS RECEIVABLE;;OCT 26, 2005
  1. ;
  1. ;;This patch announcement utility generates a mail message to everyone
  1. ;;on the local machine that holds a security key in the namespace
  1. ;;of the calling package. The text of the mail messages must be
  1. ;;provided by you, and passed to the utility as a line reference. The
  1. ;;utility uses the first line after the line reference as the mail
  1. ;;message subject, and subsequent lines as the body of the message,
  1. ;;until a null string is encountered. This places an implicit limit
  1. ;;on your mail messages to the maximum size of a routine. Suggested
  1. ;;text would be to inform the users that the patch has been installed,
  1. ;;and describe any changes in displays or functionality, and provide
  1. ;;a contact number for questions, e.g:
  1. ;;------------------------------------------------------------------
  1. ;;Please direct your questions or comments about RPMS software to:
  1. ;; OIRM / DSD (Division of Systems Development)
  1. ;; 5300 Homestead Road NE
  1. ;; Albuquerque NM 87110
  1. ;; 505-837-4189
  1. ;;------------------------------------------------------------------
  1. ;;
  1. ;;A call example is: D MAIL^BARMAIL("AG","LABEL^AGP5")
  1. ;;This would deliver a mail message containing the text beginning at
  1. ;;LABEL+2^AGP5, and continuing to the end of routine AGP5, to each
  1. ;;local user that holds a security key in the AG namespace.
  1. ;;The subject of the message is assumed to be the first line after
  1. ;;LABEL^AGP5:
  1. ;; LABEL ;EP - Mail msg text.
  1. ;; ;;PATIENT REG, PATCH 5 CHANGES.
  1. ;;
  1. ;;The utility will return Y=0 if successful, and Y=-1 if not
  1. ;;successful. The message "Message delivered." will be displayed
  1. ;;if the routine is called interactively.
  1. ;;
  1. ;
  1. Q
  1. ;
  1. MAIL(BARNS,BARREF) ;PEP - BARNS is namespace, BARREF is line reference.
  1. ;
  1. NEW BARLAB,BARRTN,XMSUB,XMDUZ,XMTEXT,XMY
  1. S BARLAB=$P(BARREF,U),BARRTN=$P(BARREF,U,2)
  1. I BARLAB=""!(BARRTN="") S Y=-1 Q ; Invalid label reference.
  1. I '$L($T(@BARLAB+1^@BARRTN)) S Y=-1 Q ; No text to send.
  1. S XMSUB=$P($T(@BARLAB+1^@BARRTN),";",3)
  1. K ^TMP($J,"BARMAIL")
  1. D WRITDESC,GETRECIP
  1. I '$D(XMY) S Y=-1 Q ; No recipients.
  1. S XMDUZ=$S($G(DUZ):DUZ,1:.5),XMTEXT="^TMP($J,""BARMAIL"","
  1. D ^XMD
  1. K ^TMP($J,"BARMAIL")
  1. I '$D(ZTQUEUED) W !!,"Message delivered.",!
  1. S Y=0
  1. Q
  1. ;
  1. GETRECIP ;
  1. NEW X,Y
  1. S X=BARNS
  1. F S X=$O(^XUSEC(X)) Q:'($E(X,1,$L(BARNS))=BARNS) S Y=0 F S Y=$O(^XUSEC(X,Y)) Q:'Y S XMY(Y)=""
  1. Q
  1. ;
  1. WRITDESC ;
  1. F %=2:1 S X=$P($T(@BARLAB+%^@BARRTN),";",3) Q:X="" S ^TMP($J,"BARMAIL",%)=X
  1. Q
  1. ;