gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Sun Dec 15 13:16:37 EST 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/924fee2f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/43fab24e (commit)
	from  https://github.com/Gnucash/gnucash/commit/7cd6591c (commit)



commit 924fee2f3e95e6f10997a5d2a6c1654b97b39155
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Dec 15 21:18:09 2019 +0800

    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))

diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index eaf426adf..0cd1856ff 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 (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) invoices))
+        (() (cons (AP-negate overpayment)
+                  (sort-and-delete-duplicates invoices invoice<? equal?)))
         ((split . rest)
          (let ((invoice (gncInvoiceGetInvoiceFromLot (xaccSplitGetLot split))))
            (if (null? invoice)

commit 43fab24e2c0c787b178f472e3a2ca359f93a245e
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Dec 15 21:16:45 2019 +0800

    Bug 797521 - Receivable Aging (beta): include earliest split
    
    When processing invoice->payments, we used gnc-lot-get-earliest-split
    to find the lot opening-split to skip it.
    
    However it does not always return the lot opening-split, because a
    lot-reducing split may be dated earlier than the lot opening-split.
    
    This change means that the posting-split is processed together with
    the payment splits, but its PaymentAcctSplitList is null, so it does
    not add any row to the result.

diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index 0379f5ec6..eaf426adf 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -309,8 +309,7 @@
 
   (define (make-invoice->payments-table invoice)
     (define lot (gncInvoiceGetPostedLot invoice))
-    (let lp ((invoice-splits (delete (gnc-lot-get-earliest-split lot)
-                                     (gnc-lot-get-split-list lot)))
+    (let lp ((invoice-splits (gnc-lot-get-split-list lot))
              (result '()))
       (match invoice-splits
         ;; finished. test for underpayment and add outstanding balance



Summary of changes:
 gnucash/report/business-reports/new-owner-report.scm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)



More information about the gnucash-changes mailing list