Bug 104116 - Writer - standalone forms: Can't use relative URLs for data source
Summary: Writer - standalone forms: Can't use relative URLs for data source
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-22 15:18 UTC by Kostas Katsaros
Modified: 2022-07-24 06:57 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kostas Katsaros 2016-11-22 15:18:41 UTC
Description:
I have created a directory that contains:
1. An .odb (LibreOffice Base) file, "Production.odb" containing tables and queries.
2. A subdirectory at the same directory, named "forms", that contains all the forms that I need. All the forms have the "Production.odb" file as "Data source" in form properties ("file:///home/kostas/path-to-directory/Production.odb").
The problem is that, dispite the checked box "Save URLs relative to file system" at Options => Load/Save => General, the URLs are not treated as relative ones. That is, when I move the whole directory or rename a part of the path to it, the form is loosing the connection to the .odb file.

This bug prevent me from creating a database UI (a set of forms) that avoid using macros for opening forms using buttons. When I move the directory to my users' PCs I have to adjust the path to the Data Source in every form.

The workaround for this is to register the database to LibreOffice and then use the registered name for Data Source. But this requires a setup in user's machine, not just a file copying.

Steps to Reproduce:
1. Create an .odb file, create some tables/queries in it.
2. Create a form inside the .odb (in Base) that display some data.
3. Save the form as .odt file inside "forms" subdirectory.
4. Open it with Writer. Go to View => Toolbars => Form Design and check it. In the toolbar that appears, press the 2nd button ("Edit") and then the 5th button ("Form Navigator"). In Form Navigator, right click your form and go to Properties => Data => Data Source and select your .odb file. Save the .odt file and close both .odt and .odb files.
5. Reopen the form (.odt) just to see that the database data is listed normally. Then close it.
6. Move the whole directory that the database and forms reside, or rename a directory in its path.
7. Open the form (.odt) again.

Actual Results:  
The database data is not appearing. If you try to edit the form, a warning appears that says "The connection to the data source could not be established".

Expected Results:
The database data is appearing normally.


Reproducible: Always

User Profile Reset: No

Additional Info:


User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0
Comment 1 m_a_riosv 2016-11-22 18:29:26 UTC
There is an option:
Menu/Tools/Options/Load+Save/General - Save URLs relative to file system.
"
Save URLs relative to file system
This option allows you to select the default for relative addressing of URLs in the file system and on the Internet. Relative addressing is only possible if the source document and the referenced document are both on the same drive.
A relative address always starts from the directory in which the current document is located. In contrast, absolute addressing always starts from a root directory. The following table demonstrates the difference in syntax between relative and absolute referencing:
Examples
File system
Internet
relative
../images/img.jpg
../images/img.jpg
absolute
file:///c|/work/images/img.jpg
http://myserver.com/work/images/img.jpg


The Help tip always displays an absolute path. However, if a document is saved in HTML format, LibreOffice will enter a relative path if the appropriate check box is selected.
"
Comment 2 Kostas Katsaros 2016-11-22 18:44:14 UTC
(In reply to m.a.riosv from comment #1)

Yes, I'm aware of this option, I wrote it in my description. The checkbox is checked.
Any attempt that I tried to give a relative path ("../Production.odb", "file://../Production.odb" etc) in Data Source field didn't work.
Comment 3 m_a_riosv 2016-11-22 21:51:01 UTC
Test entering the absolute path not relative. I think with the option enable LO should treat it as relative although the absolute path is visible.
Comment 4 Kostas Katsaros 2016-11-23 07:00:14 UTC
(In reply to m.a.riosv from comment #3)
Thank you for following this. Have you tried to reproduce the bug in your machine? What is the result?
Yes, the absolute path is the only choice, together with the registered database name. It should be treated as a relative one, but it is not. The value in Data Source field is the one that the file picker produce, I wrote it in my description: "file:///home/kostas/path-to-directory/Production.odb".
Comment 5 Alex Thurgood 2017-07-19 13:24:36 UTC
@Kostas : there are other known bugs (most notably in Calc and Writer) which show similar irregular behaviour - see for example, comment 12 of bug 61743.
Comment 6 Alex Thurgood 2017-07-19 13:33:58 UTC
See also this discussion :

https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=6358

the problem isn't new and has been around for some time...
Comment 7 Alex Thurgood 2017-07-19 14:12:30 UTC
See also point 6 of the following post:

https://forum.openoffice.org/en/forum/viewtopic.php?t=40493

where it explicitly mentions that database sources from standalone forms are hardcoded non-relative links.

So, the question is whether or not this could be considered as a RFE, or alternatively, as behaviour corresponding to intended design.


From the comment in brackets of the post above, having hardcoded absolute paths was probably a poor design choice, so let's set this to RFE.
Comment 8 Kostas Katsaros 2017-07-22 19:45:32 UTC
@Alex:
The bug that you mentioned is work in progress, like this one (maybe the two are related, I'm not the one to judge about this). The other two links are to the OpenOffice forum, not to any bug tracker.
I don't see how we could possible debate about whether this should be a bug submission or a feature request. There is a check-box about this in Options, that lets the user decide whether LibreOffice should store the relative or the absolute path of the reference. This check-box is well documented inside Help, as stated by m.a.riosv above. There is no "poor design choice" (BTW, the exact phrase at the tutorial's point 6 was "not good programming"), something doesn't work and needs to be reported in order to be fixed.
It's a serious bug, in my opinion, because it prevents people from using LibreOffice the way that the tutorial you mentioned does. The workaround provided by the tutorial at point 6 is not good enough, because it "requires a setup in user's machine, not just a file copying", as I stated in my description.
I'm reverting this to "bug", instead of "RFE".
Comment 9 Kostas Katsaros 2017-07-22 19:47:53 UTC
@Alex:
Anyway, thank you for confirming this behavior.
Comment 10 QA Administrators 2018-07-23 02:32:17 UTC Comment hidden (obsolete)
Comment 11 QA Administrators 2020-07-23 03:55:32 UTC Comment hidden (obsolete)
Comment 12 QA Administrators 2022-07-24 03:31:32 UTC Comment hidden (obsolete)
Comment 13 Kostas Katsaros 2022-07-24 06:57:15 UTC
Not reprodusable anymore, I don't know what changed.
Version: 7.3.4.2 / LibreOffice Community, Ubuntu.