Bug 95292 - Mail merge does not print the last record when having odd records
Summary: Mail merge does not print the last record when having odd records
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.0.1.2 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.3.0
Keywords: bibisectRequest
Depends on:
Blocks:
 
Reported: 2015-10-24 10:04 UTC by p_kongstad
Modified: 2016-11-30 08:53 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Database with 5 records (8.42 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-10-24 10:04 UTC, p_kongstad
Details
Step 8 with screen shot (107.96 KB, image/png)
2016-02-13 17:51 UTC, p_kongstad
Details

Note You need to log in before you can comment on or make changes to this bug.
Description p_kongstad 2015-10-24 10:04:12 UTC
Created attachment 119919 [details]
Database with 5 records

When you print from a database having odd number of records and that you have 2 records on one sheet the last record is not printed.

So if you have 5 record numbered from 1 - 5 only 1 - 4 (2 sheets) are printed and record 5 is rejected.

Behaviour:

Printing to an document is only printing fully filled sheets. Sheet 3 containing record 5 is not printed.

Expected behaviour:

Printing all sheets leaving the last sheets with only one record.

How to verify bug:

1. Create a spreadsheet with headers called number and text.
2. Create 5 records numbered from 1 - 5 and some text
3. Save spreadsheet as test.ods
4. Register spreadsheet as a database test.
5. Create a new document using New/Labels and Options with 'Synchronize contents' marked
6. Use Brand: Avery A4 | Type: C2351 Avery A5 Greeting Card.
7. Insert from database field 'Text'
8. Using CTRL+F2 (More Fields) to insert 'Next record' after 'Text'
9. Press F4 to generate mail merging and chose the 5 record.
10. Save to a file and check that only the consecutive records 1 - 4 is to be found in the record.

Attached test data in a database
Comment 1 p_kongstad 2015-10-24 10:54:13 UTC
Added regression as it has worked previously.
Comment 2 Buovjaga 2015-10-28 18:47:13 UTC
Reproduced.

Clarification for step 8: tab Database - first insert Mail merge fields - (your db), Sheet1, Text. Then Next record - Sheet1.

Win 7 Pro 64-bit, Version: 5.0.2.2 (x64)
Build ID: 37b43f919e4de5eeaca9b9755ed688758a8251fe
Locale: fi-FI (fi_FI)
Comment 3 p_kongstad 2015-12-02 23:11:31 UTC
Still present in Version: 5.0.4.1
Build ID: 2def61bcbb29a7a8611b833682fe1291910b11ad
Locale: en-US (en_US.UTF-8)
Comment 4 p_kongstad 2015-12-07 17:20:51 UTC
Bug still present in Version: 5.1.0.0.beta2
Build ID: 53054959a12edc6510f51b94ddc9b73d27aedaf6
Threads 2; Ver: 4.2; Render: default; 

Locale: en-US (en_US.UTF-8)
Comment 5 Robinson Tryon (qubit) 2015-12-14 05:32:41 UTC Comment hidden (obsolete)
Comment 6 Joel Madero 2015-12-14 17:56:50 UTC
> 4. Register spreadsheet as a database test.

How do I do this step? When I go to tools -> base -> databases it doesn't list any ods files, only odf database. If someone explains this I'll bibisect the bug.
Comment 7 Buovjaga 2015-12-14 20:27:10 UTC
(In reply to Joel Madero from comment #6)
> > 4. Register spreadsheet as a database test.
> 
> How do I do this step? When I go to tools -> base -> databases it doesn't
> list any ods files, only odf database. If someone explains this I'll
> bibisect the bug.

Yep step 4 is a bit hazy.

You have to go all the way to:

New database (wizard) - Connect to an existing db - Spreadsheet.

Then just browse for your .ods and finish. It will be ok.

Note my comment 2 for clarity in step 8.
Comment 8 Joel Madero 2015-12-19 16:52:54 UTC
(In reply to Beluga from comment #2)
> Reproduced.
> 
> Clarification for step 8: tab Database - first insert Mail merge fields -
> (your db), Sheet1, Text. Then Next record - Sheet1.
> 

This is still really confusing for me. 
a) "tab Database" - where? On the label dialog?

b) Most confusing part "Then Next record - Sheet1" - I don't see anything about Next record on the dialog...

Sorry for being a PITA but I can't bibisect if I can't follow the instructions :-/
Comment 9 p_kongstad 2015-12-19 17:10:29 UTC
When you press CTRL+F2 being in Writer you have a different tabs.

Go to database tab and then insert field "Next record"
Comment 10 Joel Madero 2015-12-19 17:19:29 UTC
What version of LibreOffice worked as expected? 4.4? Before that? If you tell me I can tell you the package to download (it's several gigs) to try to bibisect it. Thanks for the offer.
Comment 11 p_kongstad 2015-12-19 17:28:29 UTC
It worked in 4.4.

How to bibisect 4.4 - 5.1?
Comment 12 Joel Madero 2015-12-19 18:34:43 UTC
https://wiki.documentfoundation.org/QA/Bibisect/Linux#Versions

You'll want to download the 45max package probably.

If you can't follow the instructions on that page just let me know and I'll try to walk you through it. You can email my privately.
Comment 13 Buovjaga 2015-12-19 18:46:37 UTC
Maybe it would help, if he attached screenshots of the Step 8 process.
Comment 14 p_kongstad 2016-01-15 10:25:45 UTC
Bug still present in Version: 5.1.0.2
Build ID: ecd3574d51754b043f865cf5bafee286d24db7cc
CPU Threads: 2; OS Version: Linux 4.2; UI Render: default; 
Locale: en-US (en_US.UTF-8)
Comment 15 p_kongstad 2016-01-21 14:33:15 UTC
Bug still present in Version: 5.0.5.1
Build ID: 7609023f63524a6c8326f6c82e7e23f55a5b7bb5
Locale: en-US (en_US.UTF-8)
Comment 16 p_kongstad 2016-02-13 10:37:47 UTC
Bug still present in Version: 5.1.1.1
Build ID: c43cb650e9c145b181321ea547d38296db70f36e
CPU Threads: 2; OS Version: Linux 4.2; UI Render: default; 
Locale: en-US (en_US.UTF-8)
Comment 17 Buovjaga 2016-02-13 14:55:36 UTC
(In reply to p_kongstad from comment #16)
> Bug still present in Version: 5.1.1.1
> Build ID: c43cb650e9c145b181321ea547d38296db70f36e
> CPU Threads: 2; OS Version: Linux 4.2; UI Render: default; 
> Locale: en-US (en_US.UTF-8)

Any chance for a screenshots of step 8?
Comment 18 p_kongstad 2016-02-13 17:51:30 UTC
Created attachment 122627 [details]
Step 8 with screen shot

Added screen shot of step 8.
Comment 19 p_kongstad 2016-03-17 21:38:14 UTC
Bug still present Version: 5.1.2.1
Build ID: 2603b69c5ec5981bb5f053f8ebfd1f3de00a4c29
CPU Threads: 2; OS Version: Linux 4.2; UI Render: default; 
Locale: en-US (en_US.UTF-8)
Comment 21 p_kongstad 2016-03-31 10:29:29 UTC
Bug still present in Version: 5.1.2.2
Build ID: d3bf12ecb743fc0d20e0be0c58ca359301eb705f
CPU Threads: 2; OS Version: Linux 4.2; UI Render: default; 
Locale: en-US (en_US.UTF-8)
Comment 22 Robinson Tryon (qubit) 2016-05-12 05:35:51 UTC
TESTING with
LO 5.2.0.0.alpha1+
OS Version: Mac OS X 10.10.5
Build: 2016-05-11_01:01:27

(In reply to p_kongstad from comment #0)
> How to verify bug:
> 
> 1. Create a spreadsheet with headers called number and text.
> 2. Create 5 records numbered from 1 - 5 and some text

(using attachment 119919 [details])

> 3. Save spreadsheet as test.ods
> 4. Register spreadsheet as a database test.

So, shove the spreadsheet into a database file ('testbase.odb').

> 5. Create a new document using New/Labels and Options with 'Synchronize
> contents' marked
> 6. Use Brand: Avery A4 | Type: C2351 Avery A5 Greeting Card.
> 7. Insert from database field 'Text'
> 8. Using CTRL+F2 (More Fields) to insert 'Next record' after 'Text'

Testing on OSX, so I'm using: Insert -> Field -> More Fields

(In reply to p_kongstad from comment #9)
> When you press CTRL+F2 being in Writer you have a different tabs.
> 
> Go to database tab and then insert field "Next record"

Note: The dialog will not close, but you will see additional field-colored space appear after the <Text> in the document.

> 9. Press F4 to generate mail merging and chose the 5 record.

Tools -> MM Wizard -> Next -> Next -> Next -> Finish

> 10. Save to a file

(Save Merged Documents) -> Save as single large doc -> click (Save Documents)

>  and check that only the consecutive records 1 - 4 is to
> be found in the record.

I only found three (one, three, four). They were arranged with [one three] on the first page, and then [four] on the 2nd page. I'll attach the output as a PDF.

I can't precisely reproduce the stated behavior, but I definitely did not get the expected output from the mail merge. So (roughly speaking) there's still a bug here.
Comment 23 p_kongstad 2016-05-31 20:40:49 UTC
Bug is still present in Version: 5.1.3.2
Build ID: 644e4637d1d8544fd9f56425bd6cec110e49301b
CPU Threads: 2; OS Version: Linux 4.4; UI Render: default; 
Locale: en-US (en_US.UTF-8)
Comment 24 p_kongstad 2016-06-02 20:24:10 UTC
Bug still present in Version: 5.1.4.1
Build ID: a4d48e4ff0e9f93e78b6356ca7b0b6303e360356
CPU Threads: 2; OS Version: Linux 4.4; UI Render: default; 
Locale: en-US (en_US.UTF-8)
Comment 25 p_kongstad 2016-06-23 06:57:40 UTC
Bug has been resolved in version Version: 5.2.0.1
Build ID: fcbcb4963bda8633ba72bd2108ca1e802aad557d
CPU Threads: 2; OS Version: Linux 4.4; UI Render: default; 
Locale: en-US (en_US.UTF-8)

Will this fix be introduced to version 5.1.x?
Comment 26 Buovjaga 2016-06-23 08:02:16 UTC
Closing and adding backport request.
Comment 27 Commit Notification 2016-08-17 10:25:05 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9dbaf6b3b6112d9e16fd64ab0ed5dff6e513e5f8

tdf#95292 MM: add unit test

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.