After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 384879 - Receivable Aging Report Crash
Receivable Aging Report Crash
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Reports
2.0.x
Other All
: Normal major
: ---
Assigned To: Chris Lyttle
Chris Lyttle
Depends on:
Blocks:
 
 
Reported: 2006-12-11 23:23 UTC by Georgi Mirchev
Modified: 2018-06-29 21:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fixes the bug (1.44 KB, patch)
2007-02-19 00:28 UTC, Georgi Mirchev
none Details | Review

Description Georgi Mirchev 2006-12-11 23:23:20 UTC
Please describe the problem:
When running the receivable aging report on one of the currencies the report shows the error - "Report error An error occurred while running the report.", and this is the dump in the console:

In /usr/local/share/gnucash/scm/report.scm:
 420: 27* (set! doc (if template (let* # # # ...) #f))
 420: 28* (if template (let* # # # ...) #f)
 421: 29  (let* (# # # ...) (gnc:html-document-set-style-sheet! doc stylesheet) ...)
 423: 30* [receivables-renderer #]
In unknown file:
   ?: 31  (letrec (#) (let # # #))
In /usr/local/share/gnucash/guile-modules/gnucash/report/aging.scm:
    ...
 518: 32  (let* (# # # ...) (gnc:html-document-set-title! document report-title) ...)
 561: 33* (if account (begin (setup-query query account ...) (let # # ...)) ...)
 562: 34  (begin (setup-query query account ...) (let (#) (set! work-to-do #) ...))
 565: 35  (let ((splits #)) (set! work-to-do (length splits)) ...)
 571: 36* [for-each #<procedure #f (split)> (# # # # ...)]
In unknown file:
   ?: 37* [#<procedure #f (split)> #<gw:wcp <gnc:Split*> 0x86efb68>]
In /usr/local/share/gnucash/guile-modules/gnucash/report/aging.scm:
 574: 38* [update-company-hash #(() () () ...) #<gw:wcp <gnc:Split*> 0x86efb68> ...]
In unknown file:
   ?: 39  (letrec ((do-update #)) (let* (# # #) (if # #)))
In /usr/local/share/gnucash/guile-modules/gnucash/report/aging.scm:
    ...
 205: 40  [cons #f ...
 205: 41*  [sprintf "Transactions relating to '%s' contain more than one currency.  $
In /usr/share/slib/printf.scm:
 558: 42   (let* (# # #) (apply stdio:iprintf # format ...) (cond # # #))
 565: 43*  [apply #<procedure stdio:iprintf #> #<procedure #f #> #f]
In unknown file:
   ?: 44   [stdio:iprintf #<procedure #f (x)> #f]
In /usr/share/slib/printf.scm:
     ...
 188: 45   (let ((pos -1) (fl #) (fc #)) (letrec (# # # # ...) (letrec # #)))
 189: 46*  [string-length #f]
/usr/share/slib/printf.scm:189:15: In procedure string-length in expression (string-length format-string):
/usr/share/slib/printf.scm:189:15: Wrong type argument in position 1 (expecting STRINGP): #f
In /usr/local/share/gnucash/scm/report.scm:
 420: 24* (set! doc (if template (let* # # # ...) #f))
 420: 25* (if template (let* # # # ...) #f)
 421: 26  (let* (# # # ...) (gnc:html-document-set-style-sheet! doc stylesheet) ...)
 423: 27* [receivables-renderer #]
In unknown file:
   ?: 28  (letrec (#) (let # # #))
In /usr/local/share/gnucash/guile-modules/gnucash/report/aging.scm:
    ...
 518: 29  (let* (# # # ...) (gnc:html-document-set-title! document report-title) ...)
 561: 30* (if account (begin (setup-query query account ...) (let # # ...)) ...)
 562: 31  (begin (setup-query query account ...) (let (#) (set! work-to-do #) ...))
 565: 32  (let ((splits #)) (set! work-to-do (length splits)) ...)
 571: 33* [for-each #<procedure #f (split)> (# # # # ...)]
In unknown file:
   ?: 34* [#<procedure #f (split)> #<gw:wcp <gnc:Split*> 0x86efb68>]
In /usr/local/share/gnucash/guile-modules/gnucash/report/aging.scm:
 574: 35* [update-company-hash #(() () () ...) #<gw:wcp <gnc:Split*> 0x86efb68> ...]
In unknown file:
   ?: 36  (letrec ((do-update #)) (let* (# # #) (if # #)))
In /usr/local/share/gnucash/guile-modules/gnucash/report/aging.scm:
    ...
 205: 37  [cons #f ...
 205: 38*  [sprintf "Transactions relating to '%s' contain more than one currency.  $
In /usr/share/slib/printf.scm:
 558: 39   (let* (# # #) (apply stdio:iprintf # format ...) (cond # # #))
 565: 40*  [apply #<procedure stdio:iprintf #> #<procedure #f #> #f]
In unknown file:
   ?: 41   [stdio:iprintf #<procedure #f (x)> #f]
In /usr/share/slib/printf.scm:
     ...
 188: 42   (let ((pos -1) (fl #) (fc #)) (letrec (# # # # ...) (letrec # #)))
 189: 43*  [string-length #f]
/usr/share/slib/printf.scm:189:15: In procedure string-length in expression (string-length format-string):
/usr/share/slib/printf.scm:189:15: Wrong type argument in position 1 (expecting STRINGP): #f


Steps to reproduce:
1. Run Receivable Aging report
2. 
3. 


Actual results:
Report error
An error occurred while running the report.

Expected results:
To see the report

Does this happen every time?
Yes

Other information:
Comment 1 Christian Stimming 2006-12-12 09:41:15 UTC
Is this bug#343322 ? Which version of gnucash exactly?
Comment 2 Georgi Mirchev 2006-12-12 10:01:32 UTC
No, it is a different bug. The version is 2.0.3, but it existed at least from 1.8.2.

The core of the problem seems be explained by the message "Transactions relating to '%s' contain more than one currency".
Comment 3 Derek Atkins 2006-12-23 20:18:23 UTC
The code in question is:

                         (sprintf
			     (_ "Transactions relating to '%s' contain \
more than one currency.  This report is not designed to cope with this possibility.")  (gncOwnerGetName owner))

So, here's the question for you:  who's the owner of this invoice?
And what's the owner's name?

This also begs the question of how you're entering in multi-currency
business transactions without having bogus data entries?
Comment 4 Georgi Mirchev 2006-12-27 14:07:27 UTC
This is a receivable aging report, thus this code goes through all invoices. I don't know which invoice is breaking it, otherwise I would have fixed it. Obviously this condition shouldn't break the report in the way it breaks now.

I'm not sure what bogus data entries you are refering to. We are using 3 currencies, and the aging report runs fine with 2 of the currencies, but breaks with the third currency.
Comment 5 Derek Atkins 2006-12-27 14:49:51 UTC
My question is more basic:  how are you entering multiple-currency invoices?  The business features just plain don't support that.  When you post an invoice, you need to make sure that all the accounts you use (all the Income and Asset accounts in the case of a Customer Invoice) have the same currency..   And the A/R account you use ALSO has to have the same currency.

The "bogus" entries are transaction splits with the wrong exchange rate; it'll compute an exchange rate of 1:1, because it always assumes a constant currency.

So without an example data file that shoes the issue I dont think I can even begin to understand what's going on.  You should never be able to post an invoice without an owner, and you can't create an owner without a name..  So I dont know why it's returning #f here.
Comment 6 Georgi Mirchev 2006-12-27 15:01:47 UTC
I see. You are saying that I have an invoice that it using accounts with mixed currencies. I think I can go and find the invoice manually, and fix it. It would have been easier if the report just said which that invoice is.
Comment 7 Derek Atkins 2006-12-27 15:11:04 UTC
Well, that's a different problem.  You can always modify the report to output the invoice guid instead of the owner name....
Comment 8 Georgi Mirchev 2006-12-27 15:16:33 UTC
hmm, let me put it this way. I know 10+ programming languages, but modifying the reports is black art to me. I spent 2 hours looking at one of the reports before I really knew what was happening in it.
But modifying them is a little too much for me. I'd rather go play Lineage 2.

Also the GUID is not very useful if you want to find the invoice through the GUI. I'll need Invoice ID instead.
Comment 9 Derek Atkins 2006-12-27 15:32:43 UTC
Use:  (gnc:invoice-get-id invoice)

(replace "invoice" with the actual invoice symbol in the context of the report)

As for learning scheme, any programmer can learn Scheme syntax in under a day.  Google for "Scheme Documentation" and find the MIT Scheme site.  It's very useful.  If you already know 12 languages, then Scheme should take you no time to learn the syntax.
Comment 10 Georgi Mirchev 2007-02-19 00:28:40 UTC
Created attachment 82859 [details] [review]
Fixes the bug
Comment 11 Georgi Mirchev 2007-02-19 00:32:30 UTC
The bug is actually caused by using the owner after it has been destroyed.

The attachment above moves the  (gnc:owner-destroy temp-owner) after it's possible use.
It also adds a gnc:debug call with relevant info about ignored transactions - i.e. transactions that are not included in the report.

I'm not sure that this patch should be applied though because people might fail to notice that transactions are actually ignored. But I couldn't net the debug call to be actually a html text in the report, so that it can't be missed.

I'd do it, but I'm not familiar enough with how the html is actualy generated.
Comment 12 Derek Atkins 2007-12-26 01:39:05 UTC
Well, if you wanted you could convert the gnc:debug into a gnc-error-dialog call.  In fact, I think I'll do that before applying.  I've updated this patch to 2.2/trunk.  Please test this!

Applied as r16724.
Comment 13 John Ralls 2018-06-29 21:18:31 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=384879. Please update any external references or bookmarks.