XMFAX ;ISC-SF/GMB-Fax ;04/08/2002 14:46
;;8.0;MailMan;;Jun 28, 2002
FAX(XMZ) ; Fax a message
N XMABORT,XMCNT,XMFIEN,XMQUIET
S XMQUIET=1 ; "quiet flag"
S XMABORT=0
D CRE8FAX(XMZ,XMQUIET,.XMCNT,.XMABORT) Q:XMABORT
D SENDFAX(XMQUIET,XMFIEN,XMCNT)
Q
CRE8FAX(XMZ,XMQUIET,XMCNT,XMABORT) ;
N XMFID
D RECORD(XMQUIET,.XMFID,.XMFIEN,.XMABORT) Q:XMABORT
L +^AKF("FAX",XMFIEN)
D RECIPS(XMZ,XMFID,XMFIEN,.XMCNT)
D BODY(XMZ,XMFIEN)
L -^AKF("FAX",XMFIEN)
Q
RECORD(AKQ,AKFAX,AKIEN,XMABORT) ; Add record to fax file
; AKFAX Fax ID
; AKIEN Record number in ^AKF("FAX",
D NE^AKFAX0 I '$D(AKFAX) S XMABORT=1 Q ; Add record to fax file
S $P(^AKF("FAX",AKIEN,0),U,4)=1 ; This is a MailMan-generated fax
Q
RECIPS(XMZ,XMFID,XMFIEN,XMCNT) ; Add recipients to fax record and update recipient record in mail msg.
N I,XMREC,XMIENS,XMFDA
S I="",XMCNT=0
F S I=$O(^XMB(3.9,XMZ,1,"AFAX",I)) Q:I="" D
. S XMREC=$G(^AKF("FAXR",I,0)) Q:XMREC=""
. S XMCNT=XMCNT+1
. S XMIENS="+1,"_XMFIEN_","
. S XMFDA(589500.01,XMIENS,.01)=I ; Pointer to recipient
. S XMFDA(589500.01,XMIENS,1)=$$EZBLD^DIALOG(39303.7) ;Awaiting Transmission Path
. S XMFDA(589500.01,XMIENS,2)=$P(XMREC,U,2) ; Recipient fax phone
. S XMFDA(589500.01,XMIENS,3)=$P(XMREC,U,3) ; Recipient physical location
. S XMFDA(589500.01,XMIENS,4)=$P(XMREC,U,4) ; Recipient voice phone
. D UPDATE^DIE("","XMFDA") ; Add recipient to fax record
. S XMIENS=$O(^XMB(3.9,XMZ,1,"AFAX",I,""))_","_XMZ_","
. S XMFDA(3.91,XMIENS,4)=$$NOW^XLFDT() ; Current date/time
. S XMFDA(3.91,XMIENS,5)="@" ; get rid of status
. S XMFDA(3.91,XMIENS,13)="@" ; get rid of xref
. S XMFDA(3.91,XMIENS,14)=XMFID ; fax id
. D FILE^DIE("","XMFDA") ; Update mail msg recipient
Q
BODY(XMZ,XMFIEN) ; Copy the msg text to the fax text
N XMTEXT,XMREC,I,XMDATE,XMFROM
S XMREC=^XMB(3.9,XMZ,0)
S I=1,XMTEXT(I)=$$EZBLD^DIALOG(34536,$P(XMREC,U,1))_" "_$$EZBLD^DIALOG(34537,XMZ) ; Subj: |1| [#|1|]
S XMDATE=$$MMDT^XMXUTIL1($P(XMREC,U,3))
I $L(XMTEXT(I))+$L(XMDATE)+1>79 S I=I+1,XMTEXT(I)=XMDATE
E S XMTEXT(I)=XMTEXT(I)_" "_XMDATE
S I=I+1,XMTEXT(I)=$$EZBLD^DIALOG(39330,^XMB("NETNAME")) ;Site: |1|
S I=I+1,XMTEXT(I)=$$EZBLD^DIALOG(34538,$$NAME^XMXUTIL($P(XMREC,U,2),1)) ; From: |1|
I DUZ'=$P(XMREC,U,2) S I=I+1,XMTEXT(I)=$$EZBLD^DIALOG(39331,$$NAME^XMXUTIL(DUZ,1)) ;Sender: |1|
S I=I+1,XMTEXT(I)="-------------------------------------------------------------------------------"
S I=I+1,XMTEXT(I)=""
D WP^DIE(589500,XMFIEN_",",7,"","XMTEXT")
D WP^DIE(589500,XMFIEN_",",7,"A","^XMB(3.9,"_XMZ_",2)")
Q
SENDFAX(AKQ,AKIEN,AKML) ;
W !,$$EZBLD^DIALOG(39332) ;Sending to fax
D QUE^AKFAX0
Q
FAXHDR(XMFID,XMFTO) ; Print the fax header
W !,$$EZBLD^DIALOG(39333,XMFTO) ;MailMan FAX for |1|
N XMPARM S XMPARM(1)=XMFID,XMPARM(2)=$$FMTE^XLFDT($$NOW^XLFDT,5)
W !,$$EZBLD^DIALOG(39334,.XMPARM),! ;FAXmail ID: |1|, Faxed: |2|
Q
XMFAX ;ISC-SF/GMB-Fax ;04/08/2002 14:46
+1 ;;8.0;MailMan;;Jun 28, 2002
FAX(XMZ) ; Fax a message
+1 NEW XMABORT,XMCNT,XMFIEN,XMQUIET
+2 ; "quiet flag"
SET XMQUIET=1
+3 SET XMABORT=0
+4 DO CRE8FAX(XMZ,XMQUIET,.XMCNT,.XMABORT)
IF XMABORT
QUIT
+5 DO SENDFAX(XMQUIET,XMFIEN,XMCNT)
+6 QUIT
CRE8FAX(XMZ,XMQUIET,XMCNT,XMABORT) ;
+1 NEW XMFID
+2 DO RECORD(XMQUIET,.XMFID,.XMFIEN,.XMABORT)
IF XMABORT
QUIT
+3 LOCK +^AKF("FAX",XMFIEN)
+4 DO RECIPS(XMZ,XMFID,XMFIEN,.XMCNT)
+5 DO BODY(XMZ,XMFIEN)
+6 LOCK -^AKF("FAX",XMFIEN)
+7 QUIT
RECORD(AKQ,AKFAX,AKIEN,XMABORT) ; Add record to fax file
+1 ; AKFAX Fax ID
+2 ; AKIEN Record number in ^AKF("FAX",
+3 ; Add record to fax file
DO NE^AKFAX0
IF '$DATA(AKFAX)
SET XMABORT=1
QUIT
+4 ; This is a MailMan-generated fax
SET $PIECE(^AKF("FAX",AKIEN,0),U,4)=1
+5 QUIT
RECIPS(XMZ,XMFID,XMFIEN,XMCNT) ; Add recipients to fax record and update recipient record in mail msg.
+1 NEW I,XMREC,XMIENS,XMFDA
+2 SET I=""
SET XMCNT=0
+3 FOR
SET I=$ORDER(^XMB(3.9,XMZ,1,"AFAX",I))
IF I=""
QUIT
Begin DoDot:1
+4 SET XMREC=$GET(^AKF("FAXR",I,0))
IF XMREC=""
QUIT
+5 SET XMCNT=XMCNT+1
+6 SET XMIENS="+1,"_XMFIEN_","
+7 ; Pointer to recipient
SET XMFDA(589500.01,XMIENS,.01)=I
+8 ;Awaiting Transmission Path
SET XMFDA(589500.01,XMIENS,1)=$$EZBLD^DIALOG(39303.7)
+9 ; Recipient fax phone
SET XMFDA(589500.01,XMIENS,2)=$PIECE(XMREC,U,2)
+10 ; Recipient physical location
SET XMFDA(589500.01,XMIENS,3)=$PIECE(XMREC,U,3)
+11 ; Recipient voice phone
SET XMFDA(589500.01,XMIENS,4)=$PIECE(XMREC,U,4)
+12 ; Add recipient to fax record
DO UPDATE^DIE("","XMFDA")
+13 SET XMIENS=$ORDER(^XMB(3.9,XMZ,1,"AFAX",I,""))_","_XMZ_","
+14 ; Current date/time
SET XMFDA(3.91,XMIENS,4)=$$NOW^XLFDT()
+15 ; get rid of status
SET XMFDA(3.91,XMIENS,5)="@"
+16 ; get rid of xref
SET XMFDA(3.91,XMIENS,13)="@"
+17 ; fax id
SET XMFDA(3.91,XMIENS,14)=XMFID
+18 ; Update mail msg recipient
DO FILE^DIE("","XMFDA")
End DoDot:1
+19 QUIT
BODY(XMZ,XMFIEN) ; Copy the msg text to the fax text
+1 NEW XMTEXT,XMREC,I,XMDATE,XMFROM
+2 SET XMREC=^XMB(3.9,XMZ,0)
+3 ; Subj: |1| [#|1|]
SET I=1
SET XMTEXT(I)=$$EZBLD^DIALOG(34536,$PIECE(XMREC,U,1))_" "_$$EZBLD^DIALOG(34537,XMZ)
+4 SET XMDATE=$$MMDT^XMXUTIL1($PIECE(XMREC,U,3))
+5 IF $LENGTH(XMTEXT(I))+$LENGTH(XMDATE)+1>79
SET I=I+1
SET XMTEXT(I)=XMDATE
+6 IF '$TEST
SET XMTEXT(I)=XMTEXT(I)_" "_XMDATE
+7 ;Site: |1|
SET I=I+1
SET XMTEXT(I)=$$EZBLD^DIALOG(39330,^XMB("NETNAME"))
+8 ; From: |1|
SET I=I+1
SET XMTEXT(I)=$$EZBLD^DIALOG(34538,$$NAME^XMXUTIL($PIECE(XMREC,U,2),1))
+9 ;Sender: |1|
IF DUZ'=$PIECE(XMREC,U,2)
SET I=I+1
SET XMTEXT(I)=$$EZBLD^DIALOG(39331,$$NAME^XMXUTIL(DUZ,1))
+10 SET I=I+1
SET XMTEXT(I)="-------------------------------------------------------------------------------"
+11 SET I=I+1
SET XMTEXT(I)=""
+12 DO WP^DIE(589500,XMFIEN_",",7,"","XMTEXT")
+13 DO WP^DIE(589500,XMFIEN_",",7,"A","^XMB(3.9,"_XMZ_",2)")
+14 QUIT
SENDFAX(AKQ,AKIEN,AKML) ;
+1 ;Sending to fax
WRITE !,$$EZBLD^DIALOG(39332)
+2 DO QUE^AKFAX0
+3 QUIT
FAXHDR(XMFID,XMFTO) ; Print the fax header
+1 ;MailMan FAX for |1|
WRITE !,$$EZBLD^DIALOG(39333,XMFTO)
+2 NEW XMPARM
SET XMPARM(1)=XMFID
SET XMPARM(2)=$$FMTE^XLFDT($$NOW^XLFDT,5)
+3 ;FAXmail ID: |1|, Faxed: |2|
WRITE !,$$EZBLD^DIALOG(39334,.XMPARM),!
+4 QUIT