GnuCash
Contact   Instructions
Bug 797197 - Transaction report : Error message when sorting on month
Summary: Transaction report : Error message when sorting on month
Status: RESOLVED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Reports (show other bugs)
Version: 3.5
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: reports
QA Contact: reports
URL:
Whiteboard:
Keywords:
: 780475 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-04-16 18:01 EDT by Denis
Modified: 2019-10-03 22:53 EDT (History)
6 users (show)

See Also:


Attachments
Trace record of the bug (1.73 KB, text/plain)
2019-04-16 18:01 EDT, Denis
no flags Details
screenshot fr_FR (105.17 KB, image/png)
2019-05-24 22:55 EDT, Christopher Lam
no flags Details

Description Denis 2019-04-16 18:01:12 EDT
Created attachment 373240 [details]
Trace record of the bug

Transaction report is working fine EXCEPT if you choose MONTH as the sorting key.

I'm using the french version of GnuCash with Windows 7.
In the preferences Hour/day is YYYY-MM-DD (same as ISO)

included is the trace record for the error.

Denis
Comment 1 Christopher Lam 2019-05-24 08:02:45 EDT
I suspect your bug has been fixed in current development version, for release in approx 2 months' time.

Please try a recent build at https://code.gnucash.org/builds/win32/maint/ (sort by Last-Modified and grab the latest) and try again.
Comment 2 Denis 2019-05-24 18:29:49 EDT
With the current development version I get the same results.

Again, all sorting keys works fine EXCEPT the month.

Denis
Comment 3 Christopher Lam 2019-05-24 22:55:17 EDT
Created attachment 373288 [details]
screenshot fr_FR

I run Windows 10 in English (Australia). I have set both LANG and LANGUAGE to fr_FR. Mine does not crash however month names are not translated.

See screenshot.
Comment 4 Christopher Lam 2019-05-24 23:09:14 EDT
#vu8(102 233 118 114 105 101 114 32 50 48 49 57) corresponds to "Février 2019".

As a test can you modify the file date-utilities.scm so that

--->---
(define (gnc:date-get-month-string datevec)
  (gnc-locale-to-utf8 (strftime "%B" datevec)))

(define (gnc:date-get-month-year-string datevec)
  (gnc-locale-to-utf8 (strftime "%B %Y" datevec)))
---<---

becomes

--->---
(define (gnc:date-get-month-string datevec)
  (strftime "%B" datevec))

(define (gnc:date-get-month-year-string datevec)
  (strftime "%B %Y" datevec))
---<---

and try again?
Comment 5 Denis 2019-05-25 09:53:11 EDT
I made the modifications to the file date-utilities.scm

I get the same results. I don't see any modification from one to the other.

Denis
Comment 6 Denis 2019-05-25 14:49:58 EDT
Just a precision: I'm using Windows 7 in french Canada.

Denis
Comment 7 Christopher Lam 2019-05-25 19:16:47 EDT
Strange. How about

--->---
(define (gnc:date-get-month-string datevec)
  (date->string "~B" (gnc-mktime datevec)))

(define (gnc:date-get-month-year-string datevec)
  (date->string "~B ~Y" (gnc-mktime datevec)))
---<---
Comment 8 Christopher Lam 2019-05-25 19:17:33 EDT
Oops need to swap these parameters


--->---
(define (gnc:date-get-month-string datevec)
  (date->string (gnc-mktime datevec) "~B" ))

(define (gnc:date-get-month-year-string datevec)
  (date->string (gnc-mktime datevec) "~B ~Y"))
---<---
Comment 9 Christopher Lam 2019-05-25 21:27:07 EDT
addendum the date->string requires srfi-19 so trying the above will need (use-modules (srfi srfi-19)) somewhere at the top
Comment 10 Denis 2019-05-26 12:16:44 EDT
I made those modifications. But now Gnucash just start, shows the opening window
and close at once.

Denis
Comment 11 Christopher Lam 2019-05-26 21:43:36 EDT
Bug confirmed part of guile-2.2

I think we'll need to write a gnc_strftime function as a hack until guile-2.2 is fixed.

http://lists.gnu.org/archive/html/bug-guile/2019-05/msg00005.html
Comment 12 John Ralls 2019-05-26 22:37:12 EDT
We already have a bunch of date and date-time formatting functions, see libgnucash/engine/gnc-date.h.

We also build our own guile-2.2 for Windows so we can apply the patch ourselves.
Comment 13 Christopher Lam 2019-05-27 08:52:12 EDT
@Denis

Ok last attempt - change to the following -- also remove (use-modules (srfi srfi-19)) if you've added at the top.

-->-- 
(define (gnc:date-get-month-string datevec)
 (gnc-print-time64 (gnc-mktime datevec) "%B"))

(define (gnc:date-get-month-year-string datevec)
  (gnc-print-time64 (gnc-mktime datevec) "%B %Y"))
 
--<--
Comment 14 Denis 2019-05-27 09:11:58 EDT
SUCCESS!!!

Everything back to normal and working fine.

What more to say then congradulation for your never ending support and expertise.

Problem solve.

Denis
Comment 15 Christopher Lam 2019-05-27 09:26:45 EDT
You're welcome; thanks to your report, a bug was found in guile which will be fixed and propagated.

There are other uses of strftime in code -- is it worth changing all of them?
Comment 16 John Ralls 2019-05-27 10:15:54 EDT
(In reply to Christopher Lam from comment #15)

> There are other uses of strftime in code -- is it worth changing all of them?

Yes.
Comment 17 Christopher Lam 2019-10-03 22:53:22 EDT
*** Bug 780475 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.