gnucash maint: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Mon Oct 28 11:51:41 EDT 2019
Updated via https://github.com/Gnucash/gnucash/commit/e83938fd (commit)
via https://github.com/Gnucash/gnucash/commit/2e1b87e0 (commit)
via https://github.com/Gnucash/gnucash/commit/644cb410 (commit)
from https://github.com/Gnucash/gnucash/commit/d8937234 (commit)
commit e83938fdc2ae8b26070d1dd08f91f0240af75bd8
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Oct 28 23:41:11 2019 +0800
[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
diff --git a/gnucash/report/business-reports/aging.scm b/gnucash/report/business-reports/aging.scm
index 55844b2a0..cc5cb8e73 100644
--- a/gnucash/report/business-reports/aging.scm
+++ b/gnucash/report/business-reports/aging.scm
@@ -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")
commit 2e1b87e01f894bd725294596a6e1884a518a9f40
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Oct 28 20:17:43 2019 +0800
[report-utilities] gnc:strify add lot printer
diff --git a/gnucash/report/report-system/report-utilities.scm b/gnucash/report/report-system/report-utilities.scm
index 10cee27df..2eec572b8 100644
--- a/gnucash/report/report-system/report-utilities.scm
+++ b/gnucash/report/report-system/report-utilities.scm
@@ -1212,6 +1212,13 @@ flawed. see report-utilities.scm. please update reports.")
(monetary->string (gnc:make-gnc-monetary
(gncInvoiceGetCurrency inv)
(gncInvoiceGetTotal inv)))))
+ (define (lot->str lot)
+ (format #f "Lot<Acc:~a,Title:~a,Notes:~a,Balance:~a,NSplits:~a>"
+ (gnc:strify (xaccAccountGetName (gnc-lot-get-account lot)))
+ (gnc-lot-get-title lot)
+ (gnc-lot-get-notes lot)
+ (gnc-lot-get-balance lot)
+ (gnc-lot-count-splits lot)))
(define (try proc)
;; Try proc with d as a parameter, catching exceptions to return
;; #f to the (or) evaluator below.
@@ -1242,6 +1249,7 @@ flawed. see report-utilities.scm. please update reports.")
(try gnc-budget-get-name)
(try owner->str)
(try invoice->str)
+ (try lot->str)
(object->string d)))
(define (pair->num pair)
commit 644cb4100ed381742c071b19c84ae287886c2f3f
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Oct 28 20:01:39 2019 +0800
[gncOwner] add gncOwnerGetTypeString returns owner-type
* will have several uses
diff --git a/gnucash/report/report-system/report-utilities.scm b/gnucash/report/report-system/report-utilities.scm
index 9961a6a37..10cee27df 100644
--- a/gnucash/report/report-system/report-utilities.scm
+++ b/gnucash/report/report-system/report-utilities.scm
@@ -1200,15 +1200,8 @@ flawed. see report-utilities.scm. please update reports.")
(format #f "[~a]"
(gnc:monetary->string mon)))
(define (owner->str owner)
- (define owner-alist
- (list (cons GNC-OWNER-NONE "None")
- (cons GNC-OWNER-UNDEFINED "Undefined")
- (cons GNC-OWNER-JOB "Job")
- (cons GNC-OWNER-CUSTOMER "Cust")
- (cons GNC-OWNER-VENDOR "Vend")
- (cons GNC-OWNER-EMPLOYEE "Emp")))
(format #f "[~a:~a]"
- (or (assv-ref owner-alist (gncOwnerGetType owner)) "Owner")
+ (gncOwnerGetTypeString owner)
(gncOwnerGetName owner)))
(define (invoice->str inv)
(format #f "~a<Post:~a,Owner:~a,Notes:~a,Total:~a>"
diff --git a/libgnucash/engine/gncOwner.c b/libgnucash/engine/gncOwner.c
index 53e648edb..93a8211e5 100644
--- a/libgnucash/engine/gncOwner.c
+++ b/libgnucash/engine/gncOwner.c
@@ -204,6 +204,29 @@ GncOwnerType gncOwnerGetType (const GncOwner *owner)
return owner->type;
}
+const char * gncOwnerGetTypeString (const GncOwner *owner)
+{
+ GncOwnerType type = gncOwnerGetType(owner);
+ switch (type)
+ {
+ case GNC_OWNER_NONE:
+ return "None";
+ case GNC_OWNER_UNDEFINED:
+ return "Undefined";
+ case GNC_OWNER_CUSTOMER:
+ return "Customer";
+ case GNC_OWNER_JOB:
+ return "Job";
+ case GNC_OWNER_VENDOR:
+ return "Vendor";
+ case GNC_OWNER_EMPLOYEE:
+ return "Employee";
+ default:
+ PWARN ("Unknown owner type");
+ return NULL;
+ }
+}
+
QofIdTypeConst
qofOwnerGetType(const GncOwner *owner)
{
diff --git a/libgnucash/engine/gncOwner.h b/libgnucash/engine/gncOwner.h
index 28251ac33..c66d60fe5 100644
--- a/libgnucash/engine/gncOwner.h
+++ b/libgnucash/engine/gncOwner.h
@@ -65,6 +65,8 @@ to QOF as they can be used by objects like GncInvoice.
*/
/** return the type for the collection. */
QofIdTypeConst qofOwnerGetType(const GncOwner *owner);
+/** return the type for the owner as an untranslated string. */
+const char * gncOwnerGetTypeString (const GncOwner *owner);
/** return the owner itself as an entity. */
QofInstance* qofOwnerGetOwner (const GncOwner *owner);
/** set the owner from the entity. */
Summary of changes:
gnucash/report/business-reports/aging.scm | 24 ++++++++++++++---------
gnucash/report/report-system/report-utilities.scm | 17 ++++++++--------
libgnucash/engine/gncOwner.c | 23 ++++++++++++++++++++++
libgnucash/engine/gncOwner.h | 2 ++
4 files changed, 49 insertions(+), 17 deletions(-)
More information about the gnucash-changes
mailing list