Bug 130593 - Impossible to create a Decimal field with more than 1 decimal place
Summary: Impossible to create a Decimal field with more than 1 decimal place
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.4.0.3 release
Hardware: All All
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.0.0 target:6.4.1
Keywords: bibisected, bibisectRequest, regression
Depends on:
Blocks:
 
Reported: 2020-02-11 16:00 UTC by Robert Großkopf
Modified: 2020-02-19 13:17 UTC (History)
3 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 Robert Großkopf 2020-02-11 16:00:36 UTC
Have tested this with
Version: 6.4.0.3
Build-ID: b0a288ab3d2d4774cb44b62f04d5d28733ac6df8
CPU-Threads: 6; BS: Linux 4.12; UI-Render: Standard; VCL: kf5; 
Gebietsschema: de-DE (de_DE.UTF-8); UI-Sprache: de-DE
Calc: threaded

Open a new internal Firebird database. Create a table in Design View. Set one FieldType to DECIMAL. Stretch the dialog a littel bit to see the field properties at the bottom. Try to set the field to more than one Decimal Place. Isn't possible.

You couldn't create a field in the GUI, which could contain currency-values!

This works right in LO 6.3.4.2, fails in LO 6.4.0.3 on OpenSUSE 15.1 64bit rpm Linux.
Comment 1 Julien Nabet 2020-02-11 16:16:12 UTC
On Win10 with master sources updated today, I could reproduce this.
Comment 2 Xisco Faulí 2020-02-12 17:04:01 UTC
Not related to firebird
Comment 3 Xisco Faulí 2020-02-12 17:12:11 UTC
I do believe this is a regression introduced by 
https://cgit.freedesktop.org/libreoffice/core/commit/?id=8c66efa030e98cfdf5da20be368566d64e43c5d1 too. however, it crashed in some of the bisection steps

Adding Cc: Caolán McNamara
Comment 4 Commit Notification 2020-02-13 08:51:12 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4a3bb10b2f81ad836d6b9d9bd2f0384914a19cb5

Resolves: tdf#130593 set correct range for spinbutton

It will be available in 7.0.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.
Comment 5 Caolán McNamara 2020-02-13 08:53:25 UTC
fixed in master, backport to 6-4 in gerrit
Comment 6 Julien Nabet 2020-02-13 20:57:40 UTC
On pc Debian x86-64 with master sources +gtk3 updated today, I don't reproduce this.

Remark: when creating the field, number of decimals is 0, when clicking once to "+" to increase it, it jumps directly to "2", then it's ok, it increases or decreases by "1"
Comment 7 Commit Notification 2020-02-14 01:27:55 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/d021827a277c08053d11b7319f9b6180b4988684

Resolves: tdf#130593 set correct range for spinbutton

It will be available in 6.4.2.

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.
Comment 8 Xisco Faulí 2020-02-14 19:42:32 UTC
Verified in

Version: 7.0.0.0.alpha0+
Build ID: 54acab919e7c7c5d60fc697bda54278861ac250e
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3; 
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded

@Caolán, thanks for fixing this issue!!
Comment 9 Robert Großkopf 2020-02-16 08:27:55 UTC
(In reply to Julien Nabet from comment #6)
> On pc Debian x86-64 with master sources +gtk3 updated today, I don't
> reproduce this.
> 
> Remark: when creating the field, number of decimals is 0, when clicking once
> to "+" to increase it, it jumps directly to "2", then it's ok, it increases
> or decreases by "1"

... and this is a new bug: You couldn't change it back to '0' decimal places, if you have tried to set it to '1'.

Should I open a new bug for this?
Comment 10 Julien Nabet 2020-02-16 08:34:23 UTC
By adding some traces, it seems due to the fact that pFieldType->nMinimumScale is equal to 1.
So either min range should be 0 or it should display 1 instead of 0 so we don't have this little jump + we know that we can't put 0.
Comment 11 Robert Großkopf 2020-02-16 11:03:36 UTC
The min-value of the listbox should be 0, because it should be possible to create DECIMAL-fields without any decimal place. So it would be a good idea to set
pFieldType->nMinimumScale to 0.
Comment 12 Julien Nabet 2020-02-16 12:08:33 UTC
I gave a try on LO 6.3.4 on Win10.
I created a brand new odb file (Firebird embedded).
I used Design and created a Decimal field, indeed I could let "0" for decimal property.
But when saving table and just reopening it, this field was set to "1".

The property is retrieved from:
492              aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
493              pInfo->nMinimumScale    = aValue;
(https://opengrok.libreoffice.org/xref/core/dbaccess/source/ui/misc/UITools.cxx?r=51b5b930#493)
Comment 14 Julien Nabet 2020-02-16 12:34:21 UTC
Robert: I created a brand new bugtracker tdf#130708
Comment 15 Robert Großkopf 2020-02-16 15:33:29 UTC
This bug wasn't a special Firebird-bug. But the Difference between Firebird and HSQLDB was:
HSQLDB couldn't create more than 0 decimal place
Firebird couldn't create more than 1 decimal place
Comment 16 Commit Notification 2020-02-19 13:16:59 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-6-4-1":

https://git.libreoffice.org/core/commit/d549e5d7b3da3c60fa25e2a73892721e4539fc76

Resolves: tdf#130593 set correct range for spinbutton

It will be available in 6.4.1.

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.