Bug 81750 - MAILMERGE: Input fields are duplicated and lost the first two characters
Summary: MAILMERGE: Input fields are duplicated and lost the first two characters
Status: CLOSED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.2.5.2 release
Hardware: Other All
: high normal
Assignee: Not Assigned
URL:
Whiteboard: target:4.4.0 target:6.3.0
Keywords: regression
Depends on:
Blocks:
 
Reported: 2014-07-25 16:09 UTC by pierre-yves samyn
Modified: 2019-01-09 21:31 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Form letter DocumentType.odt (9.47 KB, application/vnd.oasis.opendocument.text)
2014-07-25 16:09 UTC, pierre-yves samyn
Details
Res.odt (Result of the mailing) (11.42 KB, application/vnd.oasis.opendocument.text)
2014-07-25 16:11 UTC, pierre-yves samyn
Details
Good Result of Mail merge (8.82 KB, application/vnd.oasis.opendocument.text)
2014-07-30 03:07 UTC, Joel Madero
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pierre-yves samyn 2014-07-25 16:09:58 UTC
Created attachment 103456 [details]
Form letter DocumentType.odt

Hi

Description:
A form letter (see DocumentType.odt) includes input fields. When mailing the input fields are duplicated and lost the first two characters (see Res.odt)

Steps to reproduce:
1. Open the DocumentType.odt attached. Its datasource is the default Bibliography and includes an input field
2. Launch the mailing or by the File>Print menu or by Tools> Mail Merge Wizard

The input field is duplicated and lost the first two characters.

Platform:
Windows 7 64 bits &  4.2.5.2

Also reproduced (fr-users) with Version: 4.3.0.3
Build ID: 08ebe52789a201dd7d38ef653ef7a48925e7f9f7

So I set status to New.

Regards
Pierre-Yves
Comment 1 pierre-yves samyn 2014-07-25 16:11:11 UTC
Created attachment 103457 [details]
Res.odt (Result of the mailing)
Comment 2 Joel Madero 2014-07-30 03:07:34 UTC
Can't reproduce:
Ubuntu 14.04 x64
LibreOffice 4.3.0.3 rc & 4.2.6.2 rc

Attached is my document - looks fine. Can you try with a fresh profile?
Comment 3 Joel Madero 2014-07-30 03:07:51 UTC
Created attachment 103663 [details]
Good Result of Mail merge
Comment 4 pierre-yves samyn 2014-08-01 14:39:24 UTC
Hi Joel

(In reply to comment #2)
> Can't reproduce:
> Ubuntu 14.04 x64
> LibreOffice 4.3.0.3 rc & 4.2.6.2 rc
> 
> Attached is my document - looks fine. Can you try with a fresh profile?

I am very surprised that you say that, because your document contains no more the input field. How can you consider it ok?

I failed to mention that I always test with a clean profile.
I was also unclear: it is not the input field is duplicated, this is its content: "Foo" becomes "oFooFooFoo" (see Res.odt)

I also reproduce on Windows XP & Version: 4.3.0.4 (fresh profile)
Build ID: 62ad5818884a2fc2e5780dd45466868d41009ec0

Regards
Pierre-Yves
Comment 5 Jan-Marek Glogowski 2014-08-06 14:50:39 UTC
Joels document is correct. MM replaces input fields with their content text.

I'm currently seeing this problem on master (from today) and 4.3.0.4 final (deb download), both running on Ubuntu Precise.

For me the actual problem is the inline editing of input fields, which is broken. With both of my versions I'm unable to edit input fields, as these are erroneously handled as write-protected.

MM field replacement happens by

1. Copy the text of the field
2. Put cursor at the field start
3. Move cursor after the field
4. Inserts the text
5. Set cursor to the field start
6. Move cursor as selection to the start of the text
7. Remove field

As you can't select anything protected, all the moves fail, so the text is inserted at the beginning of the field and - I guess - due to some other bug - the first character of the field is removed. (Due to MM you actually loose multiple characters). I'm not sure about the protection being the origin, but the moves definitly fail.

Joel - did you use LO downloads or Ubuntu builds? Do you see the same problem?
Comment 6 Jan-Marek Glogowski 2014-08-06 15:12:27 UTC
Seems that just backspace is broken. Select and delete work as expected. And as of #76565, paste is broken too.
Comment 7 pierre-yves samyn 2014-08-08 13:16:06 UTC
Hi

(In reply to comment #5)
> Joels document is correct. MM replaces input fields with their content text.

The problem is the result document (res.odt) generated with indicated system & versions  *is* incorrect (field not replaced, content duplicated & truncated). 

Joel and you are using Ubuntu.
 
> For me the actual problem is the inline editing of input fields, which is
> broken.

Yes I noticed that but this is another problem. 
Thank you to open (if necessary) another bug report on this issue which has nothing to do with the problem described here.

Regards
Pierre-Yves
Comment 8 Commit Notification 2014-08-17 21:24:20 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=2579adb13188d276701b1504b4a10bed4d8d4b6f

fdo#81750 MM: correctly convert inline-edit fields



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.
Comment 9 Björn Michaelsen 2014-10-11 13:58:47 UTC
(In reply to Commit Notification from comment #8)
> Jan-Marek Glogowski committed a patch related to this issue.
> It has been pushed to "master":
> http://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=2579adb13188d276701b1504b4a10bed4d8d4b6f
Thus closing as FIXED.
Comment 10 pierre-yves samyn 2014-10-11 16:41:12 UTC
Hi

(In reply to Björn Michaelsen from comment #9)
> (In reply to Commit Notification from comment #8)
> > Jan-Marek Glogowski committed a patch related to this issue.
> > It has been pushed to "master":
> > http://cgit.freedesktop.org/libreoffice/core/commit/
> > ?id=2579adb13188d276701b1504b4a10bed4d8d4b6f
> Thus closing as FIXED.

Verified on windows 7/64 & Version: 4.4.0.0.alpha0+
Build ID: f33002aa5de7e88960e7c21286a661c89fd478c7
TinderBox: Win-x86@42, Branch:master, Time: 2014-10-04_03:30:14

Thank you :)
Regards
Pierre-Yves
Comment 11 Commit Notification 2019-01-09 21:31:10 UTC
Serge Krot committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/0830f50d794b36c85e0b701b7b3376b03f5e982d%5E%21

tdf#81750 new unit test: no duplication of field content

It will be available in 6.3.0.

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

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