diff --git a/Interfaces/ZUGFeRDInterface.vb b/Interfaces/ZUGFeRDInterface.vb index 0b6a59da..e717bff1 100644 --- a/Interfaces/ZUGFeRDInterface.vb +++ b/Interfaces/ZUGFeRDInterface.vb @@ -64,6 +64,7 @@ Public Class ZUGFeRDInterface Public ElementName As String Public ElementValue As String Public ErrorMessage As String + Public ErrorMessageDE As String End Class ''' diff --git a/Interfaces/ZUGFeRDInterface/Validator.vb b/Interfaces/ZUGFeRDInterface/Validator.vb index bef87b34..2016f0cc 100644 --- a/Interfaces/ZUGFeRDInterface/Validator.vb +++ b/Interfaces/ZUGFeRDInterface/Validator.vb @@ -28,7 +28,8 @@ Public Class Validator pResult.ValidationErrors.Add(New ZugferdValidationError() With { .ElementName = oNode.Name.LocalName, .ElementValue = oNode.Value, - .ErrorMessage = "Value could not be parsed as Decimal" + .ErrorMessage = "Value could not be parsed as Decimal.", + .ErrorMessageDE = "Der Wert konnte nicht in eine Dezimalzahl umgewandelt werden." }) End If Next @@ -50,7 +51,8 @@ Public Class Validator pResult.ValidationErrors.Add(New ZugferdValidationError() With { .ElementName = oNode.Name.LocalName, .ElementValue = oNode.Value, - .ErrorMessage = "Invalid CurrencyCode. Only 3-Character codes are allowed." + .ErrorMessage = "Invalid CurrencyCode. Only 3-Character codes are allowed.", + .ErrorMessageDE = "Ungültiger Währungscode. Es sind nur 3-stellige Codes erlaubt." }) End If Next @@ -76,7 +78,8 @@ Public Class Validator pResult.ValidationErrors.Add(New ZugferdValidationError() With { .ElementName = oNode.Name.LocalName, .ElementValue = oCurrencyID, - .ErrorMessage = "Invalid currencyID. Only 3-Character codes or empty values are allowed." + .ErrorMessage = "Invalid currencyID. Only 3-Character codes or empty values are allowed.", + .ErrorMessageDE = "Ungültige WährungsID. Es sind nur 3-Zeichen lange Codes oder ein leerer Wert erlaubt." }) End If Next diff --git a/Jobs/Jobs.vbproj b/Jobs/Jobs.vbproj index 3b82f5ae..6b3deada 100644 --- a/Jobs/Jobs.vbproj +++ b/Jobs/Jobs.vbproj @@ -95,6 +95,7 @@ + diff --git a/Jobs/My Project/AssemblyInfo.vb b/Jobs/My Project/AssemblyInfo.vb index 5872f1a6..414eb306 100644 --- a/Jobs/My Project/AssemblyInfo.vb +++ b/Jobs/My Project/AssemblyInfo.vb @@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices - + @@ -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: - - + + diff --git a/Jobs/ZUGFeRD/EmailFunctions.vb b/Jobs/ZUGFeRD/EmailFunctions.vb index 3d7562c8..53f88043 100644 --- a/Jobs/ZUGFeRD/EmailFunctions.vb +++ b/Jobs/ZUGFeRD/EmailFunctions.vb @@ -1,10 +1,12 @@ -Imports DigitalData.Modules.Logging -Imports DigitalData.Modules.Database -Imports DigitalData.Modules.Base +Imports System.Collections.Generic Imports System.Data Imports System.IO +Imports DigitalData.Modules.Base +Imports DigitalData.Modules.Database +Imports DigitalData.Modules.Logging +Imports DigitalData.Modules.Jobs.ImportZUGFeRDFiles Imports System.Data.SqlClient -Imports System.Collections.Generic +Imports FirebirdSql.Data Namespace ZUGFeRD Public Class EmailFunctions @@ -18,7 +20,133 @@ Namespace ZUGFeRD _mssql = MSSQL End Sub - Public Sub AddToEmailQueueMSSQL(MessageId As String, BodyText As String, pEmailData As EmailData, SourceProcedure As String, pEmailAccountId As Integer, NamePortal As String) + ''' + ''' Method to decide wether we use the old or the new + ''' Rejection E-mail method. + ''' + ''' TODO we have no information about the language of the receiver at the moment + ''' + ''' E-Mail Message ID + ''' DB Transaction + ''' Body Text + ''' Email Data object + ''' Exception Title + ''' Sending Profile from config + ''' Name of the Portal from config + ''' ID for E-Mail-Template from config + ''' Error Code + ''' Zusätzlicher Parameter 1 + ''' Zusätzlicher Parameter 2 + Public Sub AddToEmailQueueMSSQL(pMessageId As String, pTransaction As SqlTransaction, pBodyText As String, pEmailData As EmailData, pSourceProcedure As String, + pEmailAccountId As Integer, pNamePortal As String, pTemplateId As Integer, pErrorCode As ErrorCode, + pParameter1 As String, pParameter2 As String) + + Dim useLegacyMethod = True + Dim oErrorCode As String = String.Empty + + ' ErrorCode valid? + If pErrorCode <> ErrorCode.Unknown Then + Dim intCode As Integer = DirectCast(pErrorCode, Integer) + oErrorCode = $"{EmailStrings.ErrorCodePraefix}{intCode}" + + Dim oSQL = $"SELECT COUNT(*) FROM TBDD_GUI_LANGUAGE_PHRASE WHERE TITLE = '{oErrorCode}'" + If _mssql.GetScalarValue(oSQL) > 0 Then + useLegacyMethod = False + Else + _logger.Warn($"Rejection reason [{oErrorCode}] not found in TBDD_GUI_LANGUAGE_PHRASE!") + End If + End If + + ' Gibt es das Template in TBDD_EMAIL_TEMPLATE? + If useLegacyMethod = False AndAlso pTemplateId > 0 Then + Try + Dim oSQL = $"SELECT COUNT(*) FROM TBDD_EMAIL_TEMPLATE WHERE GUID = {pTemplateId}" + If _mssql.GetScalarValue(oSQL) <= 0 Then + _logger.Warn($"EMAIL_TEMPLATE [{pTemplateId}] not found in TBDD_EMAIL_TEMPLATE!") + useLegacyMethod = True + End If + Catch ex As Exception + _logger.Error(ex) + useLegacyMethod = True + End Try + + Else + _logger.Debug($"RejectionTemplateId not configured!") + useLegacyMethod = True + End If + + ' Check if Stored Procedure PRDD_SEND_REJECTION_MAIL exists + If useLegacyMethod = False Then + Try + Dim oSQL = $"SELECT COUNT(*) FROM sys.objects WHERE type = 'P' AND OBJECT_ID = OBJECT_ID('dbo.PRDD_SEND_REJECTION_MAIL')" + If _mssql.GetScalarValue(oSQL) <= 0 Then + _logger.Warn($"Procedure ['PRDD_SEND_REJECTION_MAIL'] not found in Database!") + useLegacyMethod = True + End If + Catch ex As Exception + _logger.Error(ex) + useLegacyMethod = True + End Try + End If + + If useLegacyMethod = True Then + _logger.Warn("New rejection mail logic is not configured correctly, use legacy logic instead!") + AddToEmailQueueMSSQL(pMessageId, pBodyText, pEmailData, pSourceProcedure, pEmailAccountId, pNamePortal) + Else + _logger.Debug("New rejection mail logic is configured!") + AddToEmailQueueMSSQL(pMessageId, pTransaction, pTemplateId, oErrorCode, pEmailAccountId, pParameter1, pParameter2) + End If + + End Sub + + + ''' + ''' Function calls SP PRDD_SEND_REJECTION_MAIL + ''' for sending rejection mail. + ''' + ''' E-Mail Message ID + ''' DB Transaction + ''' GUID for TBDD_EMAIL_TEMPLATE from config + ''' ErrorID (TBDD_GUI_LANGUAGE_PHRASE) + ''' Sending profile from config + ''' Zusätzlicher Parameter 1 + ''' Zusätzlicher Parameter 2 + Private Sub AddToEmailQueueMSSQL(pMessageId As String, pTransaction As SqlTransaction, pTemplateId As Integer, pErrorCode As String, pEmailAccountId As Integer, + pParameter1 As String, pParameter2 As String) + + If pParameter1.IsNullOrEmpty Then + pParameter1 = "" + Else + pParameter1 = pParameter1.Replace("'", "''") + End If + + If pParameter2.IsNullOrEmpty Then + pParameter2 = "" + Else + pParameter2 = pParameter2.Replace("'", "''") + End If + + Try + Dim oExecute = $"EXECUTE dbo.PRDD_SEND_REJECTION_MAIL + '{pMessageId}' + , 0 + , {pEmailAccountId} + , 'ZUGFeRD Service' + , {pTemplateId} + , '{pErrorCode}' + , '{pParameter1}' + , '{pParameter2}' + , 77" + + _mssql.ExecuteNonQuery(oExecute, pTransaction) + + Catch ex As Exception + _logger.Error(ex) + End Try + + End Sub + + Private Sub AddToEmailQueueMSSQL(MessageId As String, BodyText As String, pEmailData As EmailData, SourceProcedure As String, pEmailAccountId As Integer, NamePortal As String) If pEmailData Is Nothing Then _logger.Warn("EmailData is empty. Email will not be sent!") Exit Sub diff --git a/Jobs/ZUGFeRD/EmailStrings.vb b/Jobs/ZUGFeRD/EmailStrings.vb index f5daa1bd..2c3b843f 100644 --- a/Jobs/ZUGFeRD/EmailStrings.vb +++ b/Jobs/ZUGFeRD/EmailStrings.vb @@ -9,25 +9,34 @@ Public Const EMAIL_SUBJECT_REJECTED = "@NAME_ZUGFERD_PORTAL: Beleg abgelehnt" Public Const EMAIL_SUBJECT_EXCEPTION = "@NAME_ZUGFERD_PORTAL: Unbehandelte Ausnahme" + ' OutOfMemoryException = 20009 + ' UnhandledException = 20010 + ' FileMoveException = 200011 Public Const EMAIL_UNHANDLED_EXCEPTION = """

