Quittio 0.3 API

MandatoryFieldGuard
in package

FinalYes

Checks after rendering that the template printed all mandatory values.

A custom template could omit mandatory information (e.g. the VAT identifier); then PDF and XML would differ in content. Access keys are view model paths:

  • "[]" stands for every index: "vatRows[].amount" requires the amount of every VAT row;
  • "&" combines paths that must all be printed, "|" separates alternatives;
  • a path counts only where the view model has a value: paths of null values and empty lists are not required, and a field whose alternatives all have no value is skipped.

Only printed leaf values count (see ViewNode).

Table of Contents

Constants

LEGAL_NOTE_SUBJECTS  : array<string|int, mixed> = [\Quittio\Core\Enums\NoteSubjectCode::Regulator...
Note subjects (BT-21) that the view model lists in "legalNotes".
MODE_EXCEPTION  : string = 'exception'
MODE_LOG  : string = 'log'
MODE_OFF  : string = 'off'

Methods

__construct()  : mixed
address()  : string
The address of a party: all address lines, or street, postcode and city.
baseFields()  : MandatoryFieldList
Fields every invoice PDF must show, independent of the country.
check()  : array<int, MandatoryField>
notePath()  : string|null
View model path of the first note that matches, wherever the view model lists it: "legalNotes[i]" for regulatory, legal and tax notes, otherwise "notes[i].content|notes[i].html".

Constants

Note subjects (BT-21) that the view model lists in "legalNotes".

public array<string|int, mixed> LEGAL_NOTE_SUBJECTS = [\Quittio\Core\Enums\NoteSubjectCode::RegulatoryInformation, \Quittio\Core\Enums\NoteSubjectCode::LegalInformation, \Quittio\Core\Enums\NoteSubjectCode::TaxDeclaration]

Methods

__construct()

public __construct([string $mode = self::MODE_EXCEPTION ][, LoggerInterface|null $logger = null ]) : mixed
Parameters
$mode : string = self::MODE_EXCEPTION
$logger : LoggerInterface|null = null

address()

The address of a party: all address lines, or street, postcode and city.

public static address(string $party) : string
Parameters
$party : string
Return values
string

notePath()

View model path of the first note that matches, wherever the view model lists it: "legalNotes[i]" for regulatory, legal and tax notes, otherwise "notes[i].content|notes[i].html".

public static notePath(InvoiceData $invoice, callable(Note): bool $matches) : string|null
Parameters
$invoice : InvoiceData
$matches : callable(Note): bool
Return values
string|null
On this page

Search results