From 924fee2f3e95e6f10997a5d2a6c1654b97b39155 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Sun, 15 Dec 2019 21:18:09 +0800 Subject: [PATCH] Bug 797521 - Receivable Aging (beta): omit duplicate invoices When processing payment->invoices, don't show duplicate invoices. This is an unusual case documented in the bug. Note: Instead of sort-and-delete-duplicates the invoices, we could replace the invoice accumulator with the O(N^2) version: (if (member invoice invoices) invoices (cons invoice invoices)) --- gnucash/report/business-reports/new-owner-report.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm index eaf426adff..0cd1856fff 100644 --- a/gnucash/report/business-reports/new-owner-report.scm +++ b/gnucash/report/business-reports/new-owner-report.scm @@ -345,12 +345,16 @@ (gnc:make-gnc-monetary tfr-curr tfr-amt))))) result))))))))))) + (define (invoiceoverpayment-and-invoices txn) (let lp ((splits (xaccTransGetAPARAcctSplitList txn #f)) (overpayment 0) (invoices '())) (match splits - (() (cons (AP-negate overpayment) invoices)) + (() (cons (AP-negate overpayment) + (sort-and-delete-duplicates invoices invoice