6 Commits

Author SHA1 Message Date
Jonathan Jenne
f3afadc3b7 Interfaces: fix Zugferd exceptions 2023-02-28 14:56:01 +01:00
Jonathan Jenne
89fbc4e4ae Interfaces: Version 1.10.3.0 2023-02-28 14:12:56 +01:00
Jonathan Jenne
adf692629a Interfaces: Improve logging 2023-02-28 14:12:28 +01:00
Jonathan Jenne
f6f421ddd8 Interfaces: Version 1.10.2.0 2023-02-28 13:50:17 +01:00
Jonathan Jenne
2ced2f192f Jobs: Version 1.14.1.0 2023-02-28 13:50:03 +01:00
Jonathan Jenne
a80b943dc5 Interfaces/Jobs: add new method FilterPropertyMap 2023-02-28 13:49:16 +01:00
4 changed files with 31 additions and 23 deletions

View File

@@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("Digital Data")>
<Assembly: AssemblyProduct("Modules.Interfaces")>
<Assembly: AssemblyCopyright("Copyright © 2022")>
<Assembly: AssemblyTrademark("1.10.1.0")>
<Assembly: AssemblyCopyright("Copyright © 2023")>
<Assembly: AssemblyTrademark("1.10.3.0")>
<Assembly: ComVisible(False)>
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.10.1.0")>
<Assembly: AssemblyFileVersion("1.10.0.0")>
<Assembly: AssemblyVersion("1.10.3.0")>
<Assembly: AssemblyFileVersion("1.10.3.0")>

View File

@@ -5,6 +5,7 @@ Imports System.Xml.XPath
Imports System.Xml.Xsl
Imports DigitalData.Modules.Interfaces.Exceptions
Imports DigitalData.Modules.Interfaces.ZUGFeRD
Imports DigitalData.Modules.Interfaces.ZUGFeRDInterface
Imports DigitalData.Modules.Logging
Imports GdPicture14
@@ -101,6 +102,21 @@ Public Class ZUGFeRDInterface
AllowedFilenames = oAllowedFilenames
End Sub
Public Function FilterPropertyMap(pPropertyMap As Dictionary(Of String, XmlItemProperty), pSpecification As String) As Dictionary(Of String, XmlItemProperty)
_logger.Debug("Filtering Property map for Specification [{0}]", pSpecification)
If pSpecification = ZUGFERD_SPEC_10 Then
_logger.Debug("Special Case [{0}], including [{1}]", ZUGFERD_SPEC_10, ZUGFERD_SPEC_DEFAULT)
Return pPropertyMap.
Where(Function(kv) kv.Value.Specification = pSpecification Or kv.Value.Specification = ZUGFERD_SPEC_DEFAULT).
ToDictionary(Function(kv) kv.Key, Function(kv) kv.Value)
Else
_logger.Debug("Using Specification [{0}]", pSpecification)
Return pPropertyMap.
Where(Function(kv) kv.Value.Specification = pSpecification).
ToDictionary(Function(kv) kv.Key, Function(kv) kv.Value)
End If
End Function
''' <summary>
''' Validates a ZUGFeRD File and extracts the XML Document from it
@@ -295,7 +311,8 @@ Public Class ZUGFeRDInterface
Next
If oObject Is Nothing Then
Throw New ApplicationException("No Types matched the given document. Document could not be serialized.")
'Throw New ApplicationException("No Types matched the given document. Document could not be serialized.")
Throw New ZUGFeRDExecption(ErrorType.UnsupportedFormat, "Unsupported Format")
End If
pResult.Specification = oSpecification
@@ -303,6 +320,10 @@ Public Class ZUGFeRDInterface
Return pResult
Catch ex As ZUGFeRDExecption
_logger.Error(ex)
Throw ex
Catch ex As Exception
_logger.Error(ex)
Dim oMessage = "Datei ist eine ungültige ZUGFeRD Datei oder das Format wird nicht unterstüzt, oder das Format ist deaktiviert."

View File

@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyCompany("Digital Data")>
<Assembly: AssemblyProduct("Modules.Jobs")>
<Assembly: AssemblyCopyright("Copyright © 2023")>
<Assembly: AssemblyTrademark("1.14.0.0")>
<Assembly: AssemblyTrademark("1.14.1.0")>
<Assembly: ComVisible(False)>
@@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices
' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
' übernehmen, indem Sie "*" eingeben:
<Assembly: AssemblyVersion("1.14.0.0")>
<Assembly: AssemblyFileVersion("1.14.0.0")>
<Assembly: AssemblyVersion("1.14.1.0")>
<Assembly: AssemblyFileVersion("1.14.1.0")>

View File

@@ -299,7 +299,8 @@ Public Class ImportZUGFeRDFiles
' Check the document against the configured property map and return:
' - a List of valid properties
' - a List of missing properties
Dim oPropertyMap = GetPropertyMapFor(oArgs, oDocument.Specification)
Dim oPropertyMap = _zugferd.FilterPropertyMap(oArgs.PropertyMap, oDocument.Specification)
Dim oCheckResult = _zugferd.PropertyValues.CheckPropertyValues(oDocument.SchemaObject, oPropertyMap, oMessageId)
_logger.Info("Properties checked: [{0}] missing properties / [{1}] valid properties found.", oCheckResult.MissingProperties.Count, oCheckResult.ValidProperties.Count)
@@ -619,20 +620,6 @@ Public Class ImportZUGFeRDFiles
_firebird.ExecuteNonQueryWithConnection(oCommand, pConnections.FirebirdConnection, Firebird.TransactionMode.ExternalTransaction, pConnections.FirebirdTransaction)
End Sub
Private Function GetPropertyMapFor(pWorkerArgs As WorkerArgs, pSpecification As String) As Dictionary(Of String, XmlItemProperty)
Dim oPropertyMap = DoGetPropertyMapFor(pWorkerArgs, pSpecification)
_logger.Debug("Found [{0}] Properties for Specification [{1}].", oPropertyMap.Count, pSpecification)
' If no properties were found, fall back to the default specification before giving up
If oPropertyMap.Count = 0 Then
_logger.Warn("No Properties found for Specification [{0}]. Loading default property map!", pSpecification)
Return DoGetPropertyMapFor(pWorkerArgs, ZUGFeRDInterface.ZUGFERD_SPEC_DEFAULT)
End If
Return oPropertyMap
End Function
Private Function DoGetPropertyMapFor(pWorkerArgs As WorkerArgs, pSpecification As String) As Dictionary(Of String, XmlItemProperty)
Return pWorkerArgs.PropertyMap.
Where(Function(kv) kv.Value.Specification = pSpecification).