Bug 130530 - User fields broken for time formats broken
Summary: User fields broken for time formats broken
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Fields-Variable
  Show dependency treegraph
 
Reported: 2020-02-08 14:56 UTC by Wolfgang Denk
Modified: 2023-04-02 13:20 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Test documents using plain text data resp. data in a User Field (12.88 KB, application/gzip)
2020-02-08 14:56 UTC, Wolfgang Denk
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Denk 2020-02-08 14:56:00 UTC
Created attachment 157746 [details]
Test documents using plain text data resp. data in a User Field

I'm trying to use a User Field for some calculations in a table.  This works fine for plain numbers, but fails to work for time formatted entries.

Document "Test-field.odt" shows the intended use: the left column holds entries that represent some time (given in hours and minutes, using time format string "[H]:MM" resp. "876613:37"), the middle column has some hourly rate, and the right column calculates the amount. This works fine here.

In document "Test-field.od" the time entry in the last line has been replaced by a User Field. The name is "var_time", format is Time, time format string again "[H]:MM" resp. "876613:37", value is 6:30.  However, the document displays not the expected "6:30", but "0:00" instead. Also, the calculation does not give the expected result.

I think the input format "6:30" for the value is not recognized as a valid number.  When I change the value for the field to a plain number, say 6, the following happens: if I click the green checkmark, the value in the table changes into "6"; but as soon as I clock OK, it changes into "144:00". Apparently the number is counting in days here. I can try confirm this by entering a float number 0,270833333 as value for the field. clicking on the green checkmark, it shows the float number as entered as value for the field, but when clicking OK it shows "6:30", and the computation gives the expected result.

However, when I select a "[H]:MM" time format, I should also be able to enter data in that format.

I wonder if the resulting declaration of the field in the XML file is correct; it reads:

<text:user-field-decl office:value-type="float" office:value="0" text:name="var_time"/>

Using plain numbers, I see this is represented as something like

...office:value-type="time" office:time-value="PT06H30M00S"...
Comment 1 Oliver Brinzing 2020-02-08 17:44:50 UTC
(In reply to Wolfgang Denk from comment #0)
> I think the input format "6:30" for the value is not recognized as a valid
> number.  When I change the value for the field to a plain number, say 6, the
> following happens: if I click the green checkmark, the value in the table
> changes into "6"; but as soon as I clock OK, it changes into "144:00".
> Apparently the number is counting in days here. I can try confirm this by
> entering a float number 0,270833333 as value for the field. clicking on the
> green checkmark, it shows the float number as entered as value for the
> field, but when clicking OK it shows "6:30", and the computation gives the
> expected result.

confirming, it seems only decimal values are accepted


Version: 7.0.0.0.alpha0+ (x64)
Build ID: e6341e0f613237020fef9e2028e123022ff2ce38
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: default; VCL: win; 
Locale: de-DE (de_DE); UI-Language: en-US
Calc: threaded
Comment 2 Wolfgang Denk 2020-04-21 14:45:28 UTC
How does this continue?  For more than two months nobody bothered to do anything about this bug - it has not even been assigned to anybody yet?
Comment 3 QA Administrators 2022-04-22 04:02:00 UTC Comment hidden (obsolete)
Comment 4 Wolfgang Denk 2022-04-25 13:02:38 UTC
The bug is still present in LibreOffice
Version: 7.2.6.2
Environment: CPUthreads: 24; OS: Linux 5.16
User Interface: UI render: default; VCL: x11
Locale: de-DE (C.UTF-8); UI: en-US
Misc: Calc: threaded
Comment 5 Stéphane Guillou (stragu) 2023-03-30 10:30:53 UTC
I reproduced in OOo 3.3, so the issue in inherited.
Comment 6 Eike Rathke 2023-04-02 13:12:23 UTC
(In reply to Wolfgang Denk from comment #0)
> I wonder if the resulting declaration of the field in the XML file is
> correct; it reads:
> 
> <text:user-field-decl office:value-type="float" office:value="0"
> text:name="var_time"/>
The float 0 is a result of the input not being accepted.


(In reply to Wolfgang Denk from comment #2)
> How does this continue?  For more than two months nobody bothered to do
> anything about this bug - it has not even been assigned to anybody yet?
We don't assign bugs to anyone. If developers pick a bug to work on they'll assign the bug to themselves.
Comment 7 Eike Rathke 2023-04-02 13:20:44 UTC
This has been fixed with the fix for bug 154218.