Add support to customise address formatting

Description

Address formatting is currently performed using the "party:getBillingAddress()" and "party:getCorrespondenceAddress()" and "party:getPracticeAddress()" xpath functions.
The billing and correspondence addresses are formatted as multi-line addresses, whereas the practice address is a single line.

These format addresses using the PartyRules.formatAddress() method which is implemented in terms of Australian addressing conventions.

Support is required for:

  • different country formatting conventions

  • the ability to specify a format for single and multi-line addresses

  • the ability to handle missing data. Currently 'null' appears in addresses if postcode or state data is not available

  • the ability to format billing, practice and correspondence addresses as single or multiple lines

To do this, a new lookup will be created, "lookup.addressFormat".
This will have two nodes:

  • singleLineFormat - the format for single-line addresses

  • multiLineFormat - the format for multi-line addresses

Each node will be an xpath expression. This will have the following pre-defined variables supplied:

  • address - e.g "36 Nonesuch St". For single-line addresses, any '\n' will be removed

  • suburb - e.g. "Sawtell"

  • postcode - e.g. "3095"

  • state - e.g. "Victoria"

Any missing data would be supplied as an empty string ("")

These could be used as follows:

  • singleLineFormat = concat($address, ' ', $suburb, ' ', $state, ' ', $postcode)

  • multipleLineFormat = concat($address, '\n', $suburb, ' ', $state, ' ', $postcode)

The party.organisationPractice archetype would be amended to have a new node, "addressFormat", defined as:

The contact.location archetype would be changed to use the billing address for the 'description' node.

The existing xpath functions will also be extended to have single and multiple line versions. E.g.

  • party:getBillingAddress(., true) - single line address format

  • party:getBillingAddress(., false) - multi-line address format

  • party:getBillingAddress(.) - calls party:getBillingAddress(., false)

If the practice has no address format defined, the current format will be used.

Environment

None

Status

Assignee

Tim Anderson

Reporter

Tim Anderson

Labels

None

Time tracking

6h

Components

Fix versions

Affects versions

Priority

Major
Configure