ADEMPIERE-49 Customization of mail sent by request notifications

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

Description

When a request is changed, or when the Request Processor generates a notificaton, an email may be sent to a user. The text and subject of the mail are hardcoded and cannot be modified.

But, for some usage scenario, the information present in the mail are insufficient, and so the mail notification is of limited use.

We want to provide customization of the mail text and subject using mail text functionality, adding to the request type the mail template to use (html mail are supported).Additionally, the mail notification generated when a request is modified will not be sent to the user performing the modification.

The system-generated original subject, content and trailer can be used in the mail text with @#OriginalSubject@ @#OriginalDetail@ @#OriginalTrailer@. For mail notifications generated by request processor, original trailer is empty.

Implementation

Request Type

A new field, R_MailText_ID has been added to the request type (and the new model generated), to allow specifying the mail text to use for notifications. If no mail text is specified, current behavior is used.

Request

MRequest has been modified adding the method to obtain the Mail Text, and the parsed subject and body. The function MRequest.sendNotices(ArrayList<String>) has been changed to use the new behaviour.

RequestProcessor

RequestProcessor has been modified to use the new function exposed by MRequest to implement the new behaviour.

MClient

RequestProcessor uses a function of MClient to send the emails. This function does not permit to specify if the mail is html. Since many other function exist in with and without way to specify html, and the underlying function exposes such fuctionality, a new function has been added.

MMailText

Minor fixes to NPE and using Env to parse text.

Developers

References