VRBL-DPA-CORE-11

Basic Info

Rule The value of the Dispatch Advice Dispatch Line Delivered Quantity Unit Code must be contained in UN/ECE Recommendation 20 [VRBL-CL-UnitCode-Rec20] or be contained in UN/ECE Recommendation 21 [VRBL-CL-UnitCode-Rec21]. For more information visit: https://docs.peppol.eu/poacc/billing/3.0/codelist/UNECERec20/
Context /ubl:DespatchAdvice/cac:DespatchLine/cbc:DeliveredQuantity
Pattern vrbl-despatchadvice-core
Severity fatal

Used Template: CodeList

Parameter Value
probe = @unitCode
codeList = $VRBL-CL-UnitCode-Rec20 or $VRBL-CL-UnitCode-Rec21

Implementation

not(boolean(@unitCode))
or
(
	(
		not(
			contains(
				normalize-space(@unitCode),
				substring($VRBL-CL-UnitCode-Rec20, 1, 1)
			)
		)
		and
		contains(
			$VRBL-CL-UnitCode-Rec20,
			concat(
				substring($VRBL-CL-UnitCode-Rec20, 1, 1),
				normalize-space(@unitCode),
				substring($VRBL-CL-UnitCode-Rec20, 1, 1)
			)
		)
	)
)
or
(
	(
		not(
			contains(
				normalize-space(@unitCode),
				substring($VRBL-CL-UnitCode-Rec21, 1, 1)
			)
		)
		and
		contains(
			$VRBL-CL-UnitCode-Rec21,
			concat(
				substring($VRBL-CL-UnitCode-Rec21, 1, 1),
				normalize-space(@unitCode),
				substring($VRBL-CL-UnitCode-Rec21, 1, 1)
			)
		)
	)
)