gnucash maint: Bug 797573 - Incorrect value of securities in the Asset Chart

Christopher Lam clam at code.gnucash.org
Tue Jan 14 20:35:23 EST 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/5ac7f1be (commit)
	from  https://github.com/Gnucash/gnucash/commit/d61453d3 (commit)



commit 5ac7f1beaf8f0c469d24fc362482d2a4b3646b3b
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Mon Jan 13 22:03:10 2020 +0800

    Bug 797573 - Incorrect value of securities in the Asset Chart
    
    Algorithms used xaccFooOrder to attempt strict ordering of Foo
    objects. Unfortunately the internal definitions of xaccAccountOrder
    does not guarantee a strict ordering of accounts.
    
    Also remove unused split<? comparator.

diff --git a/gnucash/report/business-reports/new-aging.scm b/gnucash/report/business-reports/new-aging.scm
index 754c742fb..5dd4b0831 100644
--- a/gnucash/report/business-reports/new-aging.scm
+++ b/gnucash/report/business-reports/new-aging.scm
@@ -177,9 +177,6 @@ exist but have no suitable transactions."))
 (define (gnc-owner-equal? a b)
   (string=? (gncOwnerReturnGUID a) (gncOwnerReturnGUID b)))
 
-(define (account<? a b)
-  (< (xaccAccountOrder a b) 0))
-
 (define (split-has-owner? split owner)
   (let* ((split-owner (split->owner split))
          (retval (gnc-owner-equal? split-owner owner)))
@@ -266,9 +263,7 @@ exist but have no suitable transactions."))
 
      (else
       (setup-query query accounts report-date)
-      (let* ((splits (xaccQueryGetSplitsUniqueTrans query))
-             (accounts (sort-and-delete-duplicates (map xaccSplitGetAccount splits)
-                                                   account<? equal?)))
+      (let* ((splits (xaccQueryGetSplitsUniqueTrans query)))
         (qof-query-destroy query)
 
         ;; loop into each APAR account
diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index c1feba326..957eda6dd 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -240,8 +240,6 @@
   (eqv? (xaccTransGetTxnType txn) TXN-TYPE-PAYMENT))
 (define (txn-is-link? txn)
   (eqv? (xaccTransGetTxnType txn) TXN-TYPE-LINK))
-(define (split<? a b)
-  (< (xaccSplitOrder a b) 0))
 (define (split-is-payment? split)
   (txn-is-payment? (xaccSplitGetParent split)))
 
diff --git a/gnucash/report/report-system/report-utilities.scm b/gnucash/report/report-system/report-utilities.scm
index 6c652ae9a..21b12e018 100644
--- a/gnucash/report/report-system/report-utilities.scm
+++ b/gnucash/report/report-system/report-utilities.scm
@@ -155,8 +155,7 @@ construct gnc:make-gnc-monetary and use gnc:monetary->string instead.")
 (define (gnc:accounts-and-all-descendants accountslist)
   (sort-and-delete-duplicates
    (apply append accountslist (map gnc-account-get-descendants accountslist))
-   (lambda (a b) (< (xaccAccountOrder a b) 0))
-   equal?))
+   gnc:account-path-less-p equal?))
 
 ;;; Here's a statistics collector...  Collects max, min, total, and makes
 ;;; it easy to get at the mean.
diff --git a/gnucash/report/standard-reports/test/test-balsheet-pnl.scm b/gnucash/report/standard-reports/test/test-balsheet-pnl.scm
index 46ab45516..65bb70967 100644
--- a/gnucash/report/standard-reports/test/test-balsheet-pnl.scm
+++ b/gnucash/report/standard-reports/test/test-balsheet-pnl.scm
@@ -273,10 +273,10 @@
     (set-option! balance-sheet-options "Display" "Parent account subtotals" 'f)
     (let ((sxml (options->sxml balance-sheet-uuid balance-sheet-options "balsheet-recursive")))
       (test-equal "recursive. root = $760+15000+104600"
-        '("#200.00" "$340.00" "$106,709.00" "$106,709.00" "30 FUNDS" "$15,000.00")
+        '("#200.00" "$340.00" "30 FUNDS" "$15,000.00" "$106,709.00" "$106,709.00")
         (sxml->table-row-col sxml 1 3 6))
       (test-equal "recursive. assets = $760+15000+104600"
-        '("#200.00" "$340.00" "$106,709.00" "$106,709.00" "30 FUNDS" "$15,000.00")
+        '("#200.00" "$340.00" "30 FUNDS" "$15,000.00" "$106,709.00" "$106,709.00")
         (sxml->table-row-col sxml 1 4 5))
       (test-equal "recursive. bank1 = $4,709.00"
         (list "$4,709.00")
@@ -294,7 +294,7 @@
         (list "$100.00")
         (sxml->table-row-col sxml 1 9 3))
       (test-equal "recursive. broker = $15000+2000.00"
-        '("$2,000.00" "$2,000.00" "30 FUNDS" "$15,000.00")
+        '("30 FUNDS" "$15,000.00" "$2,000.00" "$2,000.00")
         (sxml->table-row-col sxml 1 10 4))
       (test-equal "recursive. funds = $15,000.00"
         (list "30 FUNDS" "$15,000.00" "$15,000.00")
@@ -326,7 +326,7 @@
     (set-option! balance-sheet-options "Commodities" "Show Exchange Rates" #t)
     (let ((sxml (options->sxml balance-sheet-uuid balance-sheet-options "balsheet-enable show-fcur show-rates")))
       (test-equal "show-fcur enabled"
-        '("#200.00" "$340.00" "$106,709.00" "$106,709.00" "30 FUNDS" "$15,000.00")
+        '("#200.00" "$340.00" "30 FUNDS" "$15,000.00" "$106,709.00" "$106,709.00")
         (sxml->table-row-col sxml 1 3 6))
       (test-equal "show-rates enabled"
         '("#1.00" "$1.70" "1 FUNDS" "$500.00")



Summary of changes:
 gnucash/report/business-reports/new-aging.scm              | 7 +------
 gnucash/report/business-reports/new-owner-report.scm       | 2 --
 gnucash/report/report-system/report-utilities.scm          | 3 +--
 gnucash/report/standard-reports/test/test-balsheet-pnl.scm | 8 ++++----
 4 files changed, 6 insertions(+), 14 deletions(-)



More information about the gnucash-changes mailing list