Interfaces: Include Zugferd2.2/Factur-X 1.0 in schemata, allow additional filenames for Factur-X invoices

This commit is contained in:
Jonathan Jenne 2022-03-28 11:37:50 +02:00
parent ef7683a587
commit 5d722f70e3
3 changed files with 4444 additions and 13 deletions

View File

@ -123,25 +123,26 @@ Public Class ZUGFeRDInterface
Dim oXmlDocument As XPathDocument Dim oXmlDocument As XPathDocument
If Results Is Nothing Then If Results Is Nothing Then
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei.") Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei, weil die Attachments nicht gelesen werden konnten.")
End If End If
If Results.Count = 0 Then If Results.Count = 0 Then
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei.") Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei, weil sie keine Attachments enthält.")
End If End If
Dim oFound As Boolean = False Dim oValidFilenames As New List(Of String) From {
Dim oFoundResult As PDFEmbeds.EmbeddedFile = Nothing PDFEmbeds.ZUGFERD_XML_FILENAME.ToUpper,
PDFEmbeds.FACTUR_X_XML_FILENAME_DE.ToUpper,
PDFEmbeds.FACTUR_X_XML_FILENAME_FR.ToUpper
}
For Each oResult In Results ' Find the first file which filename matches the valid filenames for embedded invoice files
If oResult.FileName.ToUpper() = PDFEmbeds.ZUGFERD_XML_FILENAME.ToUpper() Then Dim oFoundResult As PDFEmbeds.EmbeddedFile = Results.
oFound = True Where(Function(result) oValidFilenames.Contains(result.FileName.ToUpper)).
oFoundResult = oResult FirstOrDefault()
End If
Next
If Not oFound Then If oFoundResult Is Nothing Then
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei.") Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei, weil die zugferd-invoice.xml nicht gefunden wurde.")
End If End If
Try Try
@ -170,7 +171,8 @@ Public Class ZUGFeRDInterface
Dim oTypes As New List(Of Type) From { Dim oTypes As New List(Of Type) From {
GetType(ZUGFeRD.Version1_0.CrossIndustryDocumentType), GetType(ZUGFeRD.Version1_0.CrossIndustryDocumentType),
GetType(ZUGFeRD.Version2_0.CrossIndustryInvoiceType), GetType(ZUGFeRD.Version2_0.CrossIndustryInvoiceType),
GetType(ZUGFeRD.Version2_1_1.CrossIndustryInvoiceType) GetType(ZUGFeRD.Version2_1_1.CrossIndustryInvoiceType),
GetType(ZUGFeRD.Version2_2_FacturX.CrossIndustryInvoiceType)
} }
For Each oType In oTypes For Each oType In oTypes

View File

@ -7,6 +7,8 @@ Public Class PDFEmbeds
Private ReadOnly Logger As Logger Private ReadOnly Logger As Logger
Public Const ZUGFERD_XML_FILENAME = "ZUGFeRD-invoice.xml" Public Const ZUGFERD_XML_FILENAME = "ZUGFeRD-invoice.xml"
Public Const FACTUR_X_XML_FILENAME_FR = "factur-x.xml"
Public Const FACTUR_X_XML_FILENAME_DE = "xrechnung.xml"
Public Class EmbeddedFile Public Class EmbeddedFile
Public FileName As String Public FileName As String