gnucash maint: Bug 759005 - Print negatives in red, bis
Christopher Lam
clam at code.gnucash.org
Mon Oct 7 10:35:03 EDT 2019
Updated via https://github.com/Gnucash/gnucash/commit/a90b8749 (commit)
from https://github.com/Gnucash/gnucash/commit/2d996926 (commit)
commit a90b874995e2234da9e2d360e693fe48b8e11ece
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Oct 7 21:54:38 2019 +0800
Bug 759005 - Print negatives in red, bis
addendum to 9d0d3fd3b; addition to negative monetaries, also print
negative numbers in red
diff --git a/gnucash/report/report-system/html-table.scm b/gnucash/report/report-system/html-table.scm
index 636c04129..a54206897 100644
--- a/gnucash/report/report-system/html-table.scm
+++ b/gnucash/report/report-system/html-table.scm
@@ -141,17 +141,19 @@
(define (gnc:html-table-cell-render cell doc)
;; This function renders a html-table-cell to a document tree
- ;; segment. Note: if the html-table-cell datum is a negative
- ;; gnc:monetary, it fixes the tag eg. "number-cell" becomes
- ;; "number-cell-red". The gnc:monetary renderer does not have an
- ;; automatic -neg tag modifier. See bug 759005 and bug 797357.
+ ;; segment. Note: if the html-table-cell datum is a negative number
+ ;; or gnc:monetary, it fixes the tag eg. "number-cell" becomes
+ ;; "number-cell-red". The number and gnc:monetary renderers do not
+ ;; have an automatic -neg tag modifier. See bug 759005 and 797357.
(let* ((retval '())
(push (lambda (l) (set! retval (cons l retval))))
(cell-tag (gnc:html-table-cell-tag cell))
(cell-data (gnc:html-table-cell-data cell))
(tag (if (and (= 1 (length cell-data))
- (gnc:gnc-monetary? (car cell-data))
- (negative? (gnc:gnc-monetary-amount (car cell-data))))
+ (or (and (gnc:gnc-monetary? (car cell-data))
+ (negative? (gnc:gnc-monetary-amount (car cell-data))))
+ (and (number? (car cell-data))
+ (negative? (car cell-data)))))
(string-append cell-tag "-neg")
cell-tag)))
(gnc:html-document-push-style doc (gnc:html-table-cell-style cell))
Summary of changes:
gnucash/report/report-system/html-table.scm | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
More information about the gnucash-changes
mailing list