Attestwire › Rule reference › BR-CL-23
BR-CL-23 A unit of measure must be a UN/ECE Recommendation 20 code
noun · EN 16931 · fatal · BT-130
For a sample invoice, the library reports: Line 1 has a unit of measure code (BT-130) of "hours", which is not in UN/ECE Recommendation 20 (with the Rec 21 extension). The unit is a code, not a word: "hours", "Stk", "each" and "pcs" are all rejected, and so is a valid code in the wrong case.
- Business term
BT-130- Severity
fatal
The fix
Set line.unitCode to "HUR" (Rec 20: "hour"), which is what "hours" stands for. resolveUnitCode() in this package does the same for the common English, German and French unit words, so a unit your system stores as a word can be converted before it reaches the invoice.
A passing value
"quantity": 10, "unitCode": "HUR"What the library returns
The full error returned by @attestwire/en16931. It includes the rule ID,
affected field and suggested correction. Developers can use this object in their application:
{
"rule": "BR-CL-23",
"field": "BT-130",
"severity": "fatal",
"message": "Line 1 has a unit of measure code (BT-130) of \"hours\", which is not in UN/ECE Recommendation 20 (with the Rec 21 extension). The unit is a code, not a word: \"hours\", \"Stk\", \"each\" and \"pcs\" are all rejected, and so is a valid code in the wrong case.",
"fix": "Set line.unitCode to \"HUR\" (Rec 20: \"hour\"), which is what \"hours\" stands for. resolveUnitCode() in this package does the same for the common English, German and French unit words, so a unit your system stores as a word can be converted before it reaches the invoice.",
"example": "\"quantity\": 10, \"unitCode\": \"HUR\"",
"xpath": "/ubl:Invoice/cac:InvoiceLine[1]/cbc:InvoicedQuantity/@unitCode",
"docsUrl": "https://attestwire.com/rules/BR-CL-23"
}
xpath is always a UBL path. On a CII invoice, look for the
matching CII field instead.