The use case that led to this extension: our members log in on the website and have to be able to renew their membership, buy products and training, buy job adverts and register for events. When it comes to paying they need to be able to select an invoice address for this specific occassion. That could be their own private address, but also the address of their employer or the address of the co-operative group they are part of, or the address of their own company.
The extension provides an API: InvoiceAddress Get (with parameter contact_id) that will return all the available invoice addresses for the contact.
In the background the API will do the following:
* it will retrieve the billing addresses of the contact_id passed as parameter.
* it will retrieve all the relationships of the contact and check if the relationship type has been allowed as an invoice address relationship type (check the Settings section below).
* if the relationship is allowed, the billing addresses of the related contacts will be retrieved
* it will return all the found addresses
* the fields that will be returned depend on the settings (check the Settings section below)
The extension also introduces a specific relationship type Invoice Address From/For which can be used for exceptional cases where an address has to be available as an invoice address without any logical reason :-)
The are a few settings for the Invoice Address API. You can access them with Administer>Invoice Address API Settings.
Relationship Type(s) that Invoice Addresses will be presented from
This setting shows all the relationship types that will be checked for billing addresses. So for example if the Employer/Employee relationship type is in the list, the API will look for the billing addresses of the other contact in the relationship and present them as possible invoice addresses.
Address Fields to return for Invoice Adresses
In this setting you can select what address fields from CiviCRM will be returned with the Invoice Address API.
Show Addresses of Location Type Billing?
This setting controls if the addresses with the location type Billing (the name of the location type has to be Billing) are collected with the InvoiceAddress API.
Show Addresses checked as Billing Location for Contact?
This setting controls if the addresses which have been ticked as Billing location for this contact