Method AbstractEinvoice():validate() Professional

Validates the invoice.

Syntax
:validate() --> oResult
Return

A DataObject with the members :Valid, :Errors, :Warnings and :Model. The member :Valid contains .T. (true) if no errors were found. The members :Errors and :Warnings contain arrays of DataObjects with the members :Rule and :Message. The member :Model contains the invoice model returned by :toModel().

Description

Checks the invoice against the EU content rules (BR-xx), the EN 16931 rules which can be checked without the official Schematron, the rules of the active scenario (:validateScenario()) and the national checks of the seller's country profile.

The method does not stop at the first problem. Instead, it collects all errors and warnings, each identified by its EN 16931 or XRechnung rule ID. This allows all issues to be reported or logged at once.

The method does not raise runtime errors. If the calculation performed by :toModel() fails, a single error with the rule ID "CALC" is reported instead.

Note: this method does not replace the official validators (KoSIT or CEN Schematron). It performs the checks which can be done before an invoice is serialized. Since :toXRechnung() and :toZugferd() raise a runtime error if validation errors remain, :validate() should be called before these methods.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.