Article Details
Id:14896
Product:finPOWER Connect
Type:FIX
Version:3.00.08
Opened:29/08/2017
Closed:15/09/2017
Released:21/09/2017
Job: J019551
High Importance

Documents; When published Standalone (Ad-Hoc) were not respecting the "Print Document even if Emailed?" option when creating a Bulk Document

Many Documents, e.g., "AL, Account Letter" contain a constants to "CreateBulkDocument".

When published Standalone (Ad-Hoc), e.g., via the Report Explorer, Documents that were configured (via the Options page) to NOT "Print Document even if Emailed?" were still being included in the Bulk Document which, typically, was used to Print Documents that were not Emailed.

In addition to this, when published Standalone, Account Documents for Accounts with only a single recipient would generate two PDF documents in the Account's Document Manager folder. One which was linked to the Account Log and another copy of the same Document with a suffix of "1".

The following Documents have been updated:

  • AL: Account Letter - Account_Letter.xml (version 1.01)
  • AAL: Account Application Letter - AccountApp_Letter.xml (version 1.01)
  • CL: Client Letter - Client_Letter.xml (version 1.01)
  • DS: Deposit Statement - Deposit_Statement.xml (version 1.03)
  • AR: Disbursement Payment/Remittance Advice - Disbursement_Remittance.xml (version 1.01)
  • LS: Loan Statement - Loan_Statement.xml (version 1.03)
  • UL: User Letter - User_Letter.xml (version 1.01)

The relevant code changes follow the remark "' Remove entries for Emailed Documents".

The updated Script code for Account Documents is shown below:

'#################################################################
' Publish Standalone (Ad-Hoc)
'#################################################################
Private Function Publish_Standalone(parameters As ISKeyValueList) As Boolean

  Dim Account As finAccount
  Dim AccountLog As finAccountLog
  Dim AccountLogPk As Integer
  Dim AccountLogPks As List(Of Integer)
  Dim di As finDocumentRecipientDetailsItem  
  Dim dis As finDocumentRecipientDetailsItems
  Dim DocumentManagerFileName As String
  Dim DocumentManagerFileNameRelative As String
  Dim dr As IDataReader
  Dim sqb As ISSelectQueryBuilder
  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Validate

  If Success Then
    ' Create Objects
    AccountLogPks = New List(Of Integer)

    ' Create Query (can use DocumentFunctions since we are using Standard Parameters)
    sqb = finBL.DocumentFunctions.GetAccountSqlSelectQueryBuilder(parameters)

    ' Execute Query
    If sqb.ExecuteDataReader(dr) Then
      Do While dr.Read()
        ' Load Account
        Account = finBL.CreateAccount()
        If Not Account.LoadPk(finBL.Database.GetFieldInteger(dr!Pk)) Then
          Success = False
          Exit Do
        End If

        ' Get Document Recipient Details for relevant Account Clients
        If Not mDocument.GetAccountDocumentRecipientDetailsItems(Account, dis, Nothing, parameters) Then
          Success = False
          Exit Do
        End If

        ' Create Document
        ' NOTE: Will also create and return an Account Log if neccessary
        If CreateAccountDocument(dis, Nothing, 0, AccountLog) Then
          ' Record Account Log so it can be updated with the Bulk Document File Name later
          If AccountLog IsNot Nothing Then
            AccountLogPks.Add(AccountLog.Pk)
          End If
          
          ' Remove entries for Emailed Documents so they are not included in the Bulk Document since this would typically be used to Print Document that were not Emailed
          If CreateBulkDocument Then
            For Each di In dis
              If di.EmailDetails.EmailSent Then
                ' Remove Word Document so it is not included in the Bulk Document
                mWordDocuments.Remove(di.WordDocument)
                
                ' Remove Log so it is not updated to refer to the Bulk Document
                If AccountLog IsNot Nothing Then
                  AccountLogPks.Remove(AccountLog.Pk)
                End If
              End If
            Next
          End If
        Else
          Success = False
          Exit Do
        End If
      Loop
      finBL.Database.DataReaderClose(dr)
    Else
      Success = False
    End If

    ' Save Bulk Document
    If Success AndAlso CreateBulkDocument AndAlso mWordDocuments.Count <> 0 Then
      ' Save Document
      If finBL.DocumentManagerFunctions.SaveWordDocumentsToDocumentManagerPdfAccount("", mWordDocuments, mDocument.FileName, DocumentManagerFileName, DocumentManagerFileNameRelative) Then
        mBulkDocumentFileName = DocumentManagerFileName
      Else
        Success = False
      End If

      ' Update Account Logs to refer to Bulk Document (if not creating individual Documents)
      If Success AndAlso Not CreateIndividualDocuments Then
        For Each AccountLogPk In AccountLogPks
          With AccountLog
            If .Load(AccountLogPk) Then
              .DocumentFileName = DocumentManagerFileNameRelative

              If Not .Save() Then
                ' Ignore Errors
              End If
            Else
              ' Ignore Errors
            End If
          End With
        Next
      End If
    End If
  End If

  Return Success

End Function

'#################################################################
' Create Document for relevant Account Clients
'#################################################################
Private Function CreateAccountDocument(dis As finDocumentRecipientDetailsItems,
                                       logPublishBatchItem As finLogPublishBatchItem,
                                       parentLogPk As Integer,
                                       ByRef accountLog As finAccountLog) As Boolean

  Dim di As finDocumentRecipientDetailsItem
  Dim DocumentManagerFileName As String
  Dim DocumentManagerFileNameRelative As String
  Dim DocumentBinaryData As Byte()
  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Initialise
  mWordDocumentsAccount.Clear()

  ' Create Document for all relevant Account Clients
  For Each di In dis
    ' Create Document
    If Not CreateDocument(di) Then
      Success = False
      Exit For
    End If
  Next

  ' Standalone Publish functionality
  If Success Then
    If logPublishBatchItem Is Nothing Then
      ' Embed in Log?
      If mDocument.EmbedDocumentInLog Then
        Success = finBL.PdfUtilities.CombineWordDocumentsToPdfByteArray(mWordDocumentsAccount, DocumentBinaryData)
      End If

      ' Save Individual Document for this Account?
      If Success AndAlso CreateIndividualDocuments Then
        Success =  finBL.DocumentManagerFunctions.SaveWordDocumentsToDocumentManagerPdfAccount(dis(0).AccountId, mWordDocumentsAccount, mDocument.FileName, DocumentManagerFileName, DocumentManagerFileNameRelative)
      End If

      ' Create Log
      If Success AndAlso mDocument.CreateLog Then
        If finBL.AccountFunctions.LogAddDocument(dis(0).Account.Pk, mDocument.DocumentId, accountLog, mDocument.DocumentLogSubjectResolved, "", DocumentManagerFileNameRelative, "", isefinLogEmbeddedFileType.Pdf, DocumentBinaryData) Then
          ' Ensure any Email Logs are linked to this new Log
          parentLogPk = AccountLog.Pk
        Else
          Success = False
        End If
      End If
    End If
  End If

  ' Save Combined Document to Document Manager?
  ' NOTE: This is for ALL Account Clients, regardless of whether individual documents will be saved for each Account Client
  If Success AndAlso mDocument.AutoSaveDocument Then
    If logPublishBatchItem IsNot Nothing OrElse mWordDocumentsAccount.Count > 1 Then
      Success = finBL.DocumentManagerFunctions.SaveWordDocumentsToDocumentManagerPdfAccount(di.AccountId, mWordDocumentsAccount, mDocument.FileName, DocumentManagerFileName, DocumentManagerFileNameRelative)
    End If
  End If

  ' Embed Combined Document in Log?
  ' NOTE: This is for ALL Account Clients, regardless of whether individual documents will be saved for each Account Client
  If Success AndAlso mDocument.EmbedDocumentInLog Then
    Success = finBL.PdfUtilities.CombineWordDocumentsToPdfByteArray(mWordDocumentsAccount, DocumentBinaryData)
  End If

  ' Email Account Clients?
  ' NOTE: This will create additional Account Logs (for each Account Client) where neccessary
  If Success AndAlso dis(0).EmailDetails.PublishEmail Then
    Success = dis.SendAccountEmailsPdf(parentLogPk)
  End If

  ' Update Log Publish details
  If logPublishBatchItem IsNot Nothing Then
    With logPublishBatchItem
      If Success Then
        ' Success
        .PublishSuccess = True
        .PublishDocumentFileName = DocumentManagerFileNameRelative
        .PublishDocumentBinaryDataFileType = isefinLogEmbeddedFileType.Pdf
        .PublishDocumentBinaryData = DocumentBinaryData
        .PrintStatus = dis(0).PrintStatus
      Else
        ' Failure
        .PublishSuccess = False
        .PublishError = finBL.Error.Message(True, True)
      End If
    End With
  End If

  Return Success

End Function

The updated Script code for Account Application Documents is shown below:

'#################################################################
' Publish Standalone (Ad-Hoc)
'#################################################################
Private Function Publish_Standalone(parameters As ISKeyValueList) As Boolean

  Dim AccountApp As finAccountApp
  Dim AccountAppLog As finAccountAppLog
  Dim AccountAppLogPk As Integer
  Dim AccountAppLogPks As List(Of Integer)
  Dim di As finDocumentRecipientDetailsItem
  Dim dis As finDocumentRecipientDetailsItems
  Dim DocumentManagerFileName As String
  Dim DocumentManagerFileNameRelative As String
  Dim dr As IDataReader
  Dim sqb As ISSelectQueryBuilder
  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Validate

  If Success Then
    ' Create Objects
    AccountAppLogPks = New List(Of Integer)

    ' Create Query (can use DocumentFunctions since we are using Standard Parameters)
    sqb = finBL.DocumentFunctions.GetAccountAppSqlSelectQueryBuilder(parameters)

    ' Execute Query
    If sqb.ExecuteDataReader(dr) Then
      Do While dr.Read()
        ' Load Account Application
        AccountApp = finBL.CreateAccountApp()
        If Not AccountApp.LoadPk(finBL.Database.GetFieldInteger(dr!Pk)) Then
          Success = False
          Exit Do
        End If

        ' Get Document Recipient Details for relevant Applicants
        If Not mDocument.GetAccountAppDocumentRecipientDetailsItems(AccountApp, dis, Nothing, parameters) Then
          Success = False
          Exit Do
        End If

        ' Create Document
        ' NOTE: Will also create and return an Account Application Log if neccessary
        If CreateAccountAppDocument(dis, Nothing, 0, AccountAppLog) Then
          ' Record Account Application Log so it can be updated with the Bulk Document File Name later
          If AccountAppLog IsNot Nothing Then
            AccountAppLogPks.Add(AccountAppLog.Pk)
          End If
          
          ' Remove entries for Emailed Documents so they are not included in the Bulk Document since this would typically be used to Print Document that were not Emailed
          If CreateBulkDocument Then
            For Each di In dis
              If di.EmailDetails.EmailSent Then
                ' Remove Word Document so it is not included in the Bulk Document
                mWordDocuments.Remove(di.WordDocument)

                ' Remove Log so it is not updated to refer to the Bulk Document
                If AccountAppLog IsNot Nothing Then
                  AccountAppLogPks.Remove(AccountAppLog.Pk)
                End If
              End If
            Next
          End If
        Else
          Success = False
          Exit Do
        End If
      Loop
      finBL.Database.DataReaderClose(dr)
    Else
      Success = False
    End If

    ' Save Bulk Document
    If Success AndAlso CreateBulkDocument AndAlso mWordDocuments.Count <> 0 Then
      ' Save Document
      If mWordDocuments.Count = 0 Then
        ' No Documents created, e.g., no Used Applicants
      Else
        If finBL.DocumentManagerFunctions.SaveWordDocumentsToDocumentManagerPdfAccountApp("", mWordDocuments, mDocument.FileName, DocumentManagerFileName, DocumentManagerFileNameRelative) Then
          mBulkDocumentFileName = DocumentManagerFileName
        Else
          Success = False
        End If
      End If

      ' Update Account Application Logs to refer to Bulk Document (if not creating individual Documents)
      If Success AndAlso Not CreateIndividualDocuments Then
        For Each AccountAppLogPk In AccountAppLogPks
          With AccountAppLog
            If .Load(AccountAppLogPk) Then
              .DocumentFileName = DocumentManagerFileNameRelative

              If Not .Save() Then
                ' Ignore Errors
              End If
            Else
              ' Ignore Errors
            End If
          End With
        Next
      End If
    End If
  End If

  Return Success

End Function

'#################################################################
' Create Document for relevant Account Application Applicants
'#################################################################
Private Function CreateAccountAppDocument(dis As finDocumentRecipientDetailsItems,
                                          logPublishBatchItem As finLogPublishBatchItem,
                                          parentLogPk As Integer,
                                          ByRef accountAppLog As finAccountAppLog) As Boolean

  Dim di As finDocumentRecipientDetailsItem
  Dim DocumentManagerFileName As String
  Dim DocumentManagerFileNameRelative As String
  Dim DocumentBinaryData As Byte()
  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Initialise
  mWordDocumentsAccountApp.Clear()

  If dis.Count = 0 Then
    ' No Included Applicants
    ' NOTE: This is perfectly legitimate for Account Applications
  Else
    ' Create Document for all relevant Applicants
    For Each di In dis
      ' Create Document
      If Not CreateDocument(di) Then
        Success = False
        Exit For
      End If
    Next

    ' Standalone Publish functionality
    If Success Then
      If logPublishBatchItem Is Nothing Then
        ' Embed in Log?
        If mDocument.EmbedDocumentInLog Then
          Success = finBL.PdfUtilities.CombineWordDocumentsToPdfByteArray(mWordDocumentsAccountApp, DocumentBinaryData)
        End If

        ' Save Individual Document for this Account Application?
        If Success AndAlso CreateIndividualDocuments Then
          Success =  finBL.DocumentManagerFunctions.SaveWordDocumentsToDocumentManagerPdfAccountApp(dis(0).AccountAppId, mWordDocumentsAccountApp, mDocument.FileName, DocumentManagerFileName, DocumentManagerFileNameRelative)
        End If

        ' Create Log
        If Success AndAlso mDocument.CreateLog Then
          If finBL.AccountAppFunctions.LogAddDocument(dis(0).AccountApp.Pk, dis(0).AccountAppApplicant.Pk, mDocument.DocumentId, accountAppLog, mDocument.DocumentLogSubjectResolved, "", DocumentManagerFileNameRelative, "", isefinLogEmbeddedFileType.Pdf, DocumentBinaryData) Then
            ' Ensure any Email Logs are linked to this new Log
            parentLogPk = accountAppLog.Pk
          Else
            Success = False
          End If
        End If
      End If
    End If

    ' Save Combined Document to Document Manager?
    ' NOTE: This is for ALL Account Application Applicants, regardless of whether individual documents will be saved for each Applicant
    If Success AndAlso mDocument.AutoSaveDocument Then
      If logPublishBatchItem IsNot Nothing OrElse mWordDocumentsAccountApp.Count > 1 Then
        Success = finBL.DocumentManagerFunctions.SaveWordDocumentsToDocumentManagerPdfAccountApp(di.AccountAppId, mWordDocumentsAccountApp, mDocument.FileName, DocumentManagerFileName, DocumentManagerFileNameRelative)
      End If
    End If

    ' Embed Combined Document in Log?
    ' NOTE: This is for ALL Account Application Applicants, regardless of whether individual documents will be saved for each Applicant
    If Success AndAlso mDocument.EmbedDocumentInLog Then
      Success = finBL.PdfUtilities.CombineWordDocumentsToPdfByteArray(mWordDocumentsAccountApp, DocumentBinaryData)
    End If

    ' Email Applicants?
    ' NOTE: This will create additional Account Application Logs (for each Applicant) where neccessary
    If Success AndAlso dis(0).EmailDetails.PublishEmail Then
      Success = dis.SendAccountAppEmailsPdf(parentLogPk)
    End If
  End If

  ' Update Log Publish details
  If logPublishBatchItem IsNot Nothing Then
    With logPublishBatchItem
      If Success Then
        ' Success
        .PublishSuccess = True
        .PublishDocumentFileName = DocumentManagerFileNameRelative
        .PublishDocumentBinaryDataFileType = isefinLogEmbeddedFileType.Pdf
        .PublishDocumentBinaryData = DocumentBinaryData
        If dis.Count <> 0 Then .PrintStatus = dis(0).PrintStatus
      Else
        ' Failure
        .PublishSuccess = False
        .PublishError = finBL.Error.Message(True, True)
      End If
    End With
  End If

  Return Success

End Function

The updated Script code for Client Documents is shown below:

'#################################################################
' Publish Standalone (Ad-Hoc)
'#################################################################
Private Function Publish_Standalone(parameters As ISKeyValueList) As Boolean

  Dim Client As finClient
  Dim ClientLog As finClientLog
  Dim ClientLogPk As Integer
  Dim ClientLogPks As List(Of Integer)
  Dim di As finDocumentRecipientDetailsItem
  Dim DocumentBinaryData As Byte()
  Dim DocumentManagerFileName As String
  Dim DocumentManagerFileNameRelative As String
  Dim dr As IDataReader
  Dim sqb As ISSelectQueryBuilder
  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Validate

  If Success Then
    ' Create Objects
    Client = finBL.CreateClient()
    ClientLogPks = New List(Of Integer)

    ' Create Query (can use DocumentFunctions since we are using Standard Parameters)
    sqb = finBL.DocumentFunctions.GetClientSqlSelectQueryBuilder(parameters)

    ' Execute Query
    If sqb.ExecuteDataReader(dr) Then
      Do While dr.Read()
        ' Load Client
        If Not Client.LoadPk(finBL.Database.GetFieldInteger(dr!Pk)) Then
          Success = False
          Exit Do
        End If

        ' Get Document Recipient Details for Client
        If Not mDocument.GetClientDocumentRecipientDetailsItem(Client, di, Nothing, parameters) Then
          Success = False
          Exit Do
        End If

        ' Create Document
        If Not CreateDocument(di) Then
          Success = False
          Exit Do
        End If

        ' Save Individual Document for this Client
        If CreateIndividualDocuments Then
          If Not finBL.DocumentManagerFunctions.SaveWordDocumentToDocumentManagerPdfClient(di.ClientId, di.WordDocument, mDocument.FileName, DocumentManagerFileName, DocumentManagerFileNameRelative) Then
            Success = False
            Exit Do
          End If
        End If

        ' Create Client Log?
        If mDocument.CreateLog Then
          ' Embed in Log?
          If mDocument.EmbedDocumentInLog Then
            If Not di.WordDocument.SavePdfToByteArray(DocumentBinaryData) Then
              Success = False
              Exit Do
            End If
          End If

          ' Add Client Log
          If finBL.ClientFunctions.LogAddDocument(Client.Pk, mDocument.DocumentId, ClientLog, mDocument.DocumentLogSubjectResolved, "", DocumentManagerFileNameRelative, "", isefinLogEmbeddedFileType.Pdf, DocumentBinaryData, Not di.EmailDetails.EmailSent) Then
            ' Record Client Log so it can be updated with the Bulk Document File Name later
            If CreateBulkDocument Then
              ClientLogPks.Add(ClientLog.Pk)
            End If

            ' Remove entries for Emailed Documents so they are not included in the Bulk Document since this would typically be used to Print Document that were not Emailed
            If CreateBulkDocument Then
                If di.EmailDetails.EmailSent Then
                  ' Remove Word Document so it is not included in the Bulk Document
                  mWordDocuments.Remove(di.WordDocument)

                  ' Remove Log so it is not updated to refer to the Bulk Document
                  If ClientLog IsNot Nothing Then
                    ClientLogPks.Remove(ClientLog.Pk)
                  End If
                End If
            End If
            
            ' Record Email details
            If di.EmailDetails.EmailSent Then
              If Not di.EmailDetails.ClientLogUpdateForEmailSend(ClientLog.Pk) Then
                ' Ignore Errors
              End If
            End If
          Else
            Success = False
            Exit Do
          End If
        End If
      Loop
      finBL.Database.DataReaderClose(dr)
    Else
      Success = False
    End If

    ' Save Bulk Document
    If Success AndAlso CreateBulkDocument AndAlso mWordDocuments.Count <> 0 Then
      ' Save Document
      If finBL.DocumentManagerFunctions.SaveWordDocumentsToDocumentManagerPdfClient("", mWordDocuments, mDocument.FileName, DocumentManagerFileName, DocumentManagerFileNameRelative) Then
        mBulkDocumentFileName = DocumentManagerFileName
      Else
        Success = False
      End If

      ' Update Client Logs to refer to Bulk Document (if not creating individual Documents)
      If Success AndAlso Not CreateIndividualDocuments Then
        For Each ClientLogPk In ClientLogPks
          With ClientLog
            If .Load(ClientLogPk) Then
              .DocumentFileName = DocumentManagerFileNameRelative

              If Not .Save() Then
                ' Ignore Errors
              End If
            Else
              ' Ignore Errors
            End If
          End With
        Next
      End If
    End If
  End If

  Return Success

End Function

The updated Script code for User Documents is shown below:

'#################################################################
' Publish Standalone (Ad-Hoc)
'#################################################################
Private Function Publish_Standalone(parameters As ISKeyValueList) As Boolean

  Dim User As finUser
  Dim UserLog As finUserLog
  Dim UserLogPk As Integer
  Dim UserLogPks As List(Of Integer)
  Dim di As finDocumentRecipientDetailsItem
  Dim DocumentBinaryData As Byte()
  Dim DocumentManagerFileName As String
  Dim DocumentManagerFileNameRelative As String
  Dim dr As IDataReader
  Dim sqb As ISSelectQueryBuilder
  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Validate

  If Success Then
    ' Create Objects
    User = finBL.CreateUser()
    UserLogPks = New List(Of Integer)

    ' Create Query (can use DocumentFunctions since we are using Standard Parameters)
    sqb = finBL.DocumentFunctions.GetUserSqlSelectQueryBuilder(parameters)

    ' Execute Query
    If sqb.ExecuteDataReader(dr) Then
      Do While dr.Read()
        ' Load User
        If Not User.LoadPk(finBL.Database.GetFieldInteger(dr!Pk)) Then
          Success = False
          Exit Do
        End If

        ' Get Document Recipient Details for User
        If Not mDocument.GetUserDocumentRecipientDetailsItem(User, di, Nothing, parameters) Then
          Success = False
          Exit Do
        End If

        ' Create Document
        If Not CreateDocument(di) Then
          Success = False
          Exit Do
        End If

        ' Save Individual Document for this User
        If CreateIndividualDocuments Then
          If Not finBL.DocumentManagerFunctions.SaveWordDocumentToDocumentManagerPdfUser(di.UserId, di.WordDocument, mDocument.FileName, DocumentManagerFileName, DocumentManagerFileNameRelative) Then
            Success = False
            Exit Do
          End If
        End If

        ' Create User Log?
        If mDocument.CreateLog Then
          ' Embed in Log?
          If mDocument.EmbedDocumentInLog Then
            If Not di.WordDocument.SavePdfToByteArray(DocumentBinaryData) Then
              Success = False
              Exit Do
            End If
          End If

          ' Add User Log
          If finBL.UserFunctions.LogAddDocument(User.Pk, mDocument.DocumentId, UserLog, mDocument.DocumentLogSubjectResolved, "", DocumentManagerFileNameRelative, "", isefinLogEmbeddedFileType.Pdf, DocumentBinaryData, Not di.EmailDetails.EmailSent) Then
            ' Record User Log so it can be updated with the Bulk Document File Name later
            If CreateBulkDocument Then
              UserLogPks.Add(UserLog.Pk)
            End If

            ' Remove entries for Emailed Documents so they are not included in the Bulk Document since this would typically be used to Print Document that were not Emailed
            If CreateBulkDocument Then
                If di.EmailDetails.EmailSent Then
                  ' Remove Word Document so it is not included in the Bulk Document
                  mWordDocuments.Remove(di.WordDocument)

                  ' Remove Log so it is not updated to refer to the Bulk Document
                  If UserLog IsNot Nothing Then
                    UserLogPks.Remove(UserLog.Pk)
                  End If
                End If
            End If

            ' Record Email details
            If di.EmailDetails.EmailSent Then
              If Not di.EmailDetails.UserLogUpdateForEmailSend(UserLog.Pk) Then
                ' Ignore Errors
              End If
            End If
          Else
            Success = False
            Exit Do
          End If
        End If
      Loop
      finBL.Database.DataReaderClose(dr)
    Else
      Success = False
    End If

    ' Save Bulk Document
    If Success AndAlso CreateBulkDocument AndAlso mWordDocuments.Count <> 0 Then
      ' Save Document
      If finBL.DocumentManagerFunctions.SaveWordDocumentsToDocumentManagerPdfUser("", mWordDocuments, mDocument.FileName, DocumentManagerFileName, DocumentManagerFileNameRelative) Then
        mBulkDocumentFileName = DocumentManagerFileName
      Else
        Success = False
      End If

      ' Update User Logs to refer to Bulk Document (if not creating individual Documents)
      If Success AndAlso Not CreateIndividualDocuments Then
        For Each UserLogPk In UserLogPks
          With UserLog
            If .Load(UserLogPk) Then
              .DocumentFileName = DocumentManagerFileNameRelative

              If Not .Save() Then
                ' Ignore Errors
              End If
            Else
              ' Ignore Errors
            End If
          End With
        Next
      End If
    End If
  End If

  Return Success

End Function