ZUGFeRD: Update for new version

This commit is contained in:
Jonathan Jenne
2023-01-12 14:33:54 +01:00
parent 3183b0ed31
commit c1018d176e
5 changed files with 66 additions and 45 deletions

View File

@@ -24,7 +24,7 @@ Public Class PropertyValues
Public TableName As String
Public TableColumn As String
Public ISRequired As Boolean
Public IsRequired As Boolean
Public GroupCounter As Integer = -1
Public Description As String
@@ -99,9 +99,7 @@ Public Class PropertyValues
Dim oIsRequired As Boolean = oColumn.Key.IsRequired
Dim oPropertyDescription As String = oColumn.Key.Description
Dim oRowCounter = oRowIndex + oGlobalGroupCounter + 1
If IsNothing(oRowCounter) Then
End If
' Returns nothing if oColumn.Value contains an empty list
Dim oPropertyValue = oColumn.Value.ElementAtOrDefault(oRowIndex)
@@ -127,7 +125,7 @@ Public Class PropertyValues
.GroupCounter = oRowCounter,
.TableName = oTableName,
.TableColumn = oTableColumn,
.ISRequired = oIsRequired
.IsRequired = oIsRequired
})
Next
Next
@@ -139,6 +137,7 @@ Public Class PropertyValues
For Each oItem As KeyValuePair(Of String, XmlItemProperty) In oDefaultProperties
Dim oPropertyValueList As List(Of Object)
Dim oTableColumn As String = oItem.Value.TableColumn
Dim oPropertyDescription As String = oItem.Value.Description
Dim oPropertyValue As Object = Nothing
Dim oTableName = oItem.Value.TableName
Dim oIsRequired = oItem.Value.IsRequired
@@ -146,7 +145,7 @@ Public Class PropertyValues
Try
oPropertyValueList = GetPropValue(Document, oItem.Key)
Catch ex As Exception
_logger.Warn("{2} # Unknown error occurred while fetching specification [{0}] in group [{1}]:", oTableColumn, oItem.Value.GroupScope, MessageId)
_logger.Warn("{2} # Unknown error occurred while fetching specification [{0}] in group [{1}]:", oPropertyDescription, oItem.Value.GroupScope, MessageId)
_logger.Error(ex)
oPropertyValueList = New List(Of Object)
End Try
@@ -164,24 +163,24 @@ Public Class PropertyValues
' This should hopefully show config errors
If TypeOf oPropertyValue Is List(Of Object) Then
_logger.Warn("Item with TableColumn [{0}] may be configured incorrectly", oTableColumn)
_logger.Warn("Item with specification [{0}] may be configured incorrectly", oPropertyDescription)
oPropertyValue = Nothing
End If
End Select
End If
Catch ex As Exception
_logger.Warn("Unknown error occurred while processing specification [{0}]:", oTableColumn)
_logger.Warn("Unknown error occurred while processing specification [{0}]:", oPropertyDescription)
_logger.Error(ex)
oPropertyValue = Nothing
End Try
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
If oItem.Value.IsRequired Then
_logger.Warn("{0} # Specification [{1}] is empty, but marked as required! Skipping.", MessageId, oTableColumn)
oResult.MissingProperties.Add(oTableColumn)
_logger.Warn("{0} # Specification [{1}] is empty, but marked as required! Skipping.", MessageId, oPropertyDescription)
oResult.MissingProperties.Add(oPropertyDescription)
Continue For
Else
_logger.Debug("{0} # oPropertyValue for specification [{1}] is empty or not found. Skipping.", MessageId, oTableColumn)
_logger.Debug("{0} # oPropertyValue for specification [{1}] is empty or not found. Skipping.", MessageId, oPropertyDescription)
Continue For
End If
@@ -193,7 +192,7 @@ Public Class PropertyValues
.Value = oPropertyValue,
.TableName = oTableName,
.TableColumn = oTableColumn,
.ISRequired = oIsRequired
.IsRequired = oIsRequired
})
Next