Add Setting for Non-ZUGFeRD Files which are not rejected and instead moved to a special folder
This commit is contained in:
@@ -20,6 +20,8 @@ Public Class ImportZUGFeRDFiles
|
||||
Public Const ZUGFERD_EML = "ZUGFeRD Eml"
|
||||
Public Const ZUGFERD_REJECTED_EML = "ZUGFeRD Eml Rejected"
|
||||
Public Const ZUGFERD_ATTACHMENTS = "ZUGFeRD Attachments"
|
||||
Public Const ZUGFERD_NO_ZUGFERD = "Non-ZUGFeRD Files"
|
||||
|
||||
Public HISTORY_ID As Integer
|
||||
|
||||
Private Const DIRECTORY_DONT_MOVE = "DIRECTORY_DONT_MOVE"
|
||||
@@ -325,7 +327,21 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
'Check if there are no ZUGFeRD files
|
||||
If oZUGFeRDCount = 0 Then
|
||||
Throw New NoFerdsException()
|
||||
' If NonZugferdDirectory is not set, a NoFerdsException will be thrown and a rejection will be generated
|
||||
' This is the default/initial behaviour.
|
||||
If oArgs.NonZugferdDirectory Is Nothing OrElse oArgs.NonZugferdDirectory = String.Empty Then
|
||||
Throw New NoFerdsException()
|
||||
End If
|
||||
|
||||
' Also, if the directory is set but does not exist, still a rejection will be generated.
|
||||
If Not IO.Directory.Exists(oArgs.NonZugferdDirectory) Then
|
||||
Throw New NoFerdsException()
|
||||
End If
|
||||
|
||||
' Only if the directory is set and does exist, it will be used and any file groups which
|
||||
' do NOT CONTAIN ANY ZUGFERD DOCUMENTS, are moved to that directory.
|
||||
Throw New NoFerdsAlternateException()
|
||||
|
||||
End If
|
||||
|
||||
'If no errors occurred...
|
||||
@@ -393,6 +409,13 @@ Public Class ImportZUGFeRDFiles
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "NoFerdsException", _EmailOutAccountId)
|
||||
AddRejectedState(oMessageId, "NoFerdsException", " Email enthielt keine ZUGFeRD-Dokumente", "", oSQLTransaction)
|
||||
|
||||
Catch ex As NoFerdsAlternateException
|
||||
' TODO
|
||||
' Maybe dont even log this 'error', since it's not really an error
|
||||
' and it might happen *A LOT*
|
||||
_logger.Error(ex)
|
||||
oMoveDirectory = oArgs.NonZugferdDirectory
|
||||
|
||||
Catch ex As MissingValueException
|
||||
_logger.Error(ex)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user