Bug 74155 - mailmerge from basic puts output document in wrong directory - given target directory doesn't get a tailing slash added (see comment #3)
Summary: mailmerge from basic puts output document in wrong directory - given target ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.2.0.3 rc
Hardware: Other All
: medium normal
Assignee: Andras Timar
URL:
Whiteboard: target:4.3.0 target:4.2.3
Keywords: regression
Depends on:
Blocks:
 
Reported: 2014-01-28 16:03 UTC by pasqual milvaques
Modified: 2014-03-25 10:08 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
testcase to do mail merging from basic (20.05 KB, application/octet-stream)
2014-01-28 16:03 UTC, pasqual milvaques
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pasqual milvaques 2014-01-28 16:03:16 UTC
Created attachment 92936 [details]
testcase to do mail merging from basic

the OutputURL member of the MailMerge service controls the directory in which the files creted by a mailmerge action from basic will be placed.

the behaviour of this is buggy in 4.2, if I specify a OutputURL being 'file:///home/me/test' the file created by the merging must be something like:
/home/me/test/resultmerging0.odt

instead of that I obtain a file called:
/home/me/testresultmerging0.odt

this bug is introduced in 4.2 previous versions work ok

I add a testcase, edit the code to change the destination folder (Const theFolder) and place the two files of the testcase in it
Comment 1 Alex Kempshall 2014-02-14 18:47:36 UTC
I've encountered the same problem. I've had to go back to using LO 4.1.4.

Alex
Comment 2 Cor Nouws 2014-02-14 19:35:10 UTC
(In reply to comment #1)
> I've encountered the same problem. I've had to go back to using LO 4.1.4.

Thanks for confirming Alex - set this one to new.

(You must be a heavy user of mail-merge that you reverted ;) )

Cheers,
Cor
Comment 3 Alex Kempshall 2014-02-15 11:43:30 UTC
Cor

Thanks for the comment. Yes I am a heavy user of MailMerge. 

I now have a workaround.

In 4.1.4 and all previous releases I had these 3 lines in a Macro -

	DirectoryName = DirectoryNameoutofPath(DataSource.Name, "/")
	oMailMerge.OutputUrl = ConvertToUrl(DirectoryName)
	oMailMerge.FileNamePrefix = "White" & "Merged"

resulting in the variable DirectoryName holding the value 

"/home/alex/Documents/openoffice" 

MailMerge would create a file called -

/home/alex/Documents/openoffice/WhiteMerged0.odt

In 4.2.0 the same code produces a file called 

/home/alex/Documents/openofficeWhiteMerged0.odt

Whic was what Pasquel observed too.

Even though my code was working in 4.1.4 and all previous versions I've now changed it to - 

	DirectoryName = DirectoryNameoutofPath(DataSource.Name, "/") & "/"
	oMailMerge.OutputUrl = ConvertToUrl(DirectoryName)
	oMailMerge.FileNamePrefix = "White" & "Merged"

Note the new trailing forward slash in the DirectoryName

This results in the variable DirectoryName holding the value 

"/home/alex/Documents/openoffice/"

MailMerge now creates the correctly named file -

/home/alex/Documents/openoffice/WhiteMerged0.odt

i.e. back to where it was in 4.1.4 and all previous releases.

Hope this helps someone to fix it, or gives an explanation as to why we now see a different behaviour in MailMerge.

Also provides a work around to others whilst waiting for the fix (if any).

Alex
Comment 4 Cor Nouws 2014-02-15 22:26:56 UTC
Hi Alex,

thanks for your nice work around and explanation!

So apparently something in the code changed so that Directoryname in MailMerge doesn't get a tailing slash added when it doesn't have one.
I would say that's a bug.

Cor
Comment 5 Björn Michaelsen 2014-03-24 09:32:54 UTC
Actually making this an EasyHack: Once you bibisected this as per https://wiki.documentfoundation.org/QA/HowToBibisect -- it is likely trivial to identify the issue and fix it.
Comment 6 Commit Notification 2014-03-24 09:45:59 UTC
Andras Timar committed a patch related to this issue.
It has been pushed to "master":

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

fdo#74155 mailmerge output path fix



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 7 Commit Notification 2014-03-24 11:05:57 UTC
Andras Timar committed a patch related to this issue.
It has been pushed to "libreoffice-4-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6181b3fe2c11d55f46eaaf657877aa9396c16374&h=libreoffice-4-2

fdo#74155 mailmerge output path fix


It will be available in LibreOffice 4.2.4.

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 8 Commit Notification 2014-03-25 10:08:55 UTC
Andras Timar committed a patch related to this issue.
It has been pushed to "libreoffice-4-2-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=027e8b126b85d1c7abf458f2b37b61f76e7d3d47&h=libreoffice-4-2-3

fdo#74155 mailmerge output path fix


It will be available already in LibreOffice 4.2.3.

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.