From 8399f13bb8fd6ffedb80d3ff44a200830bacde03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Miguel=20Moreno?= Date: Sun, 30 Jun 2024 14:43:31 +0200 Subject: [PATCH] Fixed BR-49 validation - Updated InvoiceValidationTrait > Fixes #56 --- src/Traits/InvoiceValidationTrait.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Traits/InvoiceValidationTrait.php b/src/Traits/InvoiceValidationTrait.php index 20e0da9..28dd763 100644 --- a/src/Traits/InvoiceValidationTrait.php +++ b/src/Traits/InvoiceValidationTrait.php @@ -168,7 +168,8 @@ private function getDefaultRules(): array { } }; $res['BR-49'] = static function(Invoice $inv) { - if ($inv->getPayment() !== null && $inv->getPayment()->getMeansCode() === null) { + if ($inv->getPayment() === null) return; + if ($inv->getPayment()->getMeansCode() === null && $inv->getPayment()->getTerms() === null) { return "A Payment instruction (BG-16) shall specify the Payment means type code (BT-81)"; } };