---
title: "Fields available in document templates"
weight: 48
description: "For the integrator: the fields of an intervention that can be printed, in the layout of a schema or in a copied PHP PDF model."
---

# Fields available in document templates

This page is for the integrator who adapts the intervention report of a
customer. It lists what can be printed, depending on how the document is
built.

There are two ways to do it, in this order of preference:

1. **The layout of a schema** (`pdf_layout`): no code, the same schema
   carries the fields entered in the app and their PDF rendering. This is
   the way to prefer.
2. **A PHP PDF model copied** from those of the module: for a layout the
   schema cannot describe.

ODT templates are not available for interventions: Dolibarr ships none for
intervention cards, and those of the module are not offered for
activation.

## In the layout of a schema

A field is named by its name in the sections, the tables and the text
templates (`{name}`). The full format of the `pdf_layout` block is
described in the schema documentation (`layout.md`).

### The fields of the schema

Every field declared in the `extrafields` of the schema prints by its name
(for instance `exp_reference`), with the value entered in the app.

### The fields added by the administrator

A complementary field of the intervention card prints by its name, without
the `options_` prefix (for instance `my_field` for `options_my_field`).

### The information of the card

They start with a dot:

| Name | Content |
|---|---|
| `.ref` | Reference of the intervention |
| `.date_creation` | Creation date |
| `.date_valid` | Validation date |
| `.duration` | Total time spent, in seconds |
| `.status_label` | Dolibarr status (Draft, Validated, Invoiced, Closed) |
| `.advanced_status_label` | Advanced status (Scheduled, In progress, Done, Signed...) |
| `.user_author.fullname` | Name of the user who created the card |
| `.user_valid.fullname` | Name of the user who validated it |
| `.intervening.fullname` | Name of the first intervening technician |
| `.thirdparty.name` | Customer name |
| `.thirdparty.address` | Full address of the customer (street, zip code, town) |
| `.thirdparty.street` | Street of the customer |
| `.thirdparty.zip` | Zip code of the customer |
| `.thirdparty.town` | Town of the customer |
| `.thirdparty.country` | Country of the customer |
| `.thirdparty.code_client` | Customer code |
| `.thirdparty.tva_intra` | Intra-community VAT number |
| `.thirdparty.phone` | Phone of the customer |
| `.thirdparty.email` | Email of the customer |
| `.intervention_address` | Full address of the intervention place |
| `.intervention_address.name` | Name of the intervention place |
| `.intervention_address.street` | Street of the intervention place |
| `.intervention_address.zip` | Zip code of the intervention place |
| `.intervention_address.town` | Town of the intervention place |

An unknown name prints an empty value and leaves a line in the Dolibarr
log, without stopping the generation.

### The properties of the Dolibarr card

Without a dot, these properties of the card print too: `ref`,
`ref_client`, `ref_ext`, `label`, `description`, `note_public`,
`duration`, `datec`, `date_creation`, `datev`, `date_validation`, `dateo`,
`datee`, `datet`, `date_delivery`, `fulldayevent`, `socid`, `fk_project`,
`statut`, `status`. The other properties are refused (the private note,
for instance, never reaches a customer document).

### The signatures

`signature_tech` and `signature_customer` are the signatures of the
technician and of the customer. Put them in a `signature_block` section:
it prints under each signature the name typed in the app. A schema
imported without a `pdf_layout` gets a generated layout that holds one.

## In a copied PHP PDF model

The models of the module are in `core/modules/fichinter/doc/`:
`pdf_smartinterbase`, `pdf_smartintertwo`, `pdf_smartinterdossier`,
`pdf_smartinterparcreport`, `pdf_smartparc` and `pdf_smartscheme`. Copy the
one closest to the document you want, into a module of your own rather
than into the SmartInterventions folder (an update would overwrite it),
then rename the file, the class and the `name` property. The module that
carries it must declare `'models' => 1` in its descriptor. The model is
then activated in the setup page of the Dolibarr Interventions module,
with the other document models.

### The object received

`write_file()` receives the Dolibarr intervention card (`Fichinter`). The
fields of the module are not complementary fields: first call
`smartinter_hydrate_fichinter_array_options($db, $object)`
(`lib/smartinterventions.lib.php`), which stores them in
`$object->array_options`:

| Key | Content |
|---|---|
| `options_smartinterventions_date_inter` | Planned date (Unix timestamp, in seconds) |
| `options_smartinterventions_plan_duration` | Planned duration, in minutes |
| `options_smartinterventions_type` | Intervention type (id of the schema) |
| `options_smartinterventions_is_tlp` | Urgent intervention (0 or 1) |
| `options_smartinterventions_address` | Intervention place (id of the customer contact) |
| `options_smartinterventions_type_event` | Agenda event type (id in the dictionary) |
| `options_smartinterventions_autosend_customer` | Report sent to the customer automatically (0 or 1) |
| `options_smartinterventions_is_quote` | Estimate visit for a quote (0 or 1) |
| `options_smartinterventions_priority` | Priority |

A key is missing when the card has no value.

For the advanced status and the identity of the signers, load the card of
the module: `$si = new Smartinter($db); $si->fetchFromFichInterId($object->id);`
gives `$si->si_status` (numeric code, `Smartinter::statusIdToCode()` turns
it into `STATUS_DONE`...), `$si->si_sign_tech_name` and
`$si->si_sign_customer_name`.

### Ready-made functions

They draw the blocks shared by the models of the module, with the same
rules (rights, hidden prices, checked images):

| Function | Role |
|---|---|
| `smartinter_pdf_render_signatures(&$pdf, $fichInter, $outputlangs, $x, $y, $cellWidth = 85, $signatureHeight = 30)` | Both signatures side by side, with the name of each signer |
| `smartinter_signature_signer_names($db, $fichInter, $si, $outputlangs)` | The two names to print under the signatures `[technician, customer]` |
| `smartinter_pdf_render_parts($pdf, $object, $outputlangs, $startX = 10.0, $startY = null)` | The table of parts and supplies; returns the new vertical position |
| `smartinter_pdf_should_hide_prices($object)` | True when the prices must be hidden (customer under contract) |
| `smartinter_pdf_render_intervention_address($pdf, $db, $object, $outputlangs, $marginLeft, $contentWidth, $y)` | The "Intervention address" box; returns the position under the box |
| `smartinter_pdf_document_title($db, $object, $outputlangs, $defaultKey)` | The title of the document ("Quote" for an estimate visit) |
| `smartinter_intervention_address($db, $fichinterId)` | The intervention place: name, address, zip code, town, phone |
| `smartinter_pdf_image_size($path)` | The size of an image, `null` when it is unreadable: check it before any `Image()` |

The first three and `smartinter_intervention_address()` are in
`lib/smartinterventions.lib.php`, the price, address box and title ones in
`lib/smartinterventions_pdf.lib.php`, and `smartinter_pdf_image_size()` in
`lib/smartinter_pdf_model.lib.php`.
