gnucash maint: Bug 797521 - Receivable Aging (beta): omit duplicate invoices
Christopher Lam
clam at code.gnucash.org
Sun Dec 15 13:55:37 EST 2019
Updated via https://github.com/Gnucash/gnucash/commit/5e7c2954 (commit)
from https://github.com/Gnucash/gnucash/commit/924fee2f (commit)
commit 5e7c29547129ff55fd0a88212f912e80ae347c7f
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Dec 16 02:35:58 2019 +0800
Bug 797521 - Receivable Aging (beta): omit duplicate invoices
924fee2f3 redux, unfortunately gncInvoiceGetGUID isn't actually
available from scheme so we use the O(N^2) accumulator instead.
diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index 0cd1856ff..1e6a20f9b 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -345,16 +345,12 @@
(gnc:make-gnc-monetary tfr-curr tfr-amt)))))
result)))))))))))
- (define (invoice<? a b)
- (string<? (gncInvoiceGetGUID a) (gncInvoiceGetGUID b)))
-
(define (payment-txn->overpayment-and-invoices txn)
(let lp ((splits (xaccTransGetAPARAcctSplitList txn #f))
(overpayment 0)
(invoices '()))
(match splits
- (() (cons (AP-negate overpayment)
- (sort-and-delete-duplicates invoices invoice<? equal?)))
+ (() (cons (AP-negate overpayment) invoices))
((split . rest)
(let ((invoice (gncInvoiceGetInvoiceFromLot (xaccSplitGetLot split))))
(if (null? invoice)
@@ -363,7 +359,9 @@
invoices)
(lp rest
overpayment
- (cons invoice invoices))))))))
+ (if (member invoice invoices)
+ invoices
+ (cons invoice invoices)))))))))
(define (make-payment->invoices-list txn)
(list
Summary of changes:
gnucash/report/business-reports/new-owner-report.scm | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
More information about the gnucash-changes
mailing list