Rule reference

BR-CL-23 A line has a unit of measure code (BT-130) of "hours", which is not in UN/ECE Recommendation 20 (with the Rec 21 extension)

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.

This rule is implemented and its error payload below is real, but the long-form write-up — normative text, worked example, divergence note — is not written yet. Everything the library knows about this rule is on this page. Ask and we will prioritise it.

Business term
BT-130
Severity
fatal

What the library returns

The exact object in result.errors when this rule fires. Generated by running @attestwire/en16931, not transcribed:

TeachingError
{
  "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 the Rec 20 code. The ones you will actually use: \"C62\" one/piece, \"HUR\" hour, \"DAY\" day, \"MON\" month, \"ANN\" year, \"KGM\" kilogram, \"MTR\" metre, \"MTK\" square metre, \"LTR\" litre, \"KWH\" kilowatt hour, \"E48\" service unit, \"P1\" percent. The full list is large — if you cannot find your unit, \"C62\" (one/piece) with the unit named in the item description is the conventional fallback.",
  "example": "\"quantity\": 10, \"unitCode\": \"HUR\"",
  "xpath": "/ubl:Invoice/cac:InvoiceLine[1]/cbc:InvoicedQuantity/@unitCode",
  "docsUrl": "https://attestwire.com/rules/BR-CL-23"
}

xpath locates the element in the generated UBL document, which is where a KoSIT or Peppol validator will report the same problem.

A passing value

the shape this field expects
"quantity": 10, "unitCode": "HUR"

The fix

Set line.unitCode to the Rec 20 code. The ones you will actually use: "C62" one/piece, "HUR" hour, "DAY" day, "MON" month, "ANN" year, "KGM" kilogram, "MTR" metre, "MTK" square metre, "LTR" litre, "KWH" kilowatt hour, "E48" service unit, "P1" percent. The full list is large — if you cannot find your unit, "C62" (one/piece) with the unit named in the item description is the conventional fallback.

Arrived from a stack trace? The docsUrl on every error links straight here. Something wrong on this page — tell us.