- PSBRPCXM ;BIRMINGHAM/EFC-VISTA MAILMAN INTERFACE ;Mar 2004
- ;;3.0;BAR CODE MED ADMIN;;Mar 2004
- ;
- RPC(RESULTS,PSBCMD,PSBDATA) ; Main RPC point
- S RESULTS=$NA(^TMP("PSBMSG",$J)),^TMP("PSBMSG",$J,0)="-1^Unknown Error"
- I PSBCMD="CREATE" K ^TMP("PSBMAIL",$J) S ^TMP($J,0)="1^Message '"_$J_"' created."
- D:PSBCMD="APPEND"
- .I $G(PSBDATA)]"" S Y=$O(^TMP("PSBMAIL",$J,"TEXT",""),-1)+1,^TMP("PSBMAIL",$J,"TEXT",Y,0)=PSBDATA
- .S X="PSBDATA"
- .F S X=$Q(@X) Q:X="" S Y=$O(^TMP("PSBMAIL",$J,"TEXT",""),-1)+1,^TMP("PSBMAIL",$J,"TEXT",Y,0)=@X
- .S Y=+$O(^TMP("PSBMAIL",$J,"TEXT",""),-1)
- .S ^TMP("PSBMAIL",$J,"TEXT",0)="^^"_Y
- .S ^TMP($J,0)="1^Text appended."
- I PSBCMD="SUBJECT" S ^TMP("PSBMAIL",$J,"SUBJECT")=PSBDATA,^TMP($J,0)="1^Message subject set to '"_PSBDATA_"'"
- D:PSBCMD="SENDTO"
- .I $G(PSBDATA)]"" S Y=$O(^TMP("PSBMAIL",$J,"SENDTO",""),-1)+1,^TMP("PSBMAIL",$J,"SENDTO",Y)=PSBDATA
- .S X="PSBDATA"
- .F S X=$Q(@X) Q:X="" S Y=$O(^TMP("PSBMAIL",$J,"SENDTO",""),-1)+1,^TMP("PSBMAIL",$J,"SENDTO",Y)=@X
- .S ^TMP($J,0)="1^Recipients Added."
- D:PSBCMD="EXECUTE"
- .S XMSUB=$G(^TMP("PSBMAIL",$J,"SUBJECT"),"No subject")
- .S XMTEXT="^TMP(""PSBMAIL"",$J,""TEXT"","
- .F X=0:0 S X=$O(^TMP("PSBMAIL",$J,"SENDTO",X)) Q:'X S XMY(^(X))=""
- .D ^XMD
- .S ^TMP($J,0)="1^Message Sent. ID: "_+$G(XMZ)
- Q
- ;
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSBRPCXM 1311 printed Mar 13, 2025@20:45:51 Page 2
- PSBRPCXM ;BIRMINGHAM/EFC-VISTA MAILMAN INTERFACE ;Mar 2004
- +1 ;;3.0;BAR CODE MED ADMIN;;Mar 2004
- +2 ;
- RPC(RESULTS,PSBCMD,PSBDATA) ; Main RPC point
- +1 SET RESULTS=$NAME(^TMP("PSBMSG",$JOB))
- SET ^TMP("PSBMSG",$JOB,0)="-1^Unknown Error"
- +2 IF PSBCMD="CREATE"
- KILL ^TMP("PSBMAIL",$JOB)
- SET ^TMP($JOB,0)="1^Message '"_$JOB_"' created."
- +3 if PSBCMD="APPEND"
- Begin DoDot:1
- +4 IF $GET(PSBDATA)]""
- SET Y=$ORDER(^TMP("PSBMAIL",$JOB,"TEXT",""),-1)+1
- SET ^TMP("PSBMAIL",$JOB,"TEXT",Y,0)=PSBDATA
- +5 SET X="PSBDATA"
- +6 FOR
- SET X=$QUERY(@X)
- if X=""
- QUIT
- SET Y=$ORDER(^TMP("PSBMAIL",$JOB,"TEXT",""),-1)+1
- SET ^TMP("PSBMAIL",$JOB,"TEXT",Y,0)=@X
- +7 SET Y=+$ORDER(^TMP("PSBMAIL",$JOB,"TEXT",""),-1)
- +8 SET ^TMP("PSBMAIL",$JOB,"TEXT",0)="^^"_Y
- +9 SET ^TMP($JOB,0)="1^Text appended."
- End DoDot:1
- +10 IF PSBCMD="SUBJECT"
- SET ^TMP("PSBMAIL",$JOB,"SUBJECT")=PSBDATA
- SET ^TMP($JOB,0)="1^Message subject set to '"_PSBDATA_"'"
- +11 if PSBCMD="SENDTO"
- Begin DoDot:1
- +12 IF $GET(PSBDATA)]""
- SET Y=$ORDER(^TMP("PSBMAIL",$JOB,"SENDTO",""),-1)+1
- SET ^TMP("PSBMAIL",$JOB,"SENDTO",Y)=PSBDATA
- +13 SET X="PSBDATA"
- +14 FOR
- SET X=$QUERY(@X)
- if X=""
- QUIT
- SET Y=$ORDER(^TMP("PSBMAIL",$JOB,"SENDTO",""),-1)+1
- SET ^TMP("PSBMAIL",$JOB,"SENDTO",Y)=@X
- +15 SET ^TMP($JOB,0)="1^Recipients Added."
- End DoDot:1
- +16 if PSBCMD="EXECUTE"
- Begin DoDot:1
- +17 SET XMSUB=$GET(^TMP("PSBMAIL",$JOB,"SUBJECT"),"No subject")
- +18 SET XMTEXT="^TMP(""PSBMAIL"",$J,""TEXT"","
- +19 FOR X=0:0
- SET X=$ORDER(^TMP("PSBMAIL",$JOB,"SENDTO",X))
- if 'X
- QUIT
- SET XMY(^(X))=""
- +20 DO ^XMD
- +21 SET ^TMP($JOB,0)="1^Message Sent. ID: "_+$GET(XMZ)
- End DoDot:1
- +22 QUIT
- +23 ;