GnuCash
Contact   Instructions
Bug 798039 - Using 'Consolidate Transactions' option on Consolidate Transaction Report returns Error
Summary: Using 'Consolidate Transactions' option on Consolidate Transaction Report ret...
Status: VERIFIED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Reports (show other bugs)
Version: 4.2
Hardware: PC All
: Normal normal
Target Milestone: ---
Assignee: reports
QA Contact: reports
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-09 10:05 EST by Adrien
Modified: 2021-01-08 12:35 EST (History)
6 users (show)

See Also:


Attachments
Report Error on MacOS Catalina (1.57 KB, text/plain)
2020-12-09 10:05 EST, Adrien
no flags Details
Report Error on Win10 (1.51 KB, text/plain)
2020-12-09 10:05 EST, Adrien
no flags Details
Consolidate Transaction Report (179.29 KB, application/octet-stream)
2020-12-10 20:14 EST, Adrien
no flags Details
Custom gnctimeperiod-utilities (64.18 KB, application/octet-stream)
2020-12-10 20:14 EST, Adrien
no flags Details

Description Adrien 2020-12-09 10:05:18 EST
Created attachment 373929 [details]
Report Error on MacOS Catalina

Two similar error reports generated by two different users. (see attached)

Steps to reproduce:

1. Run a Consolidate Transaction Report
2. Select account(s) to report on in the Accounts tab
3. Select the option 'Consolidate Transactions' in the Display tab
Comment 1 Adrien 2020-12-09 10:05:43 EST
Created attachment 373930 [details]
Report Error on Win10
Comment 2 Adrien 2020-12-09 10:06:39 EST
I forgot to add, I don't see the option in this report to not make account names URLs. Perhaps if that were added/turned off, this might not be an issue. (till it gets fixed properly)
Comment 3 Bob 2020-12-10 06:52:37 EST
I may be missing some thing, but I can not find that report in the menus and can not find the file 'consolidate-transactions.scm'.

Was this written by a third party file?
Comment 4 Christopher Lam 2020-12-10 07:37:14 EST
(In reply to Bob from comment #3)
> I may be missing some thing, but I can not find that report in the menus and
> can not find the file 'consolidate-transactions.scm'.
> 
> Was this written by a third party file?

Correct, by Doug Doughty around 2017 and are extremely buggy.
Comment 5 John Ralls 2020-12-10 11:59:43 EST
Obvious from the location of the scheme file raising the error: $GNUCASH_DATA_HOME/custom-reports.

Looks to me like it can be fixed simply by adding (use-modules gnucash html) before the gnc-build-url call, though that might expose one or more later include-what-you-use failures. Chris's recent guile-3 driven massive fix [1] of those issues added 8 use-modules calls to html-utilities.scm, the main Scheme file in GnuCash that uses gnc-build-url.

That said, it worked at some point so we've apparently managed to break user code. Chris, any ideas on the cause and what we can do to at least warn users with custom code?

[1] https://github.com/Gnucash/gnucash/pull/831/files#diff-fbeb66428cd2891229fe45e1e08f3b4ae0497e779d595c2a0349e45e6b8d6453
Comment 6 Adrien 2020-12-10 17:39:47 EST
Oops. Sorry for reporting a bug on a custom report. I tried John's suggestion by adding (use-modules gnucash html) but it is still throwing the same error. I'll chuck this one in my 'no longer works' folder of custom reports till I can get around to figuring it out.
Comment 7 Christopher Lam 2020-12-10 19:18:37 EST
I don't think the modularisation is crucial -- modularisation aims to silence warnings (because warnings eventually lead to broken code). I think it's simply bitrot.

I think this bug comes from gnc:module-load deprecations.

Perhaps attach the relevant files and we can have a look.
Comment 8 Adrien 2020-12-10 20:14:19 EST
Created attachment 373931 [details]
Consolidate Transaction Report

This report requires a custom gnctimeperiod-utilities.scm also attached.
Comment 9 Adrien 2020-12-10 20:14:57 EST
Created attachment 373932 [details]
Custom gnctimeperiod-utilities
Comment 10 Christopher Lam 2020-12-11 05:20:20 EST
I think the right fix is "(use-modules (gnucash html))"
Comment 11 Adrien 2020-12-11 09:19:56 EST
Indeed, sorry I didn't catch that myself. Thanks, it works!
Comment 12 Christopher Lam 2020-12-11 09:23:59 EST
Not quite. The fix may work but the real bug is in gnc:module-load which gjanssens wrote and mishandles (gnc:module-load "gnucash/html")

The real 4.x fix is as follows, which gives appropriate hints.

modified   bindings/guile/gnc-module.scm
@@ -64,7 +64,7 @@ this module in your code or not.")
 been deprecated. Use '(use-modules (" mod-name-str "))' instead.")
        (module-use! (current-module) (resolve-interface scm-mod-name)))
 
-      ((or "gnucash/gnome-utils" "gnucash/html" "gnucash/report/report-system")
+      ((or "gnucash/gnome-utils" "gnucash/report/report-system")
        (when (string=? gnc-mod-name "gnucash/report/report-system")
          (set! mod-name-str "gnucash report"))
        (set! scm-mod-name '(gnucash report))
@@ -76,6 +76,12 @@ or not you use functions from this module in your code or not.")
        (use-modules (gnucash engine) (gnucash app-utils))
        (module-use! (current-module) (resolve-interface scm-mod-name)))
 
+      ("gnucash/html"
+       (deprecate "* WARNING * '(gnc:module-load \"gnucash/html\" 0)' has \
+been deprecated. Use '(use-modules (gnucash html))' instead.")
+       (use-modules (gnucash html))
+       (module-use! (current-module) (resolve-interface scm-mod-name)))
+
       (_ (deprecate "* WARNING * '(gnc:module-load \"" gnc-mod-name "\" 0)' \
 has been deprecated. Use '(use-modules (" mod-name-str "))' instead. \
 Additional guile modules may have to be loaded depending on your specific code.")
Comment 13 Adrien 2020-12-11 09:43:35 EST
Roger that. Thanks again!

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