ConnectingEurope / eInvoicing-EN16931

Validation artefacts for the European eInvoicing standard EN 16931
Other
138 stars 54 forks source link

Rule BR-CO-19 not working correctly #219

Closed midran closed 3 years ago

midran commented 4 years ago

Requester name Henry Buck PEPPOL member company MBIE PEPPOL Area / components POACC (PostAward) Ex: e-Ordering, e-Invoicing Description

I have been creating test files to trigger the errors when a file fails the tests in the A-NZ schematron. Rule BR-CO-19 is a PEPPOL standard, and the only way I could trigger this error was to have nothing within the invoice period as follows:

<cac:InvoicePeriod> </cac:InvoicePeriod>

The problem may be that the condition is missing parentheses and should read as follows:

(exists(cbc:StartDate) or exists(cbc:EndDate) or (exists(cbc:DescriptionCode)) and not(exists(cbc:StartDate)) and not(exists(cbc:EndDate)))

Issue orignitated from Peppol https://openpeppol.atlassian.net/browse/PEPPOL-2857

phax commented 3 years ago

@oriol the "DescriptionCode" element is a requirement from BT-8. You change for 1.3.3 somehow broke InvoicePeriod that contains StartDate, EndDate and DescriptionCode...

@sarafacchinettiIC

oriol commented 3 years ago

Reverting to the previous Xpath as it correctly implemented the rule plus the effect of mapping the DescriptionCode to BT-8.

exists(cbc:StartDate) or exists(cbc:EndDate) or (exists(cbc:DescriptionCode) and not(exists(cbc:StartDate)) and not(exists(cbc:EndDate)))

This checks positive when any of StartDate and EndDate are in the InvoicePeriod and the case where the InvoicePeriod is used just to carry information on the DescriptionCode to support BT-8

phax commented 3 years ago

Did you test with the example above:

<cac:InvoicePeriod> </cac:InvoicePeriod>
oriol commented 3 years ago

There is a test here https://github.com/ConnectingEurope/eInvoicing-EN16931/blob/master/test/Invoice-unit-UBL/BR-CO-19.xml

phax commented 3 years ago

Great thanks :)

sarafacchinettiIC commented 3 years ago

The test case might also include as success test

<cac:InvoicePeriod>
            <cbc:StartDate>2020-11-01</cbc:StartDate>
            <cbc:EndDate>2020-11-30</cbc:EndDate>
            <cbc:DescriptionCode>3</cbc:DescriptionCode>
</cac:InvoicePeriod>
oriol commented 3 years ago

Added the test