itplr-kosit/validator-configuration-xrechnung

No Validation-Rule for `ubl:Invoice/cac:InvoiceLine/cac:DocumentReference/cbc:DocumentTypeCode`

j-otten opened this issue · 3 comments

Hi,

according to the Standard, ubl: Invoice /cac: InvoiceLine/cac: DocumentReference/cbc: DocumentTypeCode (default value 130*) is a mandatory field when using ubl:Invoice/cac:InvoiceLine/cac:DocumentReference.

There is no rule within the Validator Configuration for XRechnung to validate cbc: DocumentTypeCode, but there is one in the Visualization-Tool.

<!--StartFragment-->
         <xsl:apply-templates mode="BT-128"
            select="./cac:DocumentReference/cbc:ID[following-sibling::cbc:DocumentTypeCode = '130']"/><!-- Code "130" MUST be used to indicate an invoice object reference. Not used for other additional documents -->
<!--EndFragment-->

This means that the cbc: ID field is not displayed in the visualization if cbc: DocumentTypeCode is not available. However, a previous validation does not indicate an error.

*https://docs.peppol.eu/poacc/billing/3.0/syntax/ubl-invoice/cac-InvoiceLine/cac-DocumentReference/

phax commented

Hello @j-otten,
the validation you mentioned originates from the EN 16931 rules which is the source of the Peppol rules.

Additionally, the Peppol rules don't apply when you want to validate XRechnung.

See https://github.com/ConnectingEurope/eInvoicing-EN16931/blob/master/ubl/schematron/preprocessed/EN16931-UBL-validation-preprocessed.sch for the source rule:

<assert id="UBL-CR-666" flag="fatal" test="not(//cac:AdditionalDocumentReference[cbc:DocumentTypeCode  = '130']/cac:Attachment)">[UBL-CR-666]-A UBL invoice shall not include an AdditionalDocumentReference simultaneously referring an Invoice Object Identifier and an Attachment</assert>

Since the XRechnung rules require the usage of the EN rules, this case is covered and I don't see any need for action here.

I know that I have condensed a lot of stuff into this quick response, so feel free to come back with further details you need to know.
hth, Philip

Hello @phax,

thanks for the quick response.

The rule you are referring to does not check the element in my previous post, it checks the AdditionalDocumentReference element.

The code in my post is from the visualization for XRechnung. If the rule I mentioned is not relevant for XRechnungen, why is there a check in the visualization?

The additional check in visualization is just for robustness. It excludes all non-valid IDs.