Skip to content

Commit

Permalink
CII to UBL -> Fix for AdditionalDocumentReference
Browse files Browse the repository at this point in the history
  • Loading branch information
HorstOeko committed Nov 8, 2024
1 parent ba680e6 commit 0687486
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
9 changes: 1 addition & 8 deletions src/XmlConverterCiiToUbl.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,7 @@ function ($additionalReferencedDocumentNode) {
function () use ($additionalReferencedDocumentNode) {
$this->destination->startElement('cac:AdditionalDocumentReference');
$this->destination->element('cbc:ID', $this->source->queryValue('./ram:IssuerAssignedID', $additionalReferencedDocumentNode));
$this->source->whenEquals(
'./ram:TypeCode',
$additionalReferencedDocumentNode,
'130',
function () use ($additionalReferencedDocumentNode) {
$this->destination->element('cbc:DocumentTypeCode', $this->source->queryValue('./ram:TypeCode', $additionalReferencedDocumentNode));
}
);
$this->destination->element('cbc:DocumentTypeCode', $this->source->queryValue('./ram:TypeCode', $additionalReferencedDocumentNode));
$this->destination->element('cbc:DocumentDescription', $this->source->queryValue('./ram:Name', $additionalReferencedDocumentNode));
$this->source->whenExists(
'./ram:AttachmentBinaryObject',
Expand Down
4 changes: 2 additions & 2 deletions tests/testcases/CiiToUblTechnical2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public function testDocumentGeneral(): void
$this->assertXPathNotExists('/ubl:Invoice/cac:DespatchDocumentReference/cbc:ID');
$this->assertXPathNotExists('/ubl:Invoice/cac:ReceiptDocumentReference/cbc:ID');
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:ID', 0, '01_15_Anhang_01');
$this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 0);
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 0, '916');
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentDescription', 0, 'Aufschlüsselung der einzelnen Leistungspositionen');
$this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:EmbeddedDocumentBinaryObject', 0);
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:ID', 1, '01_15_Anhang_02');
$this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 1);
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 1, '916');
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentDescription', 1, 'Gesamtübersicht der Leistungspositionen');
$this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:EmbeddedDocumentBinaryObject', 1);
$this->assertXPathNotExists('/ubl:Invoice/cac:OriginatorDocumentReference/cbc:ID');
Expand Down
2 changes: 1 addition & 1 deletion tests/testcases/CiiToUblTechnical3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testDocumentGeneral(): void
$this->assertXPathNotExists('/ubl:Invoice/cac:DespatchDocumentReference/cbc:ID');
$this->assertXPathNotExists('/ubl:Invoice/cac:ReceiptDocumentReference/cbc:ID');
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:ID', 0, '01_15_Anhang_01.pdf');
$this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 0);
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 0, '916');
$this->assertXPathValueWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentDescription', 0, 'Aufschlüsselung der einzelnen Leistungspositionen');
$this->assertXPathValueStartsWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cac:Attachment/cbc:EmbeddedDocumentBinaryObject', 0, 'JVBERi0xLjUNCiW1tbW1D');
$this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:ID', 1);
Expand Down
4 changes: 2 additions & 2 deletions tests/testcases/CiiToUblTechnical5Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public function testDocumentGeneral(): void
$this->assertXPathNotExists('/ubl:CreditNote/cac:DespatchDocumentReference/cbc:ID');
$this->assertXPathNotExists('/ubl:CreditNote/cac:ReceiptDocumentReference/cbc:ID');
$this->assertXPathValueWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:ID', 0, '01_15_Anhang_01');
$this->assertXPathNotExistsWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 0);
$this->assertXPathValueWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 1, '916');
$this->assertXPathValueWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:DocumentDescription', 0, 'Aufschlüsselung der einzelnen Leistungspositionen');
$this->assertXPathNotExistsWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:EmbeddedDocumentBinaryObject', 0);
$this->assertXPathValueWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:ID', 1, '01_15_Anhang_02');
$this->assertXPathNotExistsWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 1);
$this->assertXPathValueWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:DocumentTypeCode', 1, '916');
$this->assertXPathValueWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:DocumentDescription', 1, 'Gesamtübersicht der Leistungspositionen');
$this->assertXPathNotExistsWithIndex('/ubl:CreditNote/cac:AdditionalDocumentReference/cbc:EmbeddedDocumentBinaryObject', 1);
$this->assertXPathNotExists('/ubl:CreditNote/cac:OriginatorDocumentReference/cbc:ID');
Expand Down

0 comments on commit 0687486

Please sign in to comment.