VRBL-INV-PH-1p0-22

Basic Info

Rule The value of the Invoice Subtype Code must be contained in Invoice Subtype Code List [VRBL-CL-PH-InvoiceSubtypeCode] (prefixed by 'VRBL:PH:'). Allowed values: VRBL:PH:CAS, VRBL:PH:POS.
Context /ubl:Invoice/cec:UBLExtensions/cec:UBLExtension/cec:ExtensionContent/vrbl:InvoiceExtension
Pattern vrbl-invoice-ph-1p0
Severity fatal

Used Template: CodeList

Parameter Value
probe = vrbl:InvoiceSubtypeCode
codeList = $VRBL-PH-Prefix:$VRBL-CL-PH-InvoiceSubtypeCode
showValues = true

Implementation

not(boolean(vrbl:InvoiceSubtypeCode))
or
(
	(
		substring(normalize-space(vrbl:InvoiceSubtypeCode), 1, string-length($VRBL-PH-Prefix)) = $VRBL-PH-Prefix
		and
		not(
			contains(
				substring-after(normalize-space(vrbl:InvoiceSubtypeCode), $VRBL-PH-Prefix),
				substring($VRBL-CL-PH-InvoiceSubtypeCode, 1, 1)
			)
		)
		and
		contains(
			$VRBL-CL-PH-InvoiceSubtypeCode,
			concat(
				substring($VRBL-CL-PH-InvoiceSubtypeCode, 1, 1),
				substring-after(normalize-space(vrbl:InvoiceSubtypeCode), $VRBL-PH-Prefix),
				substring($VRBL-CL-PH-InvoiceSubtypeCode, 1, 1)
			)
		)
	)
)