From 131850d2ee2ff4e7d0e4077d2d22cf3f5c1d51e5 Mon Sep 17 00:00:00 2001 From: ruff Date: Thu, 4 Jul 2024 05:41:18 +0200 Subject: [PATCH] Preparations for name swapping support --- src/XmlConverterCiiToUbl.php | 31 +++++++++++++++++++++++++++++++ src/XmlConverterUblToCii.php | 31 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/src/XmlConverterCiiToUbl.php b/src/XmlConverterCiiToUbl.php index ef10a45..caee670 100644 --- a/src/XmlConverterCiiToUbl.php +++ b/src/XmlConverterCiiToUbl.php @@ -77,6 +77,13 @@ class XmlConverterCiiToUbl extends XmlConverterBase */ private $automaticModeDisabled = true; + /** + * Internal flag to disable name swapping (Legal Organisation and Party Name) + * + * @var boolean + */ + private $nameSwappingDisabled = true; + /** * @inheritDoc */ @@ -196,6 +203,30 @@ public function enableAutomaticMode(): XmlConverterCiiToUbl return $this; } + /** + * Disable name swapping + * + * @return XmlConverterCiiToUbl + */ + public function disableNameSwapping(): XmlConverterCiiToUbl + { + $this->nameSwappingDisabled = true; + + return $this; + } + + /** + * Enable name swapping + * + * @return XmlConverterCiiToUbl + */ + public function enableNameSwapping(): XmlConverterCiiToUbl + { + $this->nameSwappingDisabled = false; + + return $this; + } + /** * Returns true if source is a credit note, otherwise false * diff --git a/src/XmlConverterUblToCii.php b/src/XmlConverterUblToCii.php index f3d0c6f..285327b 100644 --- a/src/XmlConverterUblToCii.php +++ b/src/XmlConverterUblToCii.php @@ -62,6 +62,13 @@ class XmlConverterUblToCii extends XmlConverterBase */ private $ublLineQuantityRootName = 'cbc:InvoicedQuantity'; + /** + * Internal flag to disable name swapping (Party Legal Entity and Party Name) + * + * @var boolean + */ + private $nameSwappingDisabled = true; + /** * @inheritDoc */ @@ -145,6 +152,30 @@ protected function doConvert() return $this; } + /** + * Disable name swapping + * + * @return XmlConverterUblToCii + */ + public function disableNameSwapping(): XmlConverterUblToCii + { + $this->nameSwappingDisabled = true; + + return $this; + } + + /** + * Enable name swapping + * + * @return XmlConverterUblToCii + */ + public function enableNameSwapping(): XmlConverterUblToCii + { + $this->nameSwappingDisabled = false; + + return $this; + } + /** * Convert system information *