gnucash maint: [balsheet-pnl] test "lvl <= depth-limit" outside add-indented-row
Christopher Lam
clam at code.gnucash.org
Tue Apr 26 21:39:55 EDT 2022
Updated via https://github.com/Gnucash/gnucash/commit/7f316b8b (commit)
from https://github.com/Gnucash/gnucash/commit/e381e706 (commit)
commit 7f316b8bdd1e511eef7d654a0169031c12a9b651
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Apr 24 16:20:07 2022 +0800
[balsheet-pnl] test "lvl <= depth-limit" outside add-indented-row
this will be the first step trying to fix bug 798502. the bug likely
resides in the (if) conditional in (add-account-row).
diff --git a/gnucash/report/reports/standard/balsheet-pnl.scm b/gnucash/report/reports/standard/balsheet-pnl.scm
index 085b60a32..95672a900 100644
--- a/gnucash/report/reports/standard/balsheet-pnl.scm
+++ b/gnucash/report/reports/standard/balsheet-pnl.scm
@@ -382,28 +382,30 @@ also show overall period profit & loss."))
(define (make-narrow-cell)
(gnc:make-html-table-cell/min-width 1))
+ (define (show-depth? lvl)
+ (or (not depth-limit) (<= lvl depth-limit)))
+
(define (add-indented-row indent label label-markup row-markup amount-indent rest)
- (when (or (not depth-limit) (<= indent depth-limit))
- (let* ((account-cell (if label-markup
- (gnc:make-html-table-cell/size/markup
- 1 (if disable-account-indent? 1 (- maxindent indent))
- label-markup label)
- (gnc:make-html-table-cell/size
- 1 (if disable-account-indent? 1 (- maxindent indent))
- label)))
- (row (append
- (if disable-account-indent?
- '()
- (make-list-thunk indent make-narrow-cell))
- (list account-cell)
- (gnc:html-make-empty-cells
- (if amount-indenting? (1- amount-indent) 0))
- (if reverse-cols? (reverse rest) rest)
- (gnc:html-make-empty-cells
- (if amount-indenting? (- maxindent amount-indent) 0)))))
- (if row-markup
- (gnc:html-table-append-row/markup! table row-markup row)
- (gnc:html-table-append-row! table row)))))
+ (let* ((account-cell (if label-markup
+ (gnc:make-html-table-cell/size/markup
+ 1 (if disable-account-indent? 1 (- maxindent indent))
+ label-markup label)
+ (gnc:make-html-table-cell/size
+ 1 (if disable-account-indent? 1 (- maxindent indent))
+ label)))
+ (row (append
+ (if disable-account-indent?
+ '()
+ (make-list-thunk indent make-narrow-cell))
+ (list account-cell)
+ (gnc:html-make-empty-cells
+ (if amount-indenting? (1- amount-indent) 0))
+ (if reverse-cols? (reverse rest) rest)
+ (gnc:html-make-empty-cells
+ (if amount-indenting? (- maxindent amount-indent) 0)))))
+ (if row-markup
+ (gnc:html-table-append-row/markup! table row-markup row)
+ (gnc:html-table-append-row! table row))))
(define (monetary+ . monetaries)
;; usage: (monetary+ monetary...)
@@ -518,8 +520,9 @@ also show overall period profit & loss."))
((_ . tail) (lp1 tail))))))))
(define* (add-recursive-subtotal lvl lvl-acct #:key account-style-normal?)
- (if (or show-zb-accts?
- (is-not-zero? (account-and-descendants lvl-acct)))
+ (if (and (or show-zb-accts?
+ (is-not-zero? (account-and-descendants lvl-acct)))
+ (show-depth? lvl))
(add-indented-row lvl
(render-account lvl-acct (not account-style-normal?))
(if account-style-normal?
@@ -545,9 +548,10 @@ also show overall period profit & loss."))
(define* (add-account-row lvl-curr curr #:key
(override-show-zb-accts? #f)
(account-indent 0))
- (if (or show-zb-accts?
- override-show-zb-accts?
- (is-not-zero? (list curr)))
+ (if (and (or show-zb-accts?
+ override-show-zb-accts?
+ (is-not-zero? (list curr)))
+ (show-depth? lvl-curr))
(add-indented-row lvl-curr
(render-account curr #f)
"text-cell"
Summary of changes:
gnucash/report/reports/standard/balsheet-pnl.scm | 56 +++++++++++++-----------
1 file changed, 30 insertions(+), 26 deletions(-)
More information about the gnucash-changes
mailing list