gnucash maint: [budget.scm] fix report crash on books with unreversed budgets

Christopher Lam clam at code.gnucash.org
Wed Aug 5 11:30:53 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/f9286ac8 (commit)
	from  https://github.com/Gnucash/gnucash/commit/7df7e383 (commit)



commit f9286ac8f4715986a8c02023426487aab8131d92
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Wed Aug 5 23:26:05 2020 +0800

    [budget.scm] fix report crash on books with unreversed budgets
    
    there was bug in budget.scm whereby budget report would crash with
    unreversed-budget featured book. the 'note' argument was missing when
    calling disp-cols.

diff --git a/gnucash/report/reports/standard/budget.scm b/gnucash/report/reports/standard/budget.scm
index 43d6faee6..8a7e7942e 100644
--- a/gnucash/report/reports/standard/budget.scm
+++ b/gnucash/report/reports/standard/budget.scm
@@ -412,7 +412,7 @@
            ((null? column-list)
             #f)
 
-           ;; fwd-compatibility: the next cond may be removed in master
+           ;; fwd-compatibility for unreversed budgets
            ((and (eq? (car column-list) 'total) unreversed?)
             (let* ((bgt-total (maybe-negate
                                (gnc:get-account-periodlist-budget-value
@@ -423,7 +423,7 @@
                    (dif-total (- bgt-total act-total)))
               (loop (cdr column-list)
                     (disp-cols "total-number-cell" current-col
-                               bgt-total act-total dif-total))))
+                               bgt-total act-total dif-total #f))))
 
            ((eq? (car column-list) 'total)
             (let* ((bgt-total (gnc:get-account-periodlist-budget-value
@@ -438,12 +438,15 @@
                     (disp-cols "total-number-cell" current-col
                                bgt-total act-total dif-total #f))))
 
-           ;; fwd-compatibility: the next cond may be removed in master
+           ;; fwd-compatibility for unreversed budgets
            (unreversed?
             (let* ((period-list (cond
                                  ((list? (car column-list)) (car column-list))
                                  (accumulate? (iota (1+ (car column-list))))
                                  (else (list (car column-list)))))
+                   (note (and (= 1 (length period-list))
+                              (gnc-budget-get-account-period-note
+                               budget acct (car period-list))))
                    (bgt-val (maybe-negate
                              (gnc:get-account-periodlist-budget-value
                               budget acct period-list)))
@@ -453,7 +456,7 @@
                    (dif-val (- bgt-val act-val)))
               (loop (cdr column-list)
                     (disp-cols "number-cell" current-col
-                               bgt-val act-val dif-val))))
+                               bgt-val act-val dif-val note))))
 
            (else
             (let* ((period-list (cond



Summary of changes:
 gnucash/report/reports/standard/budget.scm | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)



More information about the gnucash-changes mailing list