Jobs/Interfaces: add options for enabling / disabling zugferd schemas
This commit is contained in:
parent
67cdc580fa
commit
3df54fa62c
@ -35,6 +35,8 @@ Public Class ZUGFeRDInterface
|
||||
Public Class ZugferdOptions
|
||||
Public Property AllowFacturX_Filename As Boolean = True
|
||||
Public Property AllowXRechnung_Filename As Boolean = True
|
||||
Public Property AllowZugferd_1_0_Schema As Boolean = True
|
||||
Public Property AllowZugferd_2_x_Schema As Boolean = True
|
||||
End Class
|
||||
|
||||
''' <summary>
|
||||
@ -220,14 +222,21 @@ Public Class ZUGFeRDInterface
|
||||
Dim oReader As XmlReader
|
||||
Dim oResult = Nothing
|
||||
|
||||
Dim oTypes As New List(Of Type) From {
|
||||
GetType(ZUGFeRD.Version1_0.CrossIndustryDocumentType),
|
||||
GetType(ZUGFeRD.Version2_0.CrossIndustryInvoiceType),
|
||||
GetType(ZUGFeRD.Version2_1_1.CrossIndustryInvoiceType),
|
||||
GetType(ZUGFeRD.Version2_2_FacturX.CrossIndustryInvoiceType)
|
||||
}
|
||||
Dim oAllowedTypes As New List(Of Type)
|
||||
|
||||
For Each oType In oTypes
|
||||
If _Options.AllowZugferd_1_0_Schema Then
|
||||
oAllowedTypes.Add(GetType(ZUGFeRD.Version1_0.CrossIndustryDocumentType))
|
||||
End If
|
||||
|
||||
If _Options.AllowZugferd_2_x_Schema Then
|
||||
oAllowedTypes.AddRange(New List(Of Type) From {
|
||||
GetType(ZUGFeRD.Version2_0.CrossIndustryInvoiceType),
|
||||
GetType(ZUGFeRD.Version2_1_1.CrossIndustryInvoiceType),
|
||||
GetType(ZUGFeRD.Version2_2_FacturX.CrossIndustryInvoiceType)
|
||||
})
|
||||
End If
|
||||
|
||||
For Each oType In oAllowedTypes
|
||||
_logger.Debug("Trying Type [{0}]", oType.FullName)
|
||||
Dim oSerializer As New XmlSerializer(oType)
|
||||
|
||||
@ -251,7 +260,8 @@ Public Class ZUGFeRDInterface
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw New ZUGFeRDExecption(ErrorType.NoValidZugferd, "Datei ist eine ungültige ZUGFeRD Datei.")
|
||||
Dim oMessage = "Datei ist eine ungültige ZUGFeRD Datei oder das Format wird nicht unterstüzt, oder das Format ist deaktiviert."
|
||||
Throw New ZUGFeRDExecption(ErrorType.NoValidZugferd, oMessage)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
@ -26,4 +26,6 @@ Public Class WorkerArgs
|
||||
|
||||
Public AllowFacturX As Boolean = True
|
||||
Public AllowXRechnung As Boolean = True
|
||||
Public AllowZugferd10 As Boolean = True
|
||||
Public AllowZugferd2x As Boolean = True
|
||||
End Class
|
||||
Loading…
x
Reference in New Issue
Block a user