Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redundant/broken rule in release v.1.3.9 #335

Closed
juskoljo opened this issue Dec 1, 2022 · 5 comments
Closed

Redundant/broken rule in release v.1.3.9 #335

juskoljo opened this issue Dec 1, 2022 · 5 comments
Assignees
Milestone

Comments

@juskoljo
Copy link

juskoljo commented Dec 1, 2022

Hi,

I think it does not make sense to have rule UBL-SR-51 as XSD already disallows multiple address line cbc:Line elements?

<rule context="//cac:AddressLine">
  <assert id="UBL-SR-51" flag="fatal" test="count(cbc:Line) = 1">[UBL-SR-51]-An address can only have one third line.</assert>
</rule>

According to UBL-CommonAggregateComponents-2.1.xsd element cac:AddressLine/cbc:Line may occur 1..1 times.

   <xsd:complexType name="AddressLineType">
      <xsd:annotation>
         <xsd:documentation>
            <ccts:Component>
               <ccts:ComponentType>ABIE</ccts:ComponentType>
               <ccts:DictionaryEntryName>Address Line. Details</ccts:DictionaryEntryName>
               <ccts:Definition>A class to define an unstructured address line.</ccts:Definition>
               <ccts:ObjectClass>Address Line</ccts:ObjectClass>
            </ccts:Component>
         </xsd:documentation>
      </xsd:annotation>
      <xsd:sequence>
         <xsd:element ref="cbc:Line" minOccurs="1" maxOccurs="1">
            <xsd:annotation>
               <xsd:documentation>
                  <ccts:Component>
                     <ccts:ComponentType>BBIE</ccts:ComponentType>
                     <ccts:DictionaryEntryName>Address Line. Line. Text</ccts:DictionaryEntryName>
                     <ccts:Definition>An address line expressed as unstructured text.</ccts:Definition>
                     <ccts:Cardinality>1</ccts:Cardinality>
                     <ccts:ObjectClass>Address Line</ccts:ObjectClass>
                     <ccts:PropertyTerm>Line</ccts:PropertyTerm>
                     <ccts:RepresentationTerm>Text</ccts:RepresentationTerm>
                     <ccts:DataType>Text. Type</ccts:DataType>
                     <ccts:Examples>123 Standard Chartered Tower </ccts:Examples>
                  </ccts:Component>
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
      </xsd:sequence>
   </xsd:complexType>

However, it seems that it is possible to have than one cac:AddressLine, which should be against the rules at least in PeppolBIS 3.0 (cardinality 0..1)?

https://docs.peppol.eu/poacc/billing/3.0/2022-Q4/syntax/ubl-invoice/cac-AccountingSupplierParty/cac-Party/cac-PostalAddress/

Example below:

<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
         xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
         xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0</cbc:CustomizationID>
  <cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</cbc:ProfileID>
  <cbc:ID>1</cbc:ID>
  <cbc:IssueDate>2022-12-01</cbc:IssueDate>
  <cbc:DueDate>2022-12-01</cbc:DueDate>
  <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
  <cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
  <cbc:BuyerReference>1</cbc:BuyerReference>
  <cac:AccountingSupplierParty>
    <cac:Party>
      <cbc:EndpointID schemeID="0037">003712345678</cbc:EndpointID>
      <cac:PartyName>
        <cbc:Name>Name</cbc:Name>
      </cac:PartyName>
      <cac:PostalAddress>
        <cbc:StreetName>StreetName</cbc:StreetName>
        <cbc:CityName>CityName</cbc:CityName>
        <cbc:PostalZone>12345</cbc:PostalZone>
        <cac:AddressLine>
          <cbc:Line>AddressLine/Line</cbc:Line>
        </cac:AddressLine>
        <cac:AddressLine>
          <cbc:Line>AddressLine/Line</cbc:Line>
        </cac:AddressLine>
        <cac:AddressLine>
          <cbc:Line>AddressLine/Line</cbc:Line>
        </cac:AddressLine>
        <cac:Country>
          <cbc:IdentificationCode>FI</cbc:IdentificationCode>
        </cac:Country>
      </cac:PostalAddress>
      <cac:PartyTaxScheme>
        <cbc:CompanyID>FI12345678</cbc:CompanyID>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:PartyTaxScheme>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName>RegistrationName</cbc:RegistrationName>
        <cbc:CompanyID schemeID="0212">1234567-8</cbc:CompanyID>
      </cac:PartyLegalEntity>
    </cac:Party>
  </cac:AccountingSupplierParty>
  <cac:AccountingCustomerParty>
    <cac:Party>
      <cbc:EndpointID schemeID="0037">003787654321</cbc:EndpointID>
      <cac:PartyName>
        <cbc:Name>Name</cbc:Name>
      </cac:PartyName>
      <cac:PostalAddress>
        <cbc:StreetName>StreetName</cbc:StreetName>
        <cbc:CityName>CityName</cbc:CityName>
        <cbc:PostalZone>54321</cbc:PostalZone>
        <cac:Country>
          <cbc:IdentificationCode>FI</cbc:IdentificationCode>
        </cac:Country>
      </cac:PostalAddress>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName>RegistrationName</cbc:RegistrationName>
        <cbc:CompanyID schemeID="0212">8765432-1</cbc:CompanyID>
      </cac:PartyLegalEntity>
    </cac:Party>
  </cac:AccountingCustomerParty>
  <cac:TaxTotal>
    <cbc:TaxAmount currencyID="EUR">24.00</cbc:TaxAmount>
    <cac:TaxSubtotal>
      <cbc:TaxableAmount currencyID="EUR">100.00</cbc:TaxableAmount>
      <cbc:TaxAmount currencyID="EUR">24.00</cbc:TaxAmount>
      <cac:TaxCategory>
        <cbc:ID>S</cbc:ID>
        <cbc:Percent>24.00</cbc:Percent>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:TaxCategory>
    </cac:TaxSubtotal>
  </cac:TaxTotal>
  <cac:LegalMonetaryTotal>
    <cbc:LineExtensionAmount currencyID="EUR">100.00</cbc:LineExtensionAmount>
    <cbc:TaxExclusiveAmount currencyID="EUR">100.00</cbc:TaxExclusiveAmount>
    <cbc:TaxInclusiveAmount currencyID="EUR">124.00</cbc:TaxInclusiveAmount>
    <cbc:PayableAmount currencyID="EUR">124.00</cbc:PayableAmount>
  </cac:LegalMonetaryTotal>
  <cac:InvoiceLine>
    <cbc:ID>1</cbc:ID>
    <cbc:InvoicedQuantity unitCode="ZZ">1.00</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="EUR">100.00</cbc:LineExtensionAmount>
    <cac:Item>
      <cbc:Name>Name</cbc:Name>
      <cac:ClassifiedTaxCategory>
        <cbc:ID>S</cbc:ID>
        <cbc:Percent>24.00</cbc:Percent>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
    </cac:Item>
    <cac:Price>
      <cbc:PriceAmount currencyID="EUR">100.00</cbc:PriceAmount>
    </cac:Price>
  </cac:InvoiceLine>
