We're updating the issue view to help you get more done. 

Prefilled emails from document templates

Description

From http://www.openvpms.org/project/prefilled-emails-document-templates

OpenVPMS supports ad-hoc emails of:

  • customer charges and estimates

  • customer, patient and supplier documents

  • reports

E.g., to email a patient document, the Print button is selected in Patients - Medical Records - Documents. The displayed Print window has a Mail button. Selecting this displays a Write window with:

  • the Subject set to the document template name

  • the document attached

This project will extend this functionality so that emails are pre-filled with text defined in the associated Document Template.

The text may optionally contain macros, to enable text to be generated based on what is being mailed.

This will save time and ensure consistency when sending emails.

Configuration

The Document Template archetype will be extended to include an Expand Macros On Email flag. If selected, any macros in the Email Subject and Email Body fields will be expanded when the email is generated.

To retain backward compatibility with existing statement and reminder emails, this flag will default to off.

Macro Evaluation

Where possible, macros will evaluated against the object being mailed and will have the current context supplied as variables.

E.g. a patient medical history template may have:

  • Email Subject: Medical history for @patientname

  • Email Body: @medhistoryreferral

The Email Subject and Email Body have no restriction on the number of macros present.

Mail Attachment

Macro evaluated against

Patient Form

act.patientDocumentForm

Patient Image

act.patientDocumentImage

Patient Letter

act.patientDocumentLetter

Patient Medication Label

act.patientMedication

Prescription

act.patientPrescription

Reminder

act.patientReminder

Patient History

party.patientpet

Customer Form

act.customerDocumentForm

Customer Letter

act.customerDocumentLetter

Customer Attachment

act.customerDocumentAttachment

Customer Invoice

act.customerAccountChargesInvoice

Customer Credit

act.customerAccountChargesCredit

Customer Credit Adjust

act.customerAccountCreditAdjust

Customer Debit Adjust

act.customerAccountDebitAdjust

Customer Estimate

act.customerEstimation

Customer Payment

act.customerAccountPayment

Customer Refund

act.customerAccountRefund

Customer Counter Sale

act.customerAcccountChargesCounter

Customer Statement

party.customerperson

Supplier Form

act.supplierDocumentForm

Supplier Letter

act.supplierDocumentLetter

SQL Report

Statement and Reminder emails

Statement and reminder generation currently does no macro expansion of the Email Subject and Email Body fields i.e., the fields are treated as static text.

If the statement or reminder template has Expand Macros on Email set to true, macros will need to be expanded.

Environment

None

Status

Assignee

Tim Anderson

Reporter

Tim Anderson

Labels

None

Components

Fix versions

Priority

Minor