gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Wed Sep 4 12:02:09 EDT 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/af238ee4 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e386a2a7 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/2ac8cb2f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d0d6a824 (commit)
	from  https://github.com/Gnucash/gnucash/commit/78d4d60b (commit)



commit af238ee4708013828b5ebe5592c6b4cd2719c21d
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Wed Sep 4 22:25:37 2019 +0800

    [income-gst-statement] fix "tax payable" reuse existing string

diff --git a/gnucash/report/standard-reports/income-gst-statement.scm b/gnucash/report/standard-reports/income-gst-statement.scm
index bd37cd1b6..0b79d1f00 100644
--- a/gnucash/report/standard-reports/income-gst-statement.scm
+++ b/gnucash/report/standard-reports/income-gst-statement.scm
@@ -267,7 +267,7 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
          '())
      (if (opt-val gnc:pagename-display (N_ "Tax payable"))
          ;; Translators: "Tax Payable" refer to the difference GST Sales - GST Purchases
-         (list (vector (_ "Tax Payable")
+         (list (vector (_ "Tax payable")
                        tax-payable
                        #f #t #f
                        (lambda (a) "")))

commit e386a2a77d83dd219afc08a5a191baa927ff5538
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Sep 1 13:37:08 2019 +0800

    [report-utilities] deprecate gnc:acccounts-get-all-subaccounts
    
    * this function has a typo in name
    * all uses of accounts-get-all-subaccounts were followed by appending
    the result to the original accounts list. we have already rewritten to
    use the better function in previous commit. this is now obsolete.
    * inline its last use, omit sorting. list is sorted anyway afterwards.

diff --git a/gnucash/report/report-system/report-system.scm b/gnucash/report/report-system/report-system.scm
index 68da72afe..33c2229b2 100644
--- a/gnucash/report/report-system/report-system.scm
+++ b/gnucash/report/report-system/report-system.scm
@@ -687,7 +687,7 @@
 (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:acccounts-get-all-subaccounts) ;deprecated
 (export gnc:make-stats-collector)       ;deprecated
 (export gnc:make-drcr-collector)        ;deprecated
 (export gnc:make-value-collector)
diff --git a/gnucash/report/report-system/report-utilities.scm b/gnucash/report/report-system/report-utilities.scm
index ef6050bbe..75cc9979b 100644
--- a/gnucash/report/report-system/report-utilities.scm
+++ b/gnucash/report/report-system/report-utilities.scm
@@ -146,14 +146,14 @@ construct gnc:make-gnc-monetary and use gnc:monetary->string instead.")
 
 ;; Get all children of this list of accounts.
 (define (gnc:acccounts-get-all-subaccounts accountlist)
+  (issue-deprecation-warning "gnc:acccounts-get-all-subaccounts is unused.")
   (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))
+   (apply append accountslist (map gnc-account-get-descendants accountslist))
    (lambda (a b)
      (string<? (gnc-account-get-full-name a) (gnc-account-get-full-name b)))
    equal?))

commit 2ac8cb2f79bdff1e2f811b37e635d388c6f297f1
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Tue Sep 3 07:06:05 2019 +0800

    [reports] use more efficient gnc:accounts-and-all-descendants
    
    All uses of gnc:acccounts-get-all-subaccounts were immediately
    followed by appending the result to the original accounts list. Use
    gnc:accounts-and-all-descendants instead which is more efficient.

diff --git a/gnucash/report/standard-reports/average-balance.scm b/gnucash/report/standard-reports/average-balance.scm
index e0308299e..07d239065 100644
--- a/gnucash/report/standard-reports/average-balance.scm
+++ b/gnucash/report/standard-reports/average-balance.scm
@@ -293,11 +293,9 @@
          (internal-included (not (get-option gnc:pagename-accounts optname-internal)))
          (accounts   (get-option gnc:pagename-accounts (N_ "Accounts")))
          (dosubs?    (get-option gnc:pagename-accounts optname-subacct))
-         (accounts (append accounts
-                           (if dosubs?
-                               (filter (lambda (acc) (not (member acc accounts)))
-                                       (gnc:acccounts-get-all-subaccounts accounts))
-                               '())))
+         (accounts (if dosubs?
+                       (gnc:accounts-and-all-descendants accounts)
+                       accounts))
          (plot-type  (get-option gnc:pagename-display (N_ "Plot Type")))
          (show-plot? (get-option gnc:pagename-display (N_ "Show plot")))
          (show-table? (get-option gnc:pagename-display (N_ "Show table")))
diff --git a/gnucash/report/standard-reports/budget.scm b/gnucash/report/standard-reports/budget.scm
index e09c3124f..16fcbe1a8 100644
--- a/gnucash/report/standard-reports/budget.scm
+++ b/gnucash/report/standard-reports/budget.scm
@@ -638,11 +638,9 @@
                                        (get-option gnc:pagename-general
                                                    optname-period-collapse-after)))
          (doc (gnc:make-html-document))
-         (accounts (append accounts
-                           (filter (lambda (acc) (not (member acc accounts)))
-                                   (if show-subaccts?
-                                       (gnc:acccounts-get-all-subaccounts accounts)
-                                       '())))))
+         (accounts (if show-subaccts?
+                       (gnc:accounts-and-all-descendants accounts)
+                       accounts)))
     ;; end of defines
 
     (cond
diff --git a/gnucash/report/standard-reports/cash-flow.scm b/gnucash/report/standard-reports/cash-flow.scm
index fd61a006d..9a35699d2 100644
--- a/gnucash/report/standard-reports/cash-flow.scm
+++ b/gnucash/report/standard-reports/cash-flow.scm
@@ -156,11 +156,9 @@
          (table (gnc:make-html-table))
 
          ;;add subaccounts if requested
-         (accounts (append accounts
-                           (filter (lambda (acc) (not (member acc accounts)))
-                                   (if show-subaccts?
-                                       (gnc:acccounts-get-all-subaccounts accounts)
-                                       '()))))
+         (accounts (if show-subaccts?
+                       (gnc:accounts-and-all-descendants accounts)
+                       accounts))
          (accounts (sort accounts account-full-name<?)))
 
     (define (add-accounts-flow accounts accounts-alist)
diff --git a/gnucash/report/standard-reports/category-barchart.scm b/gnucash/report/standard-reports/category-barchart.scm
index 5de9ce386..0da882b7d 100644
--- a/gnucash/report/standard-reports/category-barchart.scm
+++ b/gnucash/report/standard-reports/category-barchart.scm
@@ -471,9 +471,7 @@ developing over time"))
           ;; needed so as to amortize the cpu time properly.
           (gnc:report-percent-done 1)
           (set! commodity-list (gnc:accounts-get-commodities
-                                (append
-                                 (gnc:acccounts-get-all-subaccounts accounts)
-                                 accounts)
+                                (gnc:accounts-and-all-descendants accounts)
                                 report-currency))
           (set! exchange-fn (gnc:case-exchange-time-fn
                              price-source report-currency
diff --git a/gnucash/report/standard-reports/daily-reports.scm b/gnucash/report/standard-reports/daily-reports.scm
index c836fa39a..c00cc3b74 100644
--- a/gnucash/report/standard-reports/daily-reports.scm
+++ b/gnucash/report/standard-reports/daily-reports.scm
@@ -204,10 +204,8 @@
           ;; lookup should be distributed and done when actually
           ;; needed so as to amortize the cpu time properly.
 	  (gnc:report-percent-done 1)
-	  (set! commodity-list (gnc:accounts-get-commodities 
-                                (append 
-                                 (gnc:acccounts-get-all-subaccounts accounts)
-                                 accounts)
+	  (set! commodity-list (gnc:accounts-get-commodities
+                                (gnc:accounts-and-all-descendants accounts)
                                 report-currency))
 	  (gnc:report-percent-done 5)
 	  (set! exchange-fn (gnc:case-exchange-time-fn 
diff --git a/gnucash/report/standard-reports/net-charts.scm b/gnucash/report/standard-reports/net-charts.scm
index 8defa587e..d7574a233 100644
--- a/gnucash/report/standard-reports/net-charts.scm
+++ b/gnucash/report/standard-reports/net-charts.scm
@@ -317,9 +317,7 @@
 
     (gnc:report-percent-done 1)
     (set! commodity-list (gnc:accounts-get-commodities
-                          (append
-                           (gnc:acccounts-get-all-subaccounts accounts)
-                           accounts)
+                          (gnc:accounts-and-all-descendants accounts)
                           report-currency))
     (gnc:report-percent-done 10)
     (set! exchange-fn (gnc:case-exchange-time-fn
diff --git a/gnucash/report/standard-reports/portfolio.scm b/gnucash/report/standard-reports/portfolio.scm
index 95f1df272..7e985eb3c 100644
--- a/gnucash/report/standard-reports/portfolio.scm
+++ b/gnucash/report/standard-reports/portfolio.scm
@@ -195,9 +195,8 @@
     ;(gnc:debug "accounts" accounts)
     (if (not (null? accounts))
         (let* ((commodity-list (gnc:accounts-get-commodities
-                                (append
-                                 (gnc:acccounts-get-all-subaccounts
-                                  accounts) accounts) currency))
+                                (gnc:accounts-and-all-descendants accounts)
+                                report-currency))
                (pricedb (gnc-pricedb-get-db (gnc-get-current-book)))
 	       (exchange-fn (gnc:case-exchange-fn price-source currency to-date))
                (price-fn

commit d0d6a824f4a6f1e425304939935e45edca4d36c6
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Sep 1 14:04:17 2019 +0800

    [reports] remove dead code - terse-period? always true

diff --git a/gnucash/report/standard-reports/equity-statement.scm b/gnucash/report/standard-reports/equity-statement.scm
index 2309be610..f4837c581 100644
--- a/gnucash/report/standard-reports/equity-statement.scm
+++ b/gnucash/report/standard-reports/equity-statement.scm
@@ -357,14 +357,7 @@
 		(lambda (account)
 		  (gnc:account-get-comm-balance-at-date 
 		   account end-date #f)))
-	       (terse-period? #t)
-	       (period-for (if terse-period?
-			       (string-append " " (_ "for Period"))
-			       (format #f (string-append ", " (_ "~a to ~a"))
-					(qof-print-date start-date-printable)
-					(qof-print-date end-date))
-			       ))
-	       )
+	       (period-for (string-append " " (_ "for Period"))))
 	  
 	  ;; a helper to add a line to our report
 	  (define (report-line
diff --git a/gnucash/report/standard-reports/income-statement.scm b/gnucash/report/standard-reports/income-statement.scm
index 412b1d6a4..c86bf5aa6 100644
--- a/gnucash/report/standard-reports/income-statement.scm
+++ b/gnucash/report/standard-reports/income-statement.scm
@@ -467,16 +467,8 @@
                (revenue-table #f)                  ;; gnc:html-acct-table
                (expense-table #f)                  ;; gnc:html-acct-table
                (trading-table #f)
-	       
-	       (terse-period? #t)
-	       (period-for (if terse-period?
-			       (string-append " " (_ "for Period"))
-			       (format #f (string-append ", " (_ "~a to ~a"))
-					(qof-print-date start-date-printable)
-					(qof-print-date end-date))
-			       )
-			   )
-	       )
+
+               (period-for (string-append " " (_ "for Period"))))
 	  
 	  ;; a helper to add a line to our report
 	  (define (report-line
diff --git a/gnucash/report/standard-reports/trial-balance.scm b/gnucash/report/standard-reports/trial-balance.scm
index 397c6259c..4694f3b1b 100644
--- a/gnucash/report/standard-reports/trial-balance.scm
+++ b/gnucash/report/standard-reports/trial-balance.scm
@@ -476,14 +476,7 @@
          ;; exchange rates calculation parameters
 	 (exchange-fn
 	  (gnc:case-exchange-fn price-source report-commodity end-date))
-	 (terse-period? #t)
-	 (period-for (if terse-period?
-			 (string-append " " (_ "for Period"))
-			 (format #f (string-append ", " (_ "~a to ~a"))
-				  (qof-print-date start-date-printable)
-				  (qof-print-date end-date))
-			 ))
-	 )
+	 (period-for (string-append " " (_ "for Period"))))
     
     (gnc:html-document-set-title! 
      doc (if (equal? report-variant 'current)



Summary of changes:
 gnucash/report/report-system/report-system.scm           |  2 +-
 gnucash/report/report-system/report-utilities.scm        |  4 ++--
 gnucash/report/standard-reports/average-balance.scm      |  8 +++-----
 gnucash/report/standard-reports/budget.scm               |  8 +++-----
 gnucash/report/standard-reports/cash-flow.scm            |  8 +++-----
 gnucash/report/standard-reports/category-barchart.scm    |  4 +---
 gnucash/report/standard-reports/daily-reports.scm        |  6 ++----
 gnucash/report/standard-reports/equity-statement.scm     |  9 +--------
 gnucash/report/standard-reports/income-gst-statement.scm |  2 +-
 gnucash/report/standard-reports/income-statement.scm     | 12 ++----------
 gnucash/report/standard-reports/net-charts.scm           |  4 +---
 gnucash/report/standard-reports/portfolio.scm            |  5 ++---
 gnucash/report/standard-reports/trial-balance.scm        |  9 +--------
 13 files changed, 23 insertions(+), 58 deletions(-)



More information about the gnucash-changes mailing list