Bug 109004 - External form does not save the path to database any more.
Summary: External form does not save the path to database any more.
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
5.3.0.3 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2017-07-07 15:51 UTC by Andreas Säger
Modified: 2020-06-10 10:26 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Writer doc with database form, no macros (10.38 KB, application/vnd.oasis.opendocument.text)
2017-07-07 15:51 UTC, Andreas Säger
Details
Different forms with a small database. Register database as "persons" to test. (33.95 KB, application/zip)
2017-11-01 08:02 UTC, Robert Großkopf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Säger 2017-07-07 15:51:17 UTC
Created attachment 134530 [details]
Writer doc with database form, no macros

Open the attached text document with a database form. The form does not work because the data source specification is missing.

1. Click the [Edit] button
2. On toolbar "Form Design" or "Form Controls" turn on design mode (button #2)
3. Get the forms property (button #4), tab "Data"
4. Pick "Bibliography" from the "Data Source" drop down. Notice that the "Content" property turns blank which is expected behaviour.
5. Choose table "biblio" from the "Content" drop down.
6. Save the document. 
7. Reload the document.
Result: Form document opens in read-only mode with data in the form grid.

Now repeat steps 1. to 3.
4. Click the [...] button near the "Data Source" box instead of picking the registered name. Browse to your user profile, subfolder "database" and pick biblio.odb
Repeat steps 5. to 7 (Content="biblio", save, reload)
Result: Form document opens in read-only mode with NO data in the form grid.

Repeat steps 1. to 3. The "Data Source" property is blank.

I found this with LibreOffice 5.3.4.2 on Linux.
LibreOffice 5.2.3.3 on Windows(x64) does not show this problem.
Comment 1 Andreas Säger 2017-07-07 15:55:32 UTC
Expected behaviour is that you can specify a form's data source either by a registered name or by the URL of a database document.
Comment 2 Robert Großkopf 2017-07-08 14:34:18 UTC
Could confirm this buggy behavior. Works right with LO 5.2.5 (no newer LO 5.2-Version available), fails first with LO 5.3.0.3 here.

My system: OpenSUSE 42.2 64bit rpm Linux.

Note: LO 5.3.0.3 will show the data if the URL to the datasource has been created with LO 5.2.5. But if I try to create the URL to datasource with LO 5.3.* the data won't be shown any more when reopening the attached form-file. Will only show the data when changing designmode to input data after changing datasource.
Comment 3 Andreas Säger 2017-07-09 09:09:45 UTC
To my surprise, the problem arises only if the form document had a former life within a Base document. My attachment was formerly embedded. If I use Writer to create an external form from scratch, the problem does not occur.

Background: My collection of Base macros: https://forum.openoffice.org/en/forum/viewtopic.php?f=21&t=77543 (FreeHSQLDB.FreeForms.Main extracts and reconnects embedded forms to a directory).
Comment 4 Robert Großkopf 2017-11-01 08:01:09 UTC
Have tested this a little bit more.

You could create an external form with link to the database. It will work right until you close the form. If you reopen the form the datasource has been gone.

You could create a form with a registered name for the database. This will work right every time. You could close and reopen without any problem.

This bug first appears with LO 5.3 on OpenSUSE 42.2 64bit rpm Linux.
Comment 5 Robert Großkopf 2017-11-01 08:02:58 UTC
Created attachment 137411 [details]
Different forms with a small database. Register database as "persons" to test.
Comment 6 Robert Großkopf 2017-11-01 08:08:48 UTC
Have set the component to "LibreOffice", because the bug appears in Writer-forms and also in Calc-forms. It isn't a Base-bug.
Comment 7 QA Administrators 2018-11-02 03:51:05 UTC Comment hidden (obsolete)
Comment 8 Andreas Säger 2018-11-04 10:18:03 UTC
When I download and open my initial text document of 2017-07-07, the form does work indeed. The data source URL pointing to my "Bibliography" database is specified as follows:

file:///../home/andreas/.config/libreoffice/4/user/database/biblio.odb

which looks like a relative path to my profile folder.
However, the actual path of the downloaded document is:

file:///tmp/mozilla_andreas0/BiblioFormBug.odt

There is something wrong with the URL parser. Starting from /tmp/mozilla_andreas0/ the relative URL would point to 
/tmp/home/andreas/.config/libreoffice/4/user/database/biblio.odb. 
For some reason it points to the correct database document anyway. However, the correct relative path would be 2 levels above the document path.

file:///../../home/andreas/.config/libreoffice/4/user/database/biblio.odb
with ../../ instead of  ../

When I hit the ellipsis button near the data source property box, the property shows a correct absolute URL file:///home/andreas/.config/libreoffice/4/user/database/biblio.odb but that one fails to connect with the database document.

Now I move the form document to file:///tmp/test/foo/bar/baz/BiblioFormBug.odt without adjusting the database path. The form tries to access

file:///tmp/test/home/andreas/.config/libreoffice/4/user/database/biblio.odb
which is 3 levels above the document path. In relative notation: 
../../../home/andreas/etc

The form finds its database again when I move it 2 levels higher to /tmp/test/foo/BiblioFormBug.odt
However it fails again when I specify the database path using the ellipsis button. The button seems to generate a wrong relative URL. In content.xml I find this path:

<form:connection-resource xlink:href="../../../home/andreas/.config/libreoffice/4/user/database/biblio.odb"/>
Starting at /tmp/test/ that is an invalid path one level above the root folder.
Comment 9 Andreas Säger 2018-11-04 10:24:16 UTC
Clarification to the last statement above:
I used the file picker provided in the form properties to point the form embedded in document 
/tmp/test//BiblioFormBug.odt 
 to 
/home/andreas/.config/libreoffice/4/user/database/biblio.odb
which is in relative notation
../../home/andreas/.config/libreoffice/4/user/database/biblio.odb

However, the URL stored in content.xml is this:
<form:connection-resource xlink:href="../../../home/andreas/.config/libreoffice/4/user/database/biblio.odb"/>
Comment 10 Buovjaga 2020-06-06 13:39:46 UTC
I can not reproduce with 6.4.4 on Windows. Btw. now you have to use Edit - Edit mode (Ctrl-Shift-M) because the "Edit document" infobar does not show due to the change that came with bug 101652.

Andreas, Robert: can you re-test? Or is this Linux-only?
Comment 11 Robert Großkopf 2020-06-06 18:22:51 UTC
Have retested the bug with LO 6.4.4.2. Couldn't reproduce the behavior.

Let us close this one to WORKSFORME.