Adding Contract details to Emails and Invoice Templates

{contract} is template function can be used in email templates and invoice template to dynamically load related contract details

Usage


In email templates you wish to attach something, use following tag:


Available attributes:

Attribute NameTypeRequiredDescription
idintYesRelated item (invoice,account,order,domain) id
forstringYesItem type, one of: invoice, account, order, domain
multipleboolNo

When set to false (default), function will load single contract details into  {$contract} template variable.

When set to true function will load multiple contracts (if any) to {$contracts} variable. Use true with type='invoice' or type='order'

Contract details available


Contract is loaded from database and gives you access to following details:

VariableTypeDescription
{$contract.id}intDatabase contract id
{$contract.number}intHuman-readable contract number
{$contract.created_at}datetime

Contract creation date

{$contract.accepted_at}datetimeIf accepted, contract acceptance date
{$contract.accepted_by}stringIf accepted, person who accepted contract
{$contract.expires}dateContract expiration date (if any)
{$contract.status}stringOne of: 'Draft','Pending','Active','Expired','Canceled'
{$contract.public_notes}stringPublic notes added to contract

Use in invoice template


To load all contracts related to invoice into its template, edit invoice template in Settings→Billing→Document Templates and add:

Below this call execution you will get access to  {$contracts} array:


Use in email template


To load contract related to account/domain/order into related email template, edit email template in Settings→Email templates and add

For account-related emails:

For domain-related emails:


Below above call executions you will get access to  {$contract} array:


For order-related emails:

Below this call execution you will get access to  {$contracts} array: