diff --git a/Services.ZUGFeRDService/Config.vb b/Services.ZUGFeRDService/Config.vb index e2701325..b13b0f4c 100644 --- a/Services.ZUGFeRDService/Config.vb +++ b/Services.ZUGFeRDService/Config.vb @@ -71,6 +71,8 @@ Public Property AllowZugferd2x As Boolean = True + Public Property AllowZugferd23x As Boolean = True + Public Property AllowPeppolBISBill3x As Boolean = False End Class End Class diff --git a/Services.ZUGFeRDService/ThreadRunner.vb b/Services.ZUGFeRDService/ThreadRunner.vb index 47fa79f8..96982dbe 100644 --- a/Services.ZUGFeRDService/ThreadRunner.vb +++ b/Services.ZUGFeRDService/ThreadRunner.vb @@ -52,13 +52,14 @@ Public Class ThreadRunner .AllowXRechnung = _config.Config.Custom.AllowXRechnung, .AllowZugferd10 = _config.Config.Custom.AllowZugferd10, .AllowZugferd2x = _config.Config.Custom.AllowZugferd2x, + .AllowZugferd23x = _config.Config.Custom.AllowZugferd23x, .AllowPeppolBISBill3x = _config.Config.Custom.AllowPeppolBISBill3x, .RejectionTemplateId = _config.Config.Custom.RejectionTemplateId, .GDPictureVersion = _config.Config.Custom.GDPictureVersion } oArgs = LoadFolderConfig(oArgs) - oArgs = LoadPropertyMap(oArgs) + oArgs = LoadPropertyMapListFor(oArgs) _logger.Debug("Custom Options:") _logger.Debug("ExceptionEmailAddress: [{0}]", oArgs.ExceptionEmailAddress) @@ -171,36 +172,44 @@ Public Class ThreadRunner Return pArgs End Function - Private Function LoadPropertyMap(pArgs As WorkerArgs) As WorkerArgs - Dim oSQL As String = $"SELECT * FROM TBDD_ZUGFERD_XML_ITEMS WHERE ACTIVE = 1 ORDER BY XML_PATH" - Dim oResult As DataTable = _mssql.GetDatatable(oSQL) + Private Function LoadPropertyMapListFor(Args As WorkerArgs) As WorkerArgs + Try + Args.PropertyMapList.Clear() - For Each oRow As DataRow In oResult.Rows - Dim oXmlPath As String = oRow.Item("XML_PATH") - Dim oTableName = oRow.Item("TABLE_NAME") - Dim oTableColumn = oRow.Item("TABLE_COLUMN") - Dim oDescription = oRow.Item("DESCRIPTION") - Dim oIsRequired = oRow.Item("IS_REQUIRED") - Dim oIsGrouped = oRow.Item("IS_GROUPED") - Dim oGroupScope = oRow.Item("GROUP_SCOPE") - Dim oSpecification = oRow.Item("SPECIFICATION") - Dim oItemType = oRow.Item("ITEM_TYPE") - Dim oEN16931Value = oRow.Item("EN16931_ID") + Dim oSQL As String = $"SELECT * FROM TBDD_ZUGFERD_XML_ITEMS WHERE ACTIVE = 1 ORDER BY XML_PATH" + Dim oResult As DataTable = _mssql.GetDatatable(oSQL) - pArgs.PropertyMap.Add(oXmlPath, New XmlItemProperty() With { - .Description = oDescription, - .TableName = oTableName, - .TableColumn = oTableColumn, - .IsRequired = oIsRequired, - .IsGrouped = oIsGrouped, - .GroupScope = oGroupScope, - .Specification = oSpecification, - .XMLPath = oXmlPath.Replace(".Value", ""), - .ItemType = oItemType, - .EN16931_ID = oEN16931Value - }) - Next + For Each oRow As DataRow In oResult.Rows + Dim xmlPath As String = oRow.Item("XML_PATH") + Dim tableName = oRow.Item("TABLE_NAME") + Dim tableColumn = oRow.Item("TABLE_COLUMN") + Dim description = oRow.Item("DESCRIPTION") + Dim isRequired = oRow.Item("IS_REQUIRED") + Dim isGrouped = oRow.Item("IS_GROUPED") + Dim groupScope = oRow.Item("GROUP_SCOPE") + Dim specification = oRow.Item("SPECIFICATION") + Dim oItemType = oRow.Item("ITEM_TYPE") + Dim oEN16931_ID = oRow.Item("EN16931_ID") - Return pArgs + Args.PropertyMapList.Add(New XmlItemProperty() With { + .XMLPath = xmlPath, + .Description = description, + .TableName = tableName, + .TableColumn = tableColumn, + .IsRequired = isRequired, + .IsGrouped = isGrouped, + .GroupScope = groupScope, + .Specification = specification, + .ItemType = oItemType, + .EN16931_ID = oEN16931_ID + }) + Next + + Return Args + Catch ex As Exception + _logger.Error(ex) + Return Args + End Try End Function + End Class