[aging] update error reporting

This error handling was for transactions in APAR accounts whereby
Transaction Currency != Owner Currency. An example is a manually
entered transaction, then assigned as payment to a customer with a
different currency. Update to modern API calls. Show the culprit
split details.

Fixed example output:

IGNORING TRANSACTION!
Invoice Owner: [None:]
Transaction:Txn<d:28/10/19>
Splits are:
Split<d:28/10/19,acc:Current,amt:$150.00,val:£150.00>
Split<d:28/10/19,acc:AR,amt:$0.00,val:-£150.00>
Transaction Currency:GBP
Client Currency:AUD
This commit is contained in:
Christopher Lam 2019-10-28 23:41:11 +08:00
parent 2e1b87e01f
commit e83938fdc2

View File

@ -29,6 +29,9 @@
(use-modules (gnucash utilities))
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
(eval-when (compile load eval expand)
(load-extension "libgncmod-gnome-utils" "scm_init_sw_gnome_utils_module"))
(use-modules (sw_gnome_utils))
(gnc:module-load "gnucash/report/report-system" 0)
@ -214,15 +217,18 @@
(if (not (gnc-commodity-equiv
this-currency
(company-get-currency company-info)))
(let ((error-str
(string-append "IGNORING TRANSACTION!\n" "Invoice Owner: " (gncOwnerGetName owner)
"\nTransaction GUID:" (gncTransGetGuid transaction)
"\nTransaction Currency" (gnc-commodity-get-mnemonic this-currency)
"\nClient Currency" (gnc-ommodity-get-mnemonic(company-get-currency company-info)))))
(gnc-error-dialog '() error-str)
(gnc:error error-str)
(cons #f (format
(_ "Transactions relating to '~a' contain \
(let ((error-str
(string-append "IGNORING TRANSACTION!\n" "Invoice Owner: " (gnc:strify owner)
"\nTransaction:" (gnc:strify transaction)
"\nSplits are:\n"
(string-join
(map gnc:strify (xaccTransGetSplitList transaction))
"\n")
"\nTransaction Currency:" (gnc:strify this-currency)
"\nClient Currency:" (gnc:strify (company-get-currency company-info)))))
(gnc-error-dialog '() error-str)
(gnc:error error-str)
(cons #f (format #f (_ "Transactions relating to '~a' contain \
more than one currency. This report is not designed to cope with this possibility.") (gncOwnerGetName owner))))
(begin
(gnc:debug "it's an old company")