diff --git a/EnvelopeGenerator.Application/Common/Notifications/RemoveSignature/Handlers/RemoveHistoryHandler.cs b/EnvelopeGenerator.Application/Common/Notifications/RemoveSignature/Handlers/RemoveHistoryHandler.cs index 2f40bdc4..5c0742ad 100644 --- a/EnvelopeGenerator.Application/Common/Notifications/RemoveSignature/Handlers/RemoveHistoryHandler.cs +++ b/EnvelopeGenerator.Application/Common/Notifications/RemoveSignature/Handlers/RemoveHistoryHandler.cs @@ -34,7 +34,7 @@ public class RemoveHistoryHandler : INotificationHandler hists .Where(hist => hist.Envelope!.Uuid == notification.EnvelopeUuid) - .Where(hist => hist.Status == EnvelopeStatus.DocumentSigned) - , cancel); + .Where(hist => hist.Status == EnvelopeStatus.DocumentSigned), + cancel); } } \ No newline at end of file diff --git a/EnvelopeGenerator.BBTests/frmFinalizePDF.vb b/EnvelopeGenerator.BBTests/frmFinalizePDF.vb index 059c2c5b..157638cf 100644 --- a/EnvelopeGenerator.BBTests/frmFinalizePDF.vb +++ b/EnvelopeGenerator.BBTests/frmFinalizePDF.vb @@ -8,6 +8,7 @@ Imports Newtonsoft.Json.Linq Imports DigitalData.Core.Abstraction.Application Imports EnvelopeGenerator.Infrastructure Imports Microsoft.EntityFrameworkCore +Imports System.Text Public Class frmFinalizePDF Private Const CONNECTIONSTRING = "Server=sDD-VMP04-SQL17\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=+bk8oAbbQP1AzoHtvZUbd+Mbok2f8Fl4miEx1qssJ5yEaEWoQJ9prg4L14fURpPnqi1WMNs9fE4=;" @@ -104,7 +105,15 @@ Public Class frmFinalizePDF Process.Start(oNewPath) Catch ex As Exception - MsgBox(ex.Message, MsgBoxStyle.Critical) + Dim exMsg As StringBuilder = New StringBuilder(ex.Message).AppendLine() + + Dim innerEx = ex.InnerException + While (innerEx IsNot Nothing) + exMsg.AppendLine(innerEx.Message) + innerEx = innerEx.InnerException + End While + + MsgBox(exMsg.ToString(), MsgBoxStyle.Critical) End Try End Sub diff --git a/EnvelopeGenerator.CommonServices/Jobs/FinalizeDocument/PDFBurner.vb b/EnvelopeGenerator.CommonServices/Jobs/FinalizeDocument/PDFBurner.vb index 71cae689..e2aa1542 100644 --- a/EnvelopeGenerator.CommonServices/Jobs/FinalizeDocument/PDFBurner.vb +++ b/EnvelopeGenerator.CommonServices/Jobs/FinalizeDocument/PDFBurner.vb @@ -71,42 +71,39 @@ Namespace Jobs.FinalizeDocument Private Sub AddInstantJSONAnnotationToPDF(pInstantJSON As String) Dim oAnnotationData = JsonConvert.DeserializeObject(Of AnnotationData)(pInstantJSON) - For Each annots In oAnnotationData.AnnotationsByReceiver - annots.Reverse() + oAnnotationData.annotations.Reverse() + Dim yPosOfSigAnnot = oAnnotationData.annotations.ElementAt(2).bbox.ElementAt(1) - 71.84002685546875 + 7 + Dim isSeal = True 'First element is signature seal - Dim yPosOfSigAnnot = annots.ElementAt(2).bbox.ElementAt(1) - 71.84002685546875 + 7 - Dim isSeal = True 'First element is signature seal + Dim formFieldIndex = 0 + For Each oAnnotation In oAnnotationData.annotations + Logger.Debug("Adding AnnotationID: " + oAnnotation.id) - Dim formFieldIndex = 0 - For Each oAnnotation In annots - Logger.Debug("Adding AnnotationID: " + oAnnotation.id) + Select Case oAnnotation.type + Case ANNOTATION_TYPE_IMAGE - Select Case oAnnotation.type - Case ANNOTATION_TYPE_IMAGE + If (isSeal) Then + oAnnotation.bbox.Item(1) = yPosOfSigAnnot + End If - If (isSeal) Then - oAnnotation.bbox.Item(1) = yPosOfSigAnnot - End If + AddImageAnnotation(oAnnotation, oAnnotationData.attachments) + Exit Select - AddImageAnnotation(oAnnotation, oAnnotationData.attachments) - Exit Select + Case ANNOTATION_TYPE_INK + AddInkAnnotation(oAnnotation) + Exit Select - Case ANNOTATION_TYPE_INK - AddInkAnnotation(oAnnotation) - Exit Select + Case ANNOTATION_TYPE_WIDGET + 'Add form field values + Dim formFieldValue = oAnnotationData.formFieldValues.FirstOrDefault(Function(fv) fv.name = oAnnotation.id) + If formFieldValue IsNot Nothing AndAlso Not _pdfBurnerParams.IgnoredLabels.Contains(formFieldValue.value) Then + AddFormFieldValue(oAnnotation, formFieldValue, formFieldIndex) + formFieldIndex += 1 + End If + Exit Select + End Select - Case ANNOTATION_TYPE_WIDGET - 'Add form field values - Dim formFieldValue = oAnnotationData.formFieldValues.FirstOrDefault(Function(fv) fv.name = oAnnotation.id) - If formFieldValue IsNot Nothing AndAlso Not _pdfBurnerParams.IgnoredLabels.Contains(formFieldValue.value) Then - AddFormFieldValue(oAnnotation, formFieldValue, formFieldIndex) - formFieldIndex += 1 - End If - Exit Select - End Select - - isSeal = False - Next + isSeal = False Next End Sub @@ -186,6 +183,15 @@ Namespace Jobs.FinalizeDocument End Get End Property + Public ReadOnly Property UnstructuredAnnotations As IEnumerable(Of List(Of Annotation)) + Get + Return annotations _ + .Where(Function(annot) Not annot.hasStructuredID).ToList() _ + .GroupBy(Function(a) a.receiverId) _ + .Select(Function(g) g.ToList()) + End Get + End Property + Public Property attachments As Dictionary(Of String, Attachment) Public Property formFieldValues As List(Of FormFieldValue) End Class @@ -202,7 +208,7 @@ Namespace Jobs.FinalizeDocument Public internalType As String = Nothing - Public hasStructuredID As Boolean = True + Public hasStructuredID As Boolean = False Public Property id As String Get @@ -211,14 +217,13 @@ Namespace Jobs.FinalizeDocument Set(value As String) _id = value - If String.IsNullOrWhiteSpace(id) Then + If String.IsNullOrWhiteSpace(_id) Then Throw New BurnAnnotationException("The identifier of annotation is null or empty.") End If Dim parts As String() = value.Split("#"c) If (parts.Length <> 4) Then - hasStructuredID = False Return 'Throw New BurnAnnotationException($"The identifier of annotation has more or less than 4 sub-part. Id: {_id}") End If @@ -236,6 +241,8 @@ Namespace Jobs.FinalizeDocument End If internalType = parts(3) + + hasStructuredID = True End Set End Property diff --git a/EnvelopeGenerator.Web/wwwroot/js/app.js b/EnvelopeGenerator.Web/wwwroot/js/app.js index 5e3dfc37..1353d66b 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/app.js +++ b/EnvelopeGenerator.Web/wwwroot/js/app.js @@ -275,7 +275,6 @@ class App { }); } - async validateAnnotations(totalSignatures) { const annotations = await getAnnotations(this.pdfKit) const filtered = annotations