gnucash master: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Sun Jul 21 00:30:39 EDT 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/63f484c5 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/aa95d61c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/ae4b7e15 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/38b2d470 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/273ae720 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/fdeff65f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d0bf4ad8 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/ce6c3c22 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e88f31e0 (commit)
	from  https://github.com/Gnucash/gnucash/commit/35146008 (commit)



commit 63f484c555bb936f1ab3038bc4b8d7fe6ceb0d58
Merge: 351460084 aa95d61c6
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jul 20 21:13:54 2019 +0800

    Merge branch 'maint'

diff --cc gnucash/report/report.scm
index 367e9725b,8fd439e88..26ae87fcf
--- a/gnucash/report/report.scm
+++ b/gnucash/report/report.scm
@@@ -698,7 -686,10 +698,8 @@@
  (export gnc:account-get-type-string-plural)
  (export gnc:accounts-get-commodities)
  (export gnc:get-current-account-tree-depth)
+ (export gnc:accounts-and-all-descendants)
  (export gnc:acccounts-get-all-subaccounts)
 -(export gnc:make-stats-collector)       ;deprecated
 -(export gnc:make-drcr-collector)        ;deprecated
  (export gnc:make-value-collector)
  (export gnc:make-number-collector)      ;deprecated
  (export gnc:make-commodity-collector)
