Skip to content

Fix document reference elements being written in the wrong order - #180

Open
CasperBE wants to merge 1 commit into
num-num:masterfrom
CasperBE:fix-document-reference-order
Open

Fix document reference elements being written in the wrong order#180
CasperBE wants to merge 1 commit into
num-num:masterfrom
CasperBE:fix-document-reference-order

Conversation

@CasperBE

Copy link
Copy Markdown
Contributor

UBL declares the document reference elements in an xsd:sequence, so the order they are written in is not cosmetic. Invoice, CreditNote and DebitNote share Invoice::xmlSerialize(), but each schema requires a different order, and the single hardcoded order matched none of them.

On an Invoice, cac:ContractDocumentReference was written before cac:DespatchDocumentReference, and cac:OriginatorDocumentReference after cac:AdditionalDocumentReference. Any document combining a contract reference with a despatch, receipt or additional reference therefore failed schema validation.

Also re-enables the contract reference in ContractDocumentReferenceTest, which built the object but never attached it to the invoice.

UBL declares the document reference elements in an xsd:sequence, so the order they are written in is not cosmetic. Invoice, CreditNote and DebitNote share Invoice::xmlSerialize(), but each schema requires a different order, and the single hardcoded order matched none of them.

On an Invoice, cac:ContractDocumentReference was written before cac:DespatchDocumentReference, and cac:OriginatorDocumentReference after cac:AdditionalDocumentReference. Any document combining a contract reference with a despatch, receipt or additional reference therefore failed schema validation.

Also re-enables the contract reference in ContractDocumentReferenceTest, which built the object but never attached it to the invoice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant