gnucash maint: [new-aging] speedup/cleanup. delay txn type filtering of splits
Christopher Lam
clam at code.gnucash.org
Wed Jan 22 08:52:14 EST 2020
Updated via https://github.com/Gnucash/gnucash/commit/93ff991b (commit)
from https://github.com/Gnucash/gnucash/commit/c29409f4 (commit)
commit 93ff991b31160a798424a6ea94394b1e3a510330
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Jan 19 21:16:36 2020 +0800
[new-aging] speedup/cleanup. delay txn type filtering of splits
APAR splits were filtered to exclude invalid txn types. Omit
filtering, and skip (and log) invalid txn types during each account
splits loop.
diff --git a/gnucash/report/business-reports/new-aging.scm b/gnucash/report/business-reports/new-aging.scm
index 0f1e57d2c..28ecec961 100644
--- a/gnucash/report/business-reports/new-aging.scm
+++ b/gnucash/report/business-reports/new-aging.scm
@@ -168,11 +168,10 @@ exist but have no suitable transactions."))
(fold-right (lambda (opt elt prev) (if opt (cons elt prev) prev))
'() address-list-options result-list)))
-(define (txn-is-invoice? txn)
- (eqv? (xaccTransGetTxnType txn) TXN-TYPE-INVOICE))
-
-(define (txn-is-payment? txn)
- (eqv? (xaccTransGetTxnType txn) TXN-TYPE-PAYMENT))
+(define (split-is-not-business? split)
+ (let ((type (xaccTransGetTxnType (xaccSplitGetParent split))))
+ (not (or (eqv? type TXN-TYPE-INVOICE)
+ (eqv? type TXN-TYPE-PAYMENT)))))
(define (gnc-owner-equal? a b)
(string=? (gncOwnerReturnGUID a) (gncOwnerReturnGUID b)))
@@ -269,11 +268,7 @@ exist but have no suitable transactions."))
;; loop into each APAR account
(let loop ((accounts accounts)
- (splits (filter
- (lambda (split)
- (or (txn-is-invoice? (xaccSplitGetParent split))
- (txn-is-payment? (xaccSplitGetParent split))))
- splits))
+ (splits splits)
(accounts-and-owners '())
(invalid-splits '())
(tofree '()))
@@ -393,6 +388,16 @@ exist but have no suitable transactions."))
invalid-splits
tofree))
+ ;; txn type != TXN_TYPE_INVOICE or TXN_TYPE_PAYMENT.
+ (((? split-is-not-business? this) . rest)
+ (let ((type (xaccTransGetTxnType (xaccSplitGetParent this))))
+ (lp rest
+ acc-totals
+ (cons (list (format #f (_ "Invalid Txn Type ~a") type) this)
+ invalid-splits)
+ tofree
+ owners-and-aging)))
+
;; some payment splits may have no owner in this
;; account. skip. see bug 797506.
(((? split-owner-is-invalid? this) . rest)
Summary of changes:
gnucash/report/business-reports/new-aging.scm | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
More information about the gnucash-changes
mailing list