Beim Verarbeiten der Datei mit der Message ID '{0}' ist ein schwerer Fehler aufgetreten.

Fehlerbeschreibung: {1}

{2}
""" + ' MissingValueException = 20007 Public Const EMAIL_MISSINGPROPERTIES_1 = "

Die angehängte Datei entspricht nicht dem WISAG ZUGFeRD-Format: {0}

" - Public Const EMAIL_MISSINGPROPERTIES_2 = "

Die folgenden Eigenschaften wurden als ERFORDERLICH eingestuft, wurden aber nicht gefunden:

" + Public Const EMAIL_MISSINGPROPERTIES_2 = "

Die folgenden Eigenschaften wurden als ERFORDERLICH eingestuft, wurden aber nicht gefunden:

" + ' MD5HashException = 20002 Public Const EMAIL_MD5_ERROR = "

Die von Ihnen gesendete Rechnung ({0}) wurde bereits von unserem System verarbeitet.

" + ' ValidationException = 20001 Public Const EMAIL_VALIDATION_ERROR = "

Die von Ihnen gesendete Rechnung hat die ZUGFeRD Validierung nicht bestanden.

Die folgenden Felder sind nicht korrekt:

    {0}

" + ' TooMuchFerdsException = 20005 Public Const EMAIL_TOO_MUCH_FERDS = "

In Ihrer Email ({0}) sind mehr als ein ZUGFeRD Dokument enthalten. Bitte prüfen Sie die Rechnungsanhänge. Nur eine Rechnung darf das ZUGFeRD-Format enthalten.

" + ' NoFerdsException = 20006 Public Const EMAIL_NO_FERDS = "

Ihre Email ({0}) enthielt keine ZUGFeRD-Dokumente.

" + ' FileSizeLimitReachedException = 20008 Public Const EMAIL_FILE_SIZE_REACHED = "

Die von Ihnen gesendete Rechnung oder einer der Rechnungs-Anhänge überschreitet die erlaubte Größe von {0} MB.

Die folgende Datei hat die erlaubte Größe überschritten:

    @@ -35,6 +44,7 @@

" + ' InvalidFerdException = 20004 Public Const EMAIL_INVALID_DOCUMENT = "

Ihre Email ({0}) enthielt ein ZUGFeRD Dokument, welches aber inkorrekt formatiert wurde.

Mögliche Gründe für ein inkorrektes Format sind:

    @@ -43,7 +53,14 @@

" + ' UnsupportedFerdException = 20003 Public Const EMAIL_UNSUPPORTED_DOCUMENT = "

Ihre Email ({0}) enthielt ein ZUGFeRD Format ({1}), welches zur Zeit noch nicht freigeschaltet ist.

" + + ''' + ''' Präfix für den verwendeten ErrorCode + ''' Beispiel: ZUGFERD_Rejection_20001 + ''' + Public Const ErrorCodePraefix = "ZUGFERD_Rejection_" End Class diff --git a/Jobs/ZUGFeRD/ErrorCode.vb b/Jobs/ZUGFeRD/ErrorCode.vb new file mode 100644 index 00000000..0d8f41e9 --- /dev/null +++ b/Jobs/ZUGFeRD/ErrorCode.vb @@ -0,0 +1,14 @@ +Public Enum ErrorCode + Unknown = 0 + ValidationException = 20001 + MD5HashException = 20002 + UnsupportedFerdException = 20003 + InvalidFerdException = 20004 + TooMuchFerdsException = 20005 + NoFerdsException = 20006 + MissingValueException = 20007 + FileSizeLimitReachedException = 20008 + OutOfMemoryException = 20009 + UnhandledException = 20010 + FileMoveException = 200011 +End Enum diff --git a/Jobs/ZUGFeRD/FileFunctions.vb b/Jobs/ZUGFeRD/FileFunctions.vb index e0060913..98ac7bd9 100644 --- a/Jobs/ZUGFeRD/FileFunctions.vb +++ b/Jobs/ZUGFeRD/FileFunctions.vb @@ -122,6 +122,11 @@ Namespace ZUGFeRD Dim oSource = _email.GetOriginalEmailPath(pArgs.OriginalEmailDirectory, pMessageId) _logger.Debug("Original email path: [{0}]", oSource) + If oSource = String.Empty Then + _logger.Warn("Original Email for [{0}] could not be found. Exiting.", pMessageId) + Return New EmailData() + End If + Dim oDateSubDirectoryName As String = Now.ToString("yyyy-MM-dd") Dim oDestination As String @@ -137,11 +142,6 @@ Namespace ZUGFeRD End Try End If - If oSource = String.Empty Then - _logger.Warn("Original Email for [{0}] could not be found. Exiting.", pMessageId) - Return New EmailData() - End If - ' If oEmailData is Nothing, TBEDM_EMAIL_PROFILER_HISTORY for MessageId was not found. ' This only should happen when testing and db-tables are deleted frequently If oEmailData Is Nothing Then diff --git a/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb b/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb index e843ae64..251bac2f 100644 --- a/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb +++ b/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb @@ -222,13 +222,15 @@ Public Class ImportZUGFeRDFiles _history.Update_HistoryEntry(oMessageId, oMD5CheckSum, oMessage) Dim oErrorList As String = "" + Dim oErrorListDE As String = "" For Each oError In oErrors - oErrorList += $"
  • Element '{oError.ElementName}' mit Wert '{oError.ElementValue}': {oError.ErrorMessage}
  • " + oErrorList += $"
  • Element '{oError.ElementName}' with Value '{oError.ElementValue}': {oError.ErrorMessage}
  • " + oErrorListDE += $"
  • Element '{oError.ElementName}' mit Wert '{oError.ElementValue}': {oError.ErrorMessageDE}
  • " Next Dim oBody = String.Format(EmailStrings.EMAIL_VALIDATION_ERROR, oErrorList) Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId) - _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "ValidationException", _EmailOutAccountId, oArgs.NamePortal) + _email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "ValidationException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.ValidationException, oErrorListDE, oErrorList) AddRejectedState(oMessageId, "ValidationException", "Die Rechnungsvalidierung ist fehlgeschlagen!", "", oSQLTransaction) Catch ex As MD5HashException @@ -241,7 +243,7 @@ Public Class ImportZUGFeRDFiles Dim oBody = String.Format(EmailStrings.EMAIL_MD5_ERROR, ex.FileName) Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId) - _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "MD5HashException", _EmailOutAccountId, oArgs.NamePortal) + _email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "MD5HashException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.MD5HashException, ex.FileName, "") AddRejectedState(oMessageId, "MD5HashException", "Die gesendete Rechnung wurde bereits verarbeitet!", "", oSQLTransaction) Catch ex As UnsupportedFerdException @@ -254,7 +256,7 @@ Public Class ImportZUGFeRDFiles Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId) Dim oBody As String = String.Format(EmailStrings.EMAIL_UNSUPPORTED_DOCUMENT, oEmailData.Subject, ex.XmlFile) - _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "UnsupportedFerdException", _EmailOutAccountId, oArgs.NamePortal) + _email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "UnsupportedFerdException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnsupportedFerdException, ex.XmlFile, "") AddRejectedState(oMessageId, "UnsupportedFerdException", "Nicht unterstütztes Datenformat", "", oSQLTransaction) Catch ex As InvalidFerdException @@ -267,7 +269,7 @@ Public Class ImportZUGFeRDFiles Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId) Dim oBody = String.Format(EmailStrings.EMAIL_INVALID_DOCUMENT, oEmailData.Subject) - _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "InvalidFerdException", _EmailOutAccountId, oArgs.NamePortal) + _email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "InvalidFerdException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.InvalidFerdException, "", "") AddRejectedState(oMessageId, "InvalidFerdException", "Inkorrekte Formate", "", oSQLTransaction) Catch ex As TooMuchFerdsException @@ -278,7 +280,7 @@ Public Class ImportZUGFeRDFiles Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId) Dim oBody = String.Format(EmailStrings.EMAIL_TOO_MUCH_FERDS, oEmailData.Subject) - _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "TooMuchFerdsException", _EmailOutAccountId, oArgs.NamePortal) + _email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "TooMuchFerdsException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.TooMuchFerdsException, "", "") AddRejectedState(oMessageId, "TooMuchFerdsException", "Email enthielt mehr als ein ZUGFeRD-Dokument", "", oSQLTransaction) Catch ex As NoFerdsException @@ -289,7 +291,7 @@ Public Class ImportZUGFeRDFiles Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId) Dim oBody = String.Format(EmailStrings.EMAIL_NO_FERDS, oEmailData.Subject) - _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "NoFerdsException", _EmailOutAccountId, oArgs.NamePortal) + _email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "NoFerdsException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.NoFerdsException, "", "") AddRejectedState(oMessageId, "NoFerdsException", " Email enthielt keine ZUGFeRD-Dokumente", "", oSQLTransaction) Catch ex As MissingValueException @@ -302,9 +304,14 @@ Public Class ImportZUGFeRDFiles _history.Update_HistoryEntry(oMessageId, oMD5CheckSum, $"REJECTED - Missing Required Properties: [{oMessage}]") + Dim oMissingFieldList As String = "" + For Each oMissingFieldDescription In ex.MissingProperties + oMissingFieldList += $"
  • {oMissingFieldDescription}
  • " + Next + Dim oBody = _email.CreateBodyForMissingProperties(ex.File.Name, ex.MissingProperties) Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId) - _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "MissingValueException", _EmailOutAccountId, oArgs.NamePortal) + _email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "MissingValueException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.MissingValueException, ex.File.Name, oMissingFieldList) AddRejectedState(oMessageId, "MissingValueException", "Es fehlten ZugferdSpezifikationen", oMessage, oSQLTransaction) Catch ex As FileSizeLimitReachedException @@ -322,7 +329,7 @@ Public Class ImportZUGFeRDFiles Dim oBody = String.Format(EmailStrings.EMAIL_FILE_SIZE_REACHED, oArgs.MaxAttachmentSizeInMegaBytes, oFileWithoutMessageId) - _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "FileSizeLimitReachedException", _EmailOutAccountId, oArgs.NamePortal) + _email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "FileSizeLimitReachedException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.FileSizeLimitReachedException, oArgs.MaxAttachmentSizeInMegaBytes, oFileWithoutMessageId) AddRejectedState(oMessageId, "FileSizeLimitReachedException", "Erlaubte Dateigröße überschritten", "", oSQLTransaction) @@ -341,7 +348,7 @@ Public Class ImportZUGFeRDFiles .From = oArgs.ExceptionEmailAddress, .Subject = $"OutOfMemoryException im ZUGFeRD-Parser @ {oMessageId}" } - _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "OutOfMemoryException", _EmailOutAccountId, oArgs.NamePortal) + _email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "OutOfMemoryException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace) ' Rollback Transaction oSQLTransaction.Rollback() @@ -360,7 +367,7 @@ Public Class ImportZUGFeRDFiles .From = oArgs.ExceptionEmailAddress, .Subject = $"UnhandledException im ZUGFeRD-Parser @ {oMessageId}" } - _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "UnhandledException", _EmailOutAccountId, oArgs.NamePortal) + _email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "UnhandledException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace) ' Rollback Transaction oSQLTransaction.Rollback() @@ -386,7 +393,7 @@ Public Class ImportZUGFeRDFiles .From = oArgs.ExceptionEmailAddress, .Subject = $"FileMoveException im ZUGFeRD-Parser @ {oMessageId}" } - _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "FileMoveException", _EmailOutAccountId, oArgs.NamePortal) + _email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "FileMoveException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace) _logger.Warn("Could not move files!") _logger.Error(ex) diff --git a/Jobs/ZUGFeRD/WorkerArgs.vb b/Jobs/ZUGFeRD/WorkerArgs.vb index 154b150e..f10474e9 100644 --- a/Jobs/ZUGFeRD/WorkerArgs.vb +++ b/Jobs/ZUGFeRD/WorkerArgs.vb @@ -16,6 +16,7 @@ Public Class WorkerArgs ' Email Parameter Public EmailOutProfileId As Integer = 0 + Public RejectionTemplateId As Integer = 0 ' Misc Flag Parameters Public ExceptionEmailAddress As String = Nothing