ZUGFeRDService: Add IgnoreRejectionStatus Parameter

This commit is contained in:
Jonathan Jenne 2021-07-12 10:39:38 +02:00
parent 0667d31813
commit 45de1d6122
4 changed files with 25 additions and 6 deletions

View File

@ -240,8 +240,8 @@ Public Class ImportZUGFeRDFiles
oEmbeddedAttachmentFiles.AddRange(oAttachments) oEmbeddedAttachmentFiles.AddRange(oAttachments)
End If End If
' TODO MD5 ' Check the Checksum and rejection status
oMD5CheckSum = Check_MD5Sum(oFile.FullName) oMD5CheckSum = Check_MD5Sum(oFile.FullName, oArgs.IgnoreRejectionStatus)
' Check if there are more than one ZUGFeRD files ' Check if there are more than one ZUGFeRD files
If oZUGFeRDCount = 1 Then If oZUGFeRDCount = 1 Then
@ -723,7 +723,7 @@ Public Class ImportZUGFeRDFiles
' even if the Checksum exists in the history entries (default case) ' even if the Checksum exists in the history entries (default case)
' Which means, if it was not rejected before, it will be rejected in any case! ' Which means, if it was not rejected before, it will be rejected in any case!
' '
' This logic can be overwritten by the ForceRejection parameter. ' This logic can be overwritten by the IgnoreRejectionStatus parameter.
' If it is set to true, the file will be rejected if the file exists in the history entries, ' If it is set to true, the file will be rejected if the file exists in the history entries,
' regardless of the rejected parameter. ' regardless of the rejected parameter.
If oRejected = False Or pIgnoreRejectionStatus = True Then If oRejected = False Or pIgnoreRejectionStatus = True Then

View File

@ -7,11 +7,13 @@ Public Class WorkerArgs
Public ErrorDirectory As String Public ErrorDirectory As String
Public OriginalEmailDirectory As String Public OriginalEmailDirectory As String
Public RejectedEmailDirectory As String Public RejectedEmailDirectory As String
Public ExceptionEmailAddress As String
Public AttachmentsSubDirectory As String Public AttachmentsSubDirectory As String
Public PropertyMap As Dictionary(Of String, XmlItemProperty) Public PropertyMap As Dictionary(Of String, XmlItemProperty)
Public InsertIntoSQLServer As Boolean Public InsertIntoSQLServer As Boolean
Public ExceptionEmailAddress As String
Public IgnoreRejectionStatus As Boolean
Public Sub New() Public Sub New()
WatchDirectories = New List(Of String) WatchDirectories = New List(Of String)
SuccessDirectory = Nothing SuccessDirectory = Nothing
@ -19,8 +21,10 @@ Public Class WorkerArgs
OriginalEmailDirectory = Nothing OriginalEmailDirectory = Nothing
RejectedEmailDirectory = Nothing RejectedEmailDirectory = Nothing
AttachmentsSubDirectory = Nothing AttachmentsSubDirectory = Nothing
ExceptionEmailAddress = Nothing
PropertyMap = New Dictionary(Of String, XmlItemProperty) PropertyMap = New Dictionary(Of String, XmlItemProperty)
InsertIntoSQLServer = False InsertIntoSQLServer = False
ExceptionEmailAddress = Nothing
IgnoreRejectionStatus = False
End Sub End Sub
End Class End Class

View File

@ -1,5 +1,7 @@
Public Class Config Public Class Config
Public Property Firebird As New FirebirdConfig Public Property Firebird As New FirebirdConfig
Public Property Custom As New CustomConfig
Public Property MSSQLConnectionString As String = "" Public Property MSSQLConnectionString As String = ""
Public Property MSSQLEnabled As Boolean = False Public Property MSSQLEnabled As Boolean = False
Public Property MSSQLEmailOutAccountID As String = 1 Public Property MSSQLEmailOutAccountID As String = 1
@ -9,6 +11,18 @@
Public Property Debug As Boolean = False Public Property Debug As Boolean = False
Public Class CustomConfig
''' <summary>
''' If the file was already rejected, it is allowed to be processed again,
''' even if the Checksum exists in the history entries (default case)
'''
''' This logic can be overwritten by the IgnoreRejectionStatus parameter.
''' If it is set to true, the file will be rejected if the file exists in the history entries,
''' regardless of the REJECTED status.
''' </summary>
Public Property IgnoreRejectionStatus As Boolean = False
End Class
Public Class FirebirdConfig Public Class FirebirdConfig
Public Property DataSource As String = "172.24.12.41" Public Property DataSource As String = "172.24.12.41"
Public Property Database As String = "172.24.12.41:E:\DB\Firebird\Databases\EDMI_TEMPLATE\EDMI_MASTER.FDB" Public Property Database As String = "172.24.12.41:E:\DB\Firebird\Databases\EDMI_TEMPLATE\EDMI_MASTER.FDB"

View File

@ -50,7 +50,8 @@ Public Class ThreadRunner
End Try End Try
Dim oArgs As New WorkerArgs With { Dim oArgs As New WorkerArgs With {
.ExceptionEmailAddress = _config.Config.ExceptionEmailAddress .ExceptionEmailAddress = _config.Config.ExceptionEmailAddress,
.IgnoreRejectionStatus = _config.Config.Custom.IgnoreRejectionStatus
} }
oArgs = LoadFolderConfig(oArgs) oArgs = LoadFolderConfig(oArgs)
oArgs = LoadPropertyMapFor(oArgs, "DEFAULT") oArgs = LoadPropertyMapFor(oArgs, "DEFAULT")