Bug 147265 - FORMATTING - Currency format bug - "$ English (Canada)" displays as "BZ$ English (Belize)"
Summary: FORMATTING - Currency format bug - "$ English (Canada)" displays as "BZ$ Engl...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.2.5.2 release
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:7.5.0 target:7.4.0.0.beta2 tar...
Keywords: bibisected, bisected, regression
: 149613 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-02-07 19:29 UTC by tlbranscombe@shaw.ca
Modified: 2022-06-21 11:49 UTC (History)
4 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 tlbranscombe@shaw.ca 2022-02-07 19:29:23 UTC
Description:
Selecting the "CAD $ English (Canada)" as a Currency format results in the number being displayed as if the user selected the "BZD $ English (Belize)" option.  Menu options above and below the "CAD $ English (Canada)" option produce the expected results.

Actual Results:
Select a cell containing a number;
Display the Format Cell dialog (Ctrl-1);
   Select: Category = Currency;
           Format = "CAD $ English (Canada)";
           Language = English (Canada)
   Click "OK"

Expected Results:
Result displays as "BZ$nnn.nn"

Expected "$nnn.nn"


Reproducible: Always


User Profile Reset: No



Additional Info:
Preferences (Options)
Locale setting: "English (Canada)"
Default currency: "Default - CAD"
Comment 1 Julien Nabet 2022-02-07 21:06:40 UTC
On pc Debian x86-64 with LO 7.3.0.2, I don't reproduce this.

1) Do you reproduce this in a brand new ods file or just a specific file?
2) Could you rename your LO directory profile (see https://wiki.documentfoundation.org/QA/FirstSteps#Corrupted_user_profile) and give a new try?
Comment 2 tlbranscombe@shaw.ca 2022-02-08 03:31:18 UTC
(In reply to Julien Nabet from comment #1)
> On pc Debian x86-64 with LO 7.3.0.2, I don't reproduce this.
> 
> 1) Do you reproduce this in a brand new ods file or just a specific file?
> 2) Could you rename your LO directory profile (see
> https://wiki.documentfoundation.org/QA/FirstSteps#Corrupted_user_profile)
> and give a new try?

Thanks for your questions.

1. I've confirmed that the problem persists when I attempt to format a numeric cell in a new ods file.

2. I can also confirm that the problem persists after I rename my LO profile directory.
Comment 3 QA Administrators 2022-02-08 03:51:27 UTC Comment hidden (obsolete)
Comment 4 Julien Nabet 2022-02-08 17:52:45 UTC
Thank you for your feedback. No more question/idea for me but certainly someone may help you.
Comment 5 Julien Nabet 2022-06-19 08:29:06 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.

I couldn't reproduce this with French (France) locale setting but could once I selected "English (Canada)" for locale setting.
Comment 6 Julien Nabet 2022-06-19 08:30:42 UTC
*** Bug 149613 has been marked as a duplicate of this bug. ***
Comment 7 Julien Nabet 2022-06-19 08:31:35 UTC
Eike: thought you might be interested in this one.
It can be reproduced only with the right locale setting.
Comment 8 Julien Nabet 2022-06-19 08:41:32 UTC
If I use "English (Belize)" for locale setting then restart LO and choose "BZD BZ$ English (Belize)" for currency, I got the currency just above "BYR. Belarusian".
So again as if the entry corresponding to the locale was removed.
Perhaps it's related with first default entry which corresponds to the locale.
Comment 9 Julien Nabet 2022-06-19 13:18:19 UTC
It seems related with this part of code SvxCurrencyToolBoxControl::GetCurrencySymbols
(see https://opengrok.libreoffice.org/xref/core/svx/source/tbxctrls/tbcontrl.cxx?r=1d2b6b70#3872)
but I don't understand the whole mechanism.
Comment 10 Xisco Faulí 2022-06-20 09:50:11 UTC
Regression introduced by:

author	Eike Rathke <erack@redhat.com>	2021-10-25 15:39:46 +0200
committer	Eike Rathke <erack@redhat.com>	2021-10-25 18:15:40 +0200
commit 97e63ff5375d9d80d6fe5d4bd68883e35bd56d91 (patch)
tree ac70a5d79526e56a505375bb6f85921c6487108c
parent 02bd6074b00c3e4420f67ad67566c217d9341c03 (diff)
Fix toolbar button's currency list's number format for default locale

Bisected with: bibisect-linux64-7.3
Comment 11 Eike Rathke 2022-06-20 12:43:32 UTC
Oh great, both the toolbar control and the Numbers dialog use SvxCurrencyToolBoxControl::GetCurrencySymbols() but under different preconditions..
Since https://git.libreoffice.org/core/commit/f9cf53a082f1d99b313ebd09c8791541859eac40
Comment 12 Eike Rathke 2022-06-20 13:18:36 UTC
Which doesn't explain the regression by the mentioned change though, that affects code used only in the toolbar control.
Comment 13 Eike Rathke 2022-06-20 13:48:41 UTC
And I can't even reproduce the reported failure.
To be sure we talk about the same thing:
Tools -> Options -> Language Settings -> Languages:
Locale setting: English (Canada)
  (*not* Default - English (Canada))
Default currency: Default - CAD

Unformatted cell.
Ctrl+1 dialog, Numbers:
Category: Currency
Format: CAD $ English (Canada)
Language: English (Canada)
  (*not* Default - English (Canada))
Selected is the 4th format with Format Code
[$$-1009]#,##0.00;[RED]-[$$-1009]#,##0.00

(Fwiw, I get the same correct result for Language Default - English (Canada))


However, I *can* reproduce in the toolbar control's list, picking
CAD $ English (Canada)
there applies format code
[$BZ$-2809]#,##0.--;[RED]-[$BZ$-2809]#,##0.--

Is this a misunderstanding? Incorrect report? Manifestation of the same/similar bug depending on whatever circumstances?
Comment 14 Eike Rathke 2022-06-20 14:25:30 UTC
So, I don't know why I can reproduce it only differently, but I know why it is happening..
Comment 15 Eike Rathke 2022-06-20 15:06:26 UTC
In fact this happens with any locale if one picks the corresponding full entry from the currency control instead of the first default; which results in the same format code and that actually is the problem, a wrong default offset into currency format codes is returned for such, which might also happen in the Numbers tab dialog if there are duplicates but under different constellations.
Comment 16 Commit Notification 2022-06-20 17:16:17 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/36cf12d449c892e6bbacb7da5f4b008f7762232b

Resolves: tdf#147265 Return correct default if currency format is duplicate

It will be available in 7.5.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 17 Eike Rathke 2022-06-20 17:19:10 UTC
Pending review https://gerrit.libreoffice.org/c/core/+/136166 for 7-3
Comment 18 Julien Nabet 2022-06-20 17:29:40 UTC
On pc Debian x86-64 with master sources updated today (including Eike's patch), I confirm I don't reproduce the pb anymore.
I gave a try with English Canada locale + Japanese locale (to test tdf#149613).
Thank you Eike!
Comment 19 Commit Notification 2022-06-20 20:46:25 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/37b30be41d24c3659dbf64b46c490e94869fca7f

Resolves: tdf#147265 Return correct default if currency format is duplicate

It will be available in 7.4.0.0.beta2.

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 20 nobu 2022-06-21 00:23:38 UTC
Thank you Eike.
Thank you Julien for verifying my post.

I am surprised at the speed of correspondence.
Thank you again.
Comment 21 Commit Notification 2022-06-21 11:49:13 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

https://git.libreoffice.org/core/commit/3e24263d6174cd1e33c4216acbd0130b4ffa2dce

Resolves: tdf#147265 Return correct default if currency format is duplicate

It will be available in 7.3.5.

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.