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

BT-14 in CII -> BT-13 in UBL check #23

Closed
phax opened this issue Mar 12, 2024 · 5 comments · Fixed by #25
Closed

BT-14 in CII -> BT-13 in UBL check #23

phax opened this issue Mar 12, 2024 · 5 comments · Fixed by #25
Assignees
Labels
bug Something isn't working

Comments

@phax
Copy link
Owner

phax commented Mar 12, 2024

It seems, that if there exists BT-14 in CII, BT-13 will be generated, even if it not exists

@phax phax self-assigned this Mar 12, 2024
@phax phax added the bug Something isn't working label Mar 12, 2024
@lkumai
Copy link
Contributor

lkumai commented Apr 12, 2024

I went deeper into this matter and could narrow down the "bug" to class OrderReferenceType of ph-ubl21-9.0.1. It seems, that /Invoice/cac:OrderReference/cbc:ID is a required element:

@XmlElement(name = "ID", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2", required = true)
    private IDType id;

Then I looked into the scheme and the syntax binding and /Invoice/cac:OrderReference/cbc:ID which is mapped to BT-13 is indeed a required element. So this issue here is not a bug in my opinion.

Maybe filling it with a placeholder can be a workaround, but it would change the invoice a little bit.

@lkumai
Copy link
Contributor

lkumai commented Apr 12, 2024

I've implemented the workaround in CIItoUBL21Converter.java at line 712:

// OrderReference
    {
      final OrderReferenceType aUBLOrderRef = _createUBLOrderRef (aHeaderAgreement.getBuyerOrderReferencedDocument (),
                                                                  aHeaderAgreement.getSellerOrderReferencedDocument ());
      
      /* Set BT-13 with a hyhen if it is empty */
      if(aUBLOrderRef != null) 
      {
        if(aUBLOrderRef.getIDValue().equals("")) 
        {
          aUBLOrderRef.setID("-");
        }
      }
      aUBLInvoice.setOrderReference (aUBLOrderRef);
    }

@phax
Copy link
Owner Author

phax commented Apr 12, 2024

@lkumai I checked the existing code, and that branch is already contained.
Instead of setting a - an empty string "" is created. That alone is XSD compliant. So your issue was already solved in the latest release 2.2.1 - please crosscheck. My test was positive

@phax
Copy link
Owner Author

phax commented Apr 12, 2024

The problem is not just, that it is required, but also that it must not be empty.
To resolve this, I added the possibility to customize the value:

  • The new method for the setter is setDefaultOrderRefID(String)
  • The new CLI option is --ubl-defaultorderrefid

@phax
Copy link
Owner Author

phax commented Apr 12, 2024

Is part of the upcoming v2.2.2 release

@phax phax closed this as completed Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants