Bug 106022 - MailMerge: when running e-mail using a macro the MailMergeEventListener is monitoring wrong events
Summary: MailMerge: when running e-mail using a macro the MailMergeEventListener is mo...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.4.0.0.alpha0+
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Mail-Merge
  Show dependency treegraph
 
Reported: 2017-02-15 13:26 UTC by Alex Kempshall
Modified: 2018-01-23 04:41 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
The database used to repicate #tdf106022 (11.71 KB, application/vnd.oasis.opendocument.database)
2017-02-15 13:31 UTC, Alex Kempshall
Details
The seed doument used to replicate #tdf106022 (12.19 KB, application/vnd.oasis.opendocument.text)
2017-02-15 13:33 UTC, Alex Kempshall
Details
Bisect log (2.64 KB, text/x-log)
2017-08-30 10:49 UTC, Alex Kempshall
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Kempshall 2017-02-15 13:26:55 UTC
I have a macro which displays a progress bar in the status area based on the MailMergeEventListener. The progress bar should show progress of the sending of my messages - which it does. On completion a "Done" message box should appear which it does.

However, the "Done" message box appears some time after the progress bar has indicated that all the messages have been sent. I have no evidence, but what the progress bar appears to be doing is tracking the mail merge when it should be, I believe, tracking the sending of the merged documents via email.

Steps to reproduce the problem.

1.
Download the files CompanySeedStarted1.odt and CompanySeedTestData1.odb from this bug report. The database CompanySeedTestData1.odb contains 63 entries all with dummy email addresses.

2.
Start LibreOffice writer with the document CompanySeedStarted1.odt downloaded in step 1. Note: this file contains a macro so be mindful that some security steps might need to be taken.

3.
Tools -> Mail Merge Wizard

4.
The "Select starting document" dialog box should appear. The left pane should contain 5 steps. In the right pane select the "Use Current Document" Radio Button. Then press the "Next >>" Button.

5.
The "Select document type" dialog box should appear. Select the "E-mail message" Radio Button. Then press the "Next" Button.

6.
The "Insert address block" dialog box should appear. Press the "Select Different Address List" Button.

7.
The "Select Address List" dialog box should appear. Press the "Add" Button.

8.
The "Open - LibreOffice" dialog should appear. Navigate to directory containing CompanySeedTestData1.odb downloaded in step 1. Once the database has been selected press the "Open" Button.

9.
The "Select Address List" dialog box should re-appear with the database CompanySeedTestData1 and the table tblCompanySeedTestData1 added to the list of available databases. If not already selected - select this database. Press the "OK" Button.

10.
Control should be returned to the "Mail Merge Wizard" dialog. Press the "Finish" Button.

11.
If not already done so. Establish the Mail Merge E-mail settings by navigating from the menu Tools -> Options -> LibreOffice Writer -> Mail Merge E-Mail

11.1
The  "Options LibreOffice Writer Mail Merge E-Mail" dialog should appear. Enter the senders name you want to be called by, the senders email address, the server name, the port number. If not already checked left click the "Use secure connection (SSL) check box. Push the "Server Authentification" Button.

11.2
The "Server Authentification" dialog should appear. Enter the senders email address and the senders password for the smtp server. Push the "OK" button.

11.3
Control will be passed back to the "Options LibreOffice Writer Mail Merge E-Mail" dialog. Push the OK Button. Control will return to the open document.

12.
Run the MailMerge macro by navigating from the menu Tools -> Macros - Run Macro.

13.
The "Macro Selector" dialog should appear.

14.
In the left hand "Library" pane navigate to the macro CompanyStarted1.odt -> Standard -> CompanyStarted1

15.
In the right hand "Macro Name" pane select the macro "Email_Test_0001". Press the "Run" button".

16.
Control should be passed back to the document. Progress will be indicated by the progress bar in the status area. Should process 63 of 63 messages. A "Done" message box should appear. 


Alex
Comment 1 Alex Kempshall 2017-02-15 13:31:21 UTC
Created attachment 131247 [details]
The database used to repicate #tdf106022
Comment 2 Alex Kempshall 2017-02-15 13:33:06 UTC
Created attachment 131248 [details]
The seed doument used to replicate #tdf106022
Comment 3 Alex Kempshall 2017-08-30 10:49:43 UTC
Created attachment 135867 [details]
Bisect log

I've attached the bisect log for this bug.

As the messages are now sent by a dispatcher this code in dbmgr.cxx is in the wrong place

            // also emit MailMergeEvent on XInterface if possible
            const SwXMailMerge *pEvtSrc = GetMailMergeEvtSrc();
            if(pEvtSrc)
            {
                uno::Reference< uno::XInterface > xRef(
                    static_cast<text::XMailMergeBroadcaster*>(const_cast<SwXMailMerge*>(pEvtSrc)) );
                text::MailMergeEvent aEvt( xRef, xWorkDocSh->GetModel() );
                pEvtSrc->LaunchMailMergeEvent( aEvt );
            } 


It is monitoring messages being sent to the dispatcher whereas it should be monitoring messages being sent out by the dispatcher.
Comment 4 Alex Kempshall 2018-01-22 15:05:00 UTC
Tested this again with LO-5.4.4.2

The problem appears to have been solved.
Comment 5 Aron Budea 2018-01-23 04:41:12 UTC
Thanks for the update! Let's change status to WORKSFORME, as the fixing commit is unknown.