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
LEGAL_NOTE_SUBJECTS
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]
MODE_EXCEPTION
public
string
MODE_EXCEPTION
= 'exception'
MODE_LOG
public
string
MODE_LOG
= 'log'
MODE_OFF
public
string
MODE_OFF
= 'off'
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
stringbaseFields()
Fields every invoice PDF must show, independent of the country.
public
static baseFields(InvoiceData $invoice) : MandatoryFieldList
Parameters
- $invoice : InvoiceData
Return values
MandatoryFieldListcheck()
public
check(MandatoryFieldList $fields, AccessLog $log) : array<int, MandatoryField>
Parameters
- $fields : MandatoryFieldList
- $log : AccessLog
Return values
array<int, MandatoryField> —fields that were not printed
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