</Invoice>

With Best Regards,
Jussi

@phax phax added the Format UBL label Dec 1, 2022
@oriol oriol added this to the 1.3.10 milestone Mar 29, 2023
@oriol oriol self-assigned this Mar 29, 2023
@oriol oriol closed this as completed in 1c42422 Mar 29, 2023
@juskoljo
Copy link
Author

juskoljo commented May 25, 2023

Hi,

Thanks for the fix!

I'm wondering why rule context has cac:RegistrationAddress and cac:DeliveryAddress as those are not part of EN16931 model? (https://test-docs.peppol.eu/poacc/billing/3.0/rules/ubl-tc434/)

<rule context="//cac:PostalAddress | //cac:RegistrationAddress | cac:DeliveryAddress">
  <assert id="UBL-SR-51" flag="fatal" test="not(cac:AddressLine) or count(cac:AddressLine) = 1">...</assert>
</rule>

Also it seems that DeliveryLocation is not covered with the updated rule.

<cac:Delivery>
  <cbc:ActualDeliveryDate>2014-01-01</cbc:ActualDeliveryDate>
  <cac:DeliveryLocation>
    <cbc:ID schemeID="0088">1238764941386</cbc:ID>
    <cac:Address>
      <cbc:StreetName>StreetName</cbc:StreetName>
      <cbc:CityName>CityName</cbc:CityName>
      <cbc:PostalZone>1234</cbc:PostalZone>
      <cac:AddressLine>
        <cbc:Line>AddressLine/Line</cbc:Line>
      </cac:AddressLine>
      <cac:AddressLine>
        <cbc:Line>AddressLine/Line</cbc:Line>
      </cac:AddressLine>
      <cac:AddressLine>
        <cbc:Line>AddressLine/Line</cbc:Line>
      </cac:AddressLine>
      <cac:AddressLine>
        <cbc:Line>AddressLine/Line</cbc:Line>
      </cac:AddressLine>
      <cac:Country>
        <cbc:IdentificationCode listID="ISO3166-1:Alpha2">NO</cbc:IdentificationCode>
      </cac:Country>
    </cac:Address>
  </cac:DeliveryLocation>
</cac:Delivery>

With Best Regards,
Jussi

@juskoljo
Copy link
Author

Should I create a new issue about this? @oriol @phax

@oriol
Copy link
Collaborator

oriol commented May 29, 2023

Sorry @juskoljo, yes please add another issue.

@juskoljo
Copy link
Author

Thanks @oriol, new issue is now submitted!

@petredanoiu
Copy link

hi,
so the rule UBL-SR-51 has been changed?
the current version v.1.3.10 incorrectly applies it, in my opinion.
in UBL-Invoice-2.1xsd: cac:AddressLine element is (0..n) with cbc:Line (1..1)

so the above xml example is correct, but not valid because of UBL-SR-51.

Am i wrong?
10x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants