Jobs: Change Email Text for Filesize Exceeded

This commit is contained in:
Jonathan Jenne 2021-07-20 13:21:04 +02:00
parent 662c3f3ed4
commit b323445821
3 changed files with 14 additions and 4 deletions

View File

@ -23,7 +23,13 @@
Public Const EMAIL_NO_FERDS = "<p>Ihre Email enthielt keine ZUGFeRD-Dokumente.</p>"
Public Const EMAIL_FILE_SIZE_REACHED = "<p>Ihre Email enthielt Dateien, die die erlaubte Größe von {0}MB überschreiten.</p>"
Public Const EMAIL_FILE_SIZE_REACHED = """
<p>Die von Ihnen gesendete Rechnung oder einer der Rechnungs-Anhänge überschreiten die erlaubte Größe von <strong>{0} MB</strong>.</p>
<p>Die folgende Datei hat die erlaubte Größe überschritten:<ul>
<li>{1}</li>
</ul></p>
<p>Der Betreff der Original-Email war: {2}</p>
"""
Public Const EMAIL_INVALID_DOCUMENT = """
<p>Ihre Email enthielt ein ZUGFeRD Dokument, welches aber inkorrekt formatiert wurde.</p>

View File

@ -407,8 +407,10 @@ Public Class ImportZUGFeRDFiles
Create_HistoryEntry(oMessageId, oMD5CheckSum, "REJECTED - File size limit reached", oFBTransaction)
Dim oBody = String.Format(EmailStrings.EMAIL_FILE_SIZE_REACHED, oArgs.MaxAttachmentSizeInMegaBytes)
Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oMessageId)
Dim oKey = FileSizeLimitReachedException.KEY_FILENAME
Dim oFileExceedingThreshold = IIf(ex.Data.Contains(oKey), ex.Data.Item(oKey), "")
Dim oBody = String.Format(EmailStrings.EMAIL_FILE_SIZE_REACHED, oArgs.MaxAttachmentSizeInMegaBytes, oFileExceedingThreshold, oEmailData.Subject)
_email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "FileSizeLimitReachedException", _EmailOutAccountId)
AddRejectedState(oMessageId, "FileSizeLimitReachedException", "Erlaubte Dateigröße überschritten", "", oSQLTransaction)
@ -767,6 +769,7 @@ Public Class ImportZUGFeRDFiles
''' <returns></returns>
Private Function Check_FileSize(pFileInfo As FileInfo, pMaxFileSizeInMegaBytes As Integer) As Boolean
_logger.Info("Checking Filesize of {0}", pFileInfo.Name)
_logger.Debug("Filesize threshold is {0} MB.", pMaxFileSizeInMegaBytes)
If pMaxFileSizeInMegaBytes <= 0 Then
_logger.Debug("Filesize is not configured. Skipping check.")
@ -775,8 +778,6 @@ Public Class ImportZUGFeRDFiles
Dim oMaxSize = pMaxFileSizeInMegaBytes * 1024 * 1024
_logger.Debug("Filesize threshold is {0} bytes.", oMaxSize)
If oMaxSize > 0 And pFileInfo.Length > oMaxSize Then
_logger.Debug("Filesize is bigger than threshold. Rejecting.")
Return False

View File

@ -24,8 +24,11 @@ Public Class Exceptions
Public Class FileSizeLimitReachedException
Inherits ApplicationException
Public Const KEY_FILENAME = "FILENAME"
Public Sub New(pFilePath As String, pFileSizeLimitInMegaBytes As Integer)
MyBase.New($"At least one file exceeded the filesize limit of {pFileSizeLimitInMegaBytes}MB: {pFilePath}")
Data.Add(KEY_FILENAME, pFilePath)
End Sub
End Class