Skip to content

Commit

Permalink
[FIX] Fixed NameSpace Problems for CreditNotes
Browse files Browse the repository at this point in the history
  • Loading branch information
HorstOeko committed Jan 15, 2025
1 parent 8c6bd80 commit 97ea47a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/XmlConverterUblToCii.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ protected function getSourceNamespaces(): array
{
return [
'ubl' => 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2',
'ublc' => 'urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2',
'cac' => 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2',
'cbc' => 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2',
];
Expand Down Expand Up @@ -99,10 +100,10 @@ protected function initialize()
protected function checkValidSource()
{
$this->source->whenExists(
'//ubl:CreditNote',
'//ublc:CreditNote',
null,
function () {
$this->ublRootName = 'ubl:CreditNote';
$this->ublRootName = 'ublc:CreditNote';
$this->ublLineRootName = 'cac:CreditNoteLine';
$this->ublLineQuantityRootName = 'cbc:CreditedQuantity';
},
Expand Down Expand Up @@ -351,7 +352,7 @@ function ($invoiceLineOrderLineRefIdNode) {
$this->destination->endElement();

$this->destination->startElement('ram:SpecifiedLineTradeDelivery');
$this->destination->elementWithAttribute('ram:BilledQuantity', $this->source->queryValue($this->ublLineQuantityRootName, $invoiceLineNode), 'unitCode', $this->source->queryValue('cbc:InvoicedQuantity/@unitCode', $invoiceLineNode));
$this->destination->elementWithAttribute('ram:BilledQuantity', $this->source->queryValue($this->ublLineQuantityRootName, $invoiceLineNode), 'unitCode', $this->source->queryValue(sprintf('%s/@unitCode', $this->ublLineQuantityRootName), $invoiceLineNode));
$this->destination->endElement();

$this->destination->startElement('ram:SpecifiedLineTradeSettlement');
Expand Down

0 comments on commit 97ea47a

Please sign in to comment.