diff --cc gnucash/report/reports/example/daily-reports.scm
index 32692fcd5,c836fa39a..a60b6aaed
--- a/gnucash/report/reports/example/daily-reports.scm
+++ b/gnucash/report/reports/example/daily-reports.scm
@@@ -206,44 -209,31 +206,32 @@@
                                   (gnc:acccounts-get-all-subaccounts accounts)
                                   accounts)
                                  report-currency))
 -	  (gnc:report-percent-done 5)
 -	  (set! exchange-fn (gnc:case-exchange-time-fn 
 -                             price-source report-currency 
 +          (gnc:report-percent-done 5)
 +          (set! exchange-fn (gnc:case-exchange-time-fn
 +                             price-source report-currency
                               commodity-list to-date
 -			     5 20))
 -	  (gnc:report-percent-done 20)
 -          
 -          ;; initialize the query to find splits in the right 
 +                             5 20))
 +          (gnc:report-percent-done 20)
 +
 +          ;; initialize the query to find splits in the right
            ;; date range and accounts
            (qof-query-set-book query (gnc-get-current-book))
 -          
 -	  ;; for balance purposes, we don't need to do this, but it cleans up
 -	  ;; the table display.
 +
 +          ;; for balance purposes, we don't need to do this, but it cleans up
 +          ;; the table display.
            (gnc:query-set-match-non-voids-only! query (gnc-get-current-book))
 -          ;; add accounts to the query (include subaccounts 
 +          ;; add accounts to the query (include subaccounts
            ;; if requested)
 -	  (gnc:report-percent-done 25)
 +          (gnc:report-percent-done 25)
            (if dosubs?
-               (let ((subaccts '()))
-                 (for-each
-                  (lambda (acct)
-                    (let ((this-acct-subs
-                           (gnc-account-get-descendants-sorted acct)))
-                      (if (list? this-acct-subs)
-                          (set! subaccts
-                            (append subaccts this-acct-subs)))))
-                  accounts)
-                 ;; Beware: delete-duplicates is an O(n^2)
-                 ;; algorithm. More efficient method: sort the list,
-                 ;; then use a linear algorithm.
-                 (set! accounts
-                       (delete-duplicates (append accounts subaccts)))))
 -              (set! accounts
 -                (gnc:accounts-and-all-descendants accounts)))
 -	  (gnc:report-percent-done 30)
 -          
 -          (xaccQueryAddAccountMatch query accounts QOF-GUID-MATCH-ANY QOF-QUERY-AND)
 -          
 -          ;; match splits between start and end dates 
++               (set! accounts
++                 (gnc:accounts-and-all-descendants accounts)))
 +          (gnc:report-percent-done 30)
 +
 +          (xaccQueryAddAccountMatch
 +           query accounts QOF-GUID-MATCH-ANY QOF-QUERY-AND)
 +
 +          ;; match splits between start and end dates
            (xaccQueryAddDateMatchTT
             query #t from-date #t to-date QOF-QUERY-AND)
            (qof-query-set-sort-order query
diff --cc gnucash/report/test/test-report-utilities.scm
index 105c0ef8f,fd62cc8fc..cdba448e3
--- a/gnucash/report/test/test-report-utilities.scm
+++ b/gnucash/report/test/test-report-utilities.scm
@@@ -22,6 -22,8 +22,7 @@@
    (test-commodity-collector)
    (test-get-account-balances)
    (test-monetary-adders)
 -  (test-make-stats-collector)
+   (test-utility-functions)
    (test-end "report-utilities"))
  
  (define (NDayDelta t64 n)

commit aa95d61c6c3240b51a1896341e365d1af4362cfc
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jul 20 19:06:16 2019 +0800

    various reports: use more efficient report-utilities.scm functions
    
    instead of delete-duplicates

diff --git a/gnucash/report/business-reports/customer-summary.scm b/gnucash/report/business-reports/customer-summary.scm
index e92b594e8..2ba1f71b8 100644
--- a/gnucash/report/business-reports/customer-summary.scm
+++ b/gnucash/report/business-reports/customer-summary.scm
@@ -292,9 +292,7 @@
          (expense-accounts (opt-val pagename-expenseaccounts optname-expenseaccounts))
          (sales-accounts (opt-val pagename-incomeaccounts optname-incomeaccounts))
          (all-accounts (append sales-accounts expense-accounts))
-         (commodities (delete-duplicates
-                       (map xaccAccountGetCommodity all-accounts)
-                       gnc-commodity-equiv))
+         (commodities (gnc:accounts-get-commodities all-accounts #f))
          (commodities>1? (> (length commodities) 1))
          (book (gnc-get-current-book))
          (date-format (gnc:options-fancy-date book))
diff --git a/gnucash/report/standard-reports/balance-forecast.scm b/gnucash/report/standard-reports/balance-forecast.scm
index 2462c751a..aa0a2680f 100644
--- a/gnucash/report/standard-reports/balance-forecast.scm
+++ b/gnucash/report/standard-reports/balance-forecast.scm
@@ -167,8 +167,7 @@ date point, a projected minimum balance including scheduled transactions."))
           (accum (gnc:make-commodity-collector))
           (exchange-fn (gnc:case-exchange-time-fn
                         price currency
-                        (delete-duplicates! (map xaccAccountGetCommodity accounts)
-                                            gnc-commodity-equiv)
+                        (gnc:accounts-get-commodities accounts #f)
                         to-date #f #f))
           (accounts-balancelist
            (map
diff --git a/gnucash/report/standard-reports/balsheet-pnl.scm b/gnucash/report/standard-reports/balsheet-pnl.scm
index 2dbadf1eb..6ad0a19a6 100644
--- a/gnucash/report/standard-reports/balsheet-pnl.scm
+++ b/gnucash/report/standard-reports/balsheet-pnl.scm
@@ -802,12 +802,7 @@ also show overall period profit & loss."))
          ;; missing price, say so.
          (get-exchange-rates-fn
           (lambda (accounts col-idx)
-            (let ((commodities (delete
-                                common-currency
-                                (delete-duplicates
-                                 (map xaccAccountGetCommodity accounts)
-                                 gnc-commodity-equal)
-                                gnc-commodity-equal))
+            (let ((commodities (gnc:accounts-get-commodities accounts common-currency))
                   (cell (gnc:make-html-text)))
               (for-each
                (lambda (commodity)
diff --git a/gnucash/report/standard-reports/category-barchart.scm b/gnucash/report/standard-reports/category-barchart.scm
index 43ba7acb2..5de9ce386 100644
--- a/gnucash/report/standard-reports/category-barchart.scm
+++ b/gnucash/report/standard-reports/category-barchart.scm
@@ -375,8 +375,7 @@ developing over time"))
                                 (xaccSplitGetAmount s))))))))
              ;; all selected accounts (of report-specific type), *and*
              ;; their descendants (of any type) need to be scanned.
-             (delete-duplicates
-              (append accounts (gnc:acccounts-get-all-subaccounts accounts)))))
+             (gnc:accounts-and-all-descendants accounts)))
 
           ;; Creates the <balance-list> to be used in the function
           ;; below.
diff --git a/gnucash/report/standard-reports/daily-reports.scm b/gnucash/report/standard-reports/daily-reports.scm
index 4e5203fb0..c836fa39a 100644
--- a/gnucash/report/standard-reports/daily-reports.scm
+++ b/gnucash/report/standard-reports/daily-reports.scm
@@ -226,21 +226,9 @@
           ;; add accounts to the query (include subaccounts 
           ;; if requested)
 	  (gnc:report-percent-done 25)
-          (if dosubs? 
-              (let ((subaccts '()))
-                (for-each 
-                 (lambda (acct)
-                   (let ((this-acct-subs 
-                          (gnc-account-get-descendants-sorted acct)))
-                     (if (list? this-acct-subs)
-                         (set! subaccts 
-                               (append subaccts this-acct-subs)))))
-                 accounts)
-                ;; Beware: delete-duplicates is an O(n^2)
-                ;; algorithm. More efficient method: sort the list,
-                ;; then use a linear algorithm.
-                (set! accounts
-                      (delete-duplicates (append accounts subaccts)))))
+          (if dosubs?
+              (set! accounts
+                (gnc:accounts-and-all-descendants accounts)))
 	  (gnc:report-percent-done 30)
           
           (xaccQueryAddAccountMatch query accounts QOF-GUID-MATCH-ANY QOF-QUERY-AND)

commit ae4b7e15822e12103df56aa83cd1503a2007c033
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jul 20 19:17:56 2019 +0800

    [report-utilities][API] gnc:accounts-and-all-descendants
    
    return a list of accounts and their descendant accounts

diff --git a/gnucash/report/report-system/report-system.scm b/gnucash/report/report-system/report-system.scm
index ed4f2a0d8..8fd439e88 100644
--- a/gnucash/report/report-system/report-system.scm
+++ b/gnucash/report/report-system/report-system.scm
@@ -686,6 +686,7 @@
 (export gnc:account-get-type-string-plural)
 (export gnc:accounts-get-commodities)
 (export gnc:get-current-account-tree-depth)
+(export gnc:accounts-and-all-descendants)
 (export gnc:acccounts-get-all-subaccounts)
 (export gnc:make-stats-collector)       ;deprecated
 (export gnc:make-drcr-collector)        ;deprecated
diff --git a/gnucash/report/report-system/report-utilities.scm b/gnucash/report/report-system/report-utilities.scm
index bb886ac27..3d5e140b8 100644
--- a/gnucash/report/report-system/report-utilities.scm
+++ b/gnucash/report/report-system/report-utilities.scm
@@ -149,6 +149,15 @@ construct gnc:make-gnc-monetary and use gnc:monetary->string instead.")
   (append-map gnc-account-get-descendants-sorted
               accountlist))
 
+;; Return accountslist *and* their descendant accounts
+(define (gnc:accounts-and-all-descendants accountslist)
+  (sort-and-delete-duplicates
+   (append accountslist
+           (gnc:acccounts-get-all-subaccounts accountslist))
+   (lambda (a b)
+     (string<? (gnc-account-get-full-name a) (gnc-account-get-full-name b)))
+   equal?))
+
 ;;; Here's a statistics collector...  Collects max, min, total, and makes
 ;;; it easy to get at the mean.
 
diff --git a/gnucash/report/report-system/test/test-report-utilities.scm b/gnucash/report/report-system/test/test-report-utilities.scm
index cf3544719..fd62cc8fc 100644
--- a/gnucash/report/report-system/test/test-report-utilities.scm
+++ b/gnucash/report/report-system/test/test-report-utilities.scm
@@ -511,6 +511,15 @@
        (list (account-lookup "Expenses")
              (account-lookup "GBP Bank"))))
 
+    (test-equal "gnc:accounts-and-all-descendants"
+      (list (account-lookup "GBP Bank")
+            (account-lookup "GBP Savings")
+            (account-lookup "Expenses")
+            (account-lookup "Fuel"))
+      (gnc:accounts-and-all-descendants
+       (list (account-lookup "Expenses")
+             (account-lookup "GBP Bank"))))
+
     (teardown)))
 
 (define (test-monetary-adders)

commit 38b2d4708b6b102036dfcdbdbe082286c83098e8
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jul 20 19:05:41 2019 +0800

    [report-utilities] gnc:accounts-get-commodities more efficient
    
    more efficient function

diff --git a/gnucash/report/report-system/report-utilities.scm b/gnucash/report/report-system/report-utilities.scm
index 66f6e18f8..bb886ac27 100644
--- a/gnucash/report/report-system/report-utilities.scm
+++ b/gnucash/report/report-system/report-utilities.scm
@@ -129,11 +129,12 @@ construct gnc:make-gnc-monetary and use gnc:monetary->string instead.")
 ;; 'accounts', excluding the 'exclude-commodity'.
 (define (gnc:accounts-get-commodities accounts exclude-commodity)
   (delete exclude-commodity
-	  (delete-duplicates
-	   (sort (map xaccAccountGetCommodity accounts)
-		 (lambda (a b) 
-		   (string<? (or (gnc-commodity-get-mnemonic a) "")
-			     (or (gnc-commodity-get-mnemonic b) "")))))))
+	  (sort-and-delete-duplicates
+           (map xaccAccountGetCommodity accounts)
+           (lambda (a b)
+	     (string<? (gnc-commodity-get-mnemonic a)
+                       (gnc-commodity-get-mnemonic b)))
+           gnc-commodity-equiv)))
 
 
 ;; Returns the depth of the current account hierarchy, that is, the
diff --git a/gnucash/report/report-system/test/test-report-utilities.scm b/gnucash/report/report-system/test/test-report-utilities.scm
index a017eb358..cf3544719 100644
--- a/gnucash/report/report-system/test/test-report-utilities.scm
+++ b/gnucash/report/report-system/test/test-report-utilities.scm
@@ -23,6 +23,7 @@
   (test-get-account-balances)
   (test-monetary-adders)
   (test-make-stats-collector)
+  (test-utility-functions)
   (test-end "report-utilities"))
 
 (define (NDayDelta t64 n)
@@ -251,7 +252,8 @@
         (list "Income" (list (cons 'type ACCT-TYPE-INCOME)))
         (list "Income-GBP" (list (cons 'type ACCT-TYPE-INCOME)
                                  (cons 'commodity (mnemonic->commodity "GBP"))))
-        (list "Expenses" (list (cons 'type ACCT-TYPE-EXPENSE)))
+        (list "Expenses" (list (cons 'type ACCT-TYPE-EXPENSE))
+              (list "Fuel"))
         (list "Liabilities" (list (cons 'type ACCT-TYPE-LIABILITY)))
         (list "Equity" (list (cons 'type ACCT-TYPE-EQUITY)))
         ))
@@ -482,6 +484,35 @@
            (gnc:get-assoc-account-balances-total account-balances)))))
     (teardown)))
 
+(define (test-utility-functions)
+
+  (define (account-lookup str)
+    (gnc-account-lookup-by-name
+     (gnc-book-get-root-account (gnc-get-current-book))
+     str))
+
+  (test-group-with-cleanup "utility functions"
+    (create-test-data)
+    (test-equal "gnc:accounts-get-commodities"
+      (list "GBP" "USD")
+      (map gnc-commodity-get-mnemonic
+           (gnc:accounts-get-commodities (gnc-account-get-descendants-sorted
+                                          (gnc-get-current-root-account))
+                                         #f)))
+
+    (test-equal "gnc:get-current-account-tree-depth"
+      5
+      (gnc:get-current-account-tree-depth))
+
+    (test-equal "gnc:acccounts-get-all-subaccounts"
+      (list (account-lookup "Fuel")
+            (account-lookup "GBP Savings"))
+      (gnc:acccounts-get-all-subaccounts
+       (list (account-lookup "Expenses")
+             (account-lookup "GBP Bank"))))
+
+    (teardown)))
+
 (define (test-monetary-adders)
   (define (monetary->pair mon)
     (let ((comm (gnc:gnc-monetary-commodity mon))

commit 273ae720ccaeddc60deb11a1fab42418838f2cd2
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jul 20 18:21:20 2019 +0800

    [scm-utilities][API] add sort-and-delete-duplicates
    
    this can be used instead of delete-duplicates when the list must also
    be sorted.
    
    the main reason for this function will be for the upcoming aging.scm
    report which will use it heavily to slice APAR splits into owner list.

diff --git a/libgnucash/scm/test/test-libgnucash-scm-utilities.scm b/libgnucash/scm/test/test-libgnucash-scm-utilities.scm
index b5db94b24..a2e0d4d24 100644
--- a/libgnucash/scm/test/test-libgnucash-scm-utilities.scm
+++ b/libgnucash/scm/test/test-libgnucash-scm-utilities.scm
@@ -9,6 +9,7 @@
   (test-begin "test-libgnucash-scm-utilities.scm")
   (test-traverse-vec)
   (test-substring-replace)
+  (test-sort-and-delete-duplicates)
   (test-begin "test-libgnucash-scm-utilities.scm"))
 
 (define (test-traverse-vec)
@@ -61,3 +62,28 @@
      "foo" "xxx" 4 -1))
 
   (test-end "substring-replace"))
+
+(define (test-sort-and-delete-duplicates)
+  (test-begin "sort-and-delete-duplicates")
+  (test-equal "sort-and-delete-duplicates empty"
+    '()
+    (sort-and-delete-duplicates '() <))
+  (test-equal "sort-and-delete-duplicates 1-element"
+    '(1)
+    (sort-and-delete-duplicates '(1) <))
+  (test-equal "sort-and-delete-duplicates 2-element, equal"
+    '(1)
+    (sort-and-delete-duplicates '(1 1) <))
+  (test-equal "sort-and-delete-duplicates 2-element, unequal"
+    '(1 2)
+    (sort-and-delete-duplicates '(2 1) <))
+  (test-equal "sort-and-delete-duplicates 3-element, equal"
+    '(1)
+    (sort-and-delete-duplicates '(1 1 1) <))
+  (test-equal "sort-and-delete-duplicates 3-element, 2-equal"
+    '(1 2)
+    (sort-and-delete-duplicates '(1 2 1) <))
+  (test-equal "sort-and-delete-duplicates 3-element, unequal"
+    '(1 2 3)
+    (sort-and-delete-duplicates '(3 1 2) <))
+  (test-end "sort-and-delete-duplicates"))
diff --git a/libgnucash/scm/utilities.scm b/libgnucash/scm/utilities.scm
index 4e3af3fdc..83a0ab139 100644
--- a/libgnucash/scm/utilities.scm
+++ b/libgnucash/scm/utilities.scm
@@ -46,6 +46,7 @@
 (export gnc:msg)
 (export gnc:debug)
 (export addto!)
+(export sort-and-delete-duplicates)
 
 ;; Do this stuff very early -- but other than that, don't add any
 ;; executable code until the end of the file if you can help it.
@@ -179,3 +180,17 @@
     (lambda args
       (gnc:warn "strftime may be buggy. use gnc-print-time64 instead.")
       (apply strftime-old args))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; a basic sort-and-delete-duplicates. because delete-duplicates
+;; usually run in O(N^2) and if the list must be sorted, it's more
+;; efficient to sort first then delete adjacent elements. guile-2.0
+;; uses quicksort internally.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(define* (sort-and-delete-duplicates lst < #:optional (= =))
+  (let lp ((lst (sort lst <)) (result '()))
+    (cond
+     ((null? lst) '())
+     ((null? (cdr lst)) (reverse (cons (car lst) result)))
+     ((= (car lst) (cadr lst)) (lp (cdr lst) result))
+     (else (lp (cdr lst) (cons (car lst) result))))))

commit fdeff65f067469d542069066792b8e2c096629dd
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Jul 19 02:00:20 2019 +0800

    [business-core] refactor & document gnc:owner-from-split
    
    This function helps to establish UI link from register split to an
    owner's split. It should not be used anywhere else. Its use in reports
    will be removed.
    
    It is also unnecessarily complex -- it is called from an AP/AR account
    register split, it should have all necessary information via split
    metadata. e.g. this function *can* return a split owner if originating
    from an Asset/Liability account which settles an invoice, but this
    functionality is not used because there is no asset/liability register
    hook to call it.

diff --git a/libgnucash/engine/business-core.scm b/libgnucash/engine/business-core.scm
index f20d39044..be8724384 100644
--- a/libgnucash/engine/business-core.scm
+++ b/libgnucash/engine/business-core.scm
@@ -19,6 +19,7 @@
 
 (define-module (gnucash business-core))
 (use-modules (gnucash gnc-module))
+(use-modules (srfi srfi-1))
 (gnc:module-load "gnucash/engine" 0)
 
 (define (gnc:owner-get-address owner)
@@ -99,39 +100,29 @@
   (let ((type type-val))
     (equal? type GNC-AMT-TYPE-PERCENT)))
 
+;; this function aims to find a split's owner. various splits are
+;; supported: (1) any splits in the invoice posted transaction, in
+;; APAR or income/expense accounts (2) any splits from invoice's
+;; payments, in APAR or asset/liability accounts. it returns either
+;; the owner or '() if not found. in addition, if owner was found, the
+;; result-owner argument is mutated to it.
 (define (gnc:owner-from-split split result-owner)
+  (define (notnull x) (and (not (null? x)) x))
   (let* ((trans (xaccSplitGetParent split))
-	 (invoice (gncInvoiceGetInvoiceFromTxn trans))
-	 (temp-owner (gncOwnerNew))
-	 (owner '()))
-
-    (if (not (null? invoice))
-	(set! owner (gncInvoiceGetOwner invoice))
-	(let ((split-list (xaccTransGetSplitList trans)))
-	  (define (check-splits splits)
-	    (if (and splits (not (null? splits)))
-		(let* ((split (car splits))
-		       (lot (xaccSplitGetLot split)))
-		  (if (not (null? lot))
-		      (let* ((invoice (gncInvoiceGetInvoiceFromLot lot))
-			     (owner? (gncOwnerGetOwnerFromLot
-				      lot temp-owner)))
-			(if (not (null? invoice))
-			    (set! owner (gncInvoiceGetOwner invoice))
-			    (if owner?
-				(set! owner temp-owner)
-				(check-splits (cdr splits)))))
-		      (check-splits (cdr splits))))))
-	  (check-splits split-list)))
-
-    (if (not (null? owner))
-	(begin
-	  (gncOwnerCopy (gncOwnerGetEndOwner owner) result-owner)
-	  (gncOwnerFree temp-owner)
-	  result-owner)
-	(begin
-	  (gncOwnerFree temp-owner)
-	  '()))))
+	 (invoice (notnull (gncInvoiceGetInvoiceFromTxn trans)))
+	 (temp (gncOwnerNew))
+	 (owner (or (and invoice (gncInvoiceGetOwner invoice))
+                    (any
+                     (lambda (split)
+                       (let* ((lot (xaccSplitGetLot split))
+                              (invoice (notnull (gncInvoiceGetInvoiceFromLot lot))))
+                         (or (and invoice (gncInvoiceGetOwner invoice))
+                             (and (gncOwnerGetOwnerFromLot lot temp) temp))))
+                     (xaccTransGetSplitList trans)))))
+    (gncOwnerFree temp)
+    (cond (owner (gncOwnerCopy (gncOwnerGetEndOwner owner) result-owner)
+                 result-owner)
+          (else  '()))))
 
 
 (export gnc:owner-get-address)

commit d0bf4ad8aeaa6a4f2e2645d20b50d1ffd922c8f1
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jul 20 20:10:00 2019 +0800

    [test-business-core] add to dist_list

diff --git a/libgnucash/engine/test/CMakeLists.txt b/libgnucash/engine/test/CMakeLists.txt
index abeb38b3d..1f84c4d6c 100644
--- a/libgnucash/engine/test/CMakeLists.txt
+++ b/libgnucash/engine/test/CMakeLists.txt
@@ -323,6 +323,7 @@ set(test_engine_SCHEME_DIST
         test-extras.scm
         test-scm-query-import.scm
         test-split.scm
+        test-business-core.scm
 )
 
 set(test_engine_EXTRA_DIST

commit ce6c3c22a15102341ca41ddba2a46ea7daf63f17
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jul 20 20:32:07 2019 +0800

    Fix CMakeLists error
    
    need to include module

diff --git a/gnucash/register/register-gnome/CMakeLists.txt b/gnucash/register/register-gnome/CMakeLists.txt
index acfdd89f3..f3527484b 100644
--- a/gnucash/register/register-gnome/CMakeLists.txt
+++ b/gnucash/register/register-gnome/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_subdirectory(test)
+include(CheckSymbolExists)
 
 #GTK before 3.14 didn't have GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK
 check_symbol_exists(GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK gdk/gdktypes.h have_mod_mask)

commit e88f31e05cd57ba6fcc07563d98fb55c5310d25d
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Jul 19 21:20:43 2019 -0700

    Bug 784623 - GNUCash does not work with sql backend, I can open...
    
    in read only mode
    
    Upgrade the splits table as well, an oversight from the original fix.

diff --git a/libgnucash/backend/sql/gnc-transaction-sql.cpp b/libgnucash/backend/sql/gnc-transaction-sql.cpp
index fce7f6c5c..47e4c615c 100644
--- a/libgnucash/backend/sql/gnc-transaction-sql.cpp
+++ b/libgnucash/backend/sql/gnc-transaction-sql.cpp
@@ -70,7 +70,7 @@ static QofLogModule log_module = G_LOG_DOMAIN;
 #define TRANSACTION_TABLE "transactions"
 #define TX_TABLE_VERSION 4
 #define SPLIT_TABLE "splits"
-#define SPLIT_TABLE_VERSION 4
+#define SPLIT_TABLE_VERSION 5
 
 struct split_info_t : public write_objects_t
 {
@@ -456,7 +456,9 @@ GncSqlSplitBackend::create_tables (GncSqlBackend* sql_be)
 
         /* Upgrade:
            1->2: 64 bit int handling
-           3->4: Split reconcile date can be NULL */
+           3->4: Split reconcile date can be NULL
+           4->5: Use DATETIME instead of TIMESTAMP in MySQL
+        */
         sql_be->upgrade_table(m_table_name.c_str(), split_col_table);
         if (!sql_be->create_index("splits_tx_guid_index",
                                    m_table_name.c_str(),



Summary of changes:
 gnucash/register/register-gnome/CMakeLists.txt     |  1 +
 gnucash/report/report-utilities.scm                | 20 ++++++--
 gnucash/report/report.scm                          |  1 +
 gnucash/report/reports/example/daily-reports.scm   | 16 +------
 .../report/reports/standard/balance-forecast.scm   |  3 +-
 gnucash/report/reports/standard/balsheet-pnl.scm   |  7 +--
 .../report/reports/standard/category-barchart.scm  |  3 +-
 .../report/reports/standard/customer-summary.scm   |  4 +-
 gnucash/report/test/test-report-utilities.scm      | 42 ++++++++++++++++-
 libgnucash/backend/sql/gnc-transaction-sql.cpp     |  6 ++-
 libgnucash/engine/business-core.scm                | 53 +++++++++-------------
 .../scm/test/test-libgnucash-scm-utilities.scm     | 26 +++++++++++
 libgnucash/scm/utilities.scm                       | 15 ++++++
 13 files changed, 131 insertions(+), 66 deletions(-)



More information about the gnucash-changes mailing list