gnucash maint: Bug726449 - Budget Barchart does not show up if running sum is selected
Geert Janssens
gjanssens at code.gnucash.org
Mon Apr 21 06:05:38 EDT 2014
Updated via https://github.com/Gnucash/gnucash/commit/5baa87bf (commit)
from https://github.com/Gnucash/gnucash/commit/52c07a54 (commit)
commit 5baa87bf4efd03f9deab22987767bdbfb90ee96e
Author: Carsten Rinke <carsten.rinke at gmx.de>
Date: Mon Apr 7 20:24:11 2014 +0200
Bug726449 - Budget Barchart does not show up if running sum is selected
diff --git a/src/report/report-system/html-barchart.scm b/src/report/report-system/html-barchart.scm
index 59a493b..f751e6a 100644
--- a/src/report/report-system/html-barchart.scm
+++ b/src/report/report-system/html-barchart.scm
@@ -135,6 +135,24 @@
(define gnc:html-barchart-subtitle
(record-accessor <html-barchart> 'subtitle))
+;; Note: Due to Bug726449 the input string's non-printable control
+;; characters must translated to HTML format tags BEFORE
+;; or WHEN calling this function.
+;; AND:
+;; To ensure that the generated subtitle doesn't contain any
+;; unescaped quotes or backslashes, all strings must be freed
+;; from those by calling jqplot-escape-string.
+;; Otherwise we're opening the gates again for bug 721768.
+;;
+;; Example: "\n" must be translated to "<br /> to introduce
+;; a line break into the chart subtitle.
+;;
+;; Example call:
+;; (gnc:html-barchart-set-subtitle! chart
+;; (string-append "Bgt:"
+;; (jqplot-escape-string (number->string bgt-sum))
+;; "<br /> Act:" ;; line break in the chart sub-title
+;; (jqplot-escape-string (number->string act-sum))))
(define gnc:html-barchart-set-subtitle!
(record-modifier <html-barchart> 'subtitle))
@@ -452,9 +470,9 @@
(if subtitle
(begin
- (push " options.title += \" (")
- (push (jqplot-escape-string subtitle))
- (push ")\";\n")))
+ (push " options.title += \" <br />")
+ (push subtitle)
+ (push "\";\n")))
(if (and (string? x-label) (> (string-length x-label) 0))
(begin
diff --git a/src/report/standard-reports/budget-barchart.scm b/src/report/standard-reports/budget-barchart.scm
index 8ea06c4..ccc1372 100644
--- a/src/report/standard-reports/budget-barchart.scm
+++ b/src/report/standard-reports/budget-barchart.scm
@@ -34,6 +34,10 @@
(gnc:module-load "gnucash/report/report-system" 0)
+;; included since Bug726449
+(use-modules (ice-9 regex)) ;; for regexp-substitute/global, used by jpqplot
+(load-from-path "html-jqplot.scm") ;; for jqplot-escape-string
+
(define reportname (N_ "Budget Barchart"))
(define optname-accounts (N_ "Accounts"))
@@ -153,7 +157,10 @@
(gnc:html-barchart-set-row-labels! chart date-list)
(if running-sum
(gnc:html-barchart-set-subtitle! chart
- (string-append "Bgt:" (number->string bgt-sum) "\n Act:" (number->string act-sum))))
+ (string-append "Bgt:"
+ (jqplot-escape-string (number->string bgt-sum))
+ "<br /> Act:"
+ (jqplot-escape-string (number->string act-sum)))))
)
;; Reutrn newly created chart
diff --git a/src/report/standard-reports/category-barchart.scm b/src/report/standard-reports/category-barchart.scm
index 6dcd795..567593e 100644
--- a/src/report/standard-reports/category-barchart.scm
+++ b/src/report/standard-reports/category-barchart.scm
@@ -35,6 +35,10 @@
(gnc:module-load "gnucash/report/report-system" 0)
+;; included since Bug726449
+(use-modules (ice-9 regex)) ;; for regexp-substitute/global, used by jpqplot
+(load-from-path "html-jqplot.scm") ;; for jqplot-escape-string
+
;; The option names are defined here to 1. save typing and 2. avoid
;; spelling errors. The *reportnames* are defined here (and not only
;; once at the very end) because I need them to define the "other"
@@ -454,8 +458,8 @@ developing over time"))
(if do-intervals?
(_ "%s to %s")
(_ "Balances %s to %s"))
- (gnc-print-date from-date-tp)
- (gnc-print-date to-date-tp)))
+ (jqplot-escape-string (gnc-print-date from-date-tp))
+ (jqplot-escape-string (gnc-print-date to-date-tp))))
(gnc:html-barchart-set-width! chart width)
(gnc:html-barchart-set-height! chart height)
diff --git a/src/report/standard-reports/net-barchart.scm b/src/report/standard-reports/net-barchart.scm
index 9ee3f7d..2b3693b 100644
--- a/src/report/standard-reports/net-barchart.scm
+++ b/src/report/standard-reports/net-barchart.scm
@@ -37,6 +37,10 @@
(gnc:module-load "gnucash/report/report-system" 0)
+;; included since Bug726449
+(use-modules (ice-9 regex)) ;; for regexp-substitute/global, used by jpqplot
+(load-from-path "html-jqplot.scm") ;; for jqplot-escape-string
+
(define reportname (N_ "Income/Expense Chart"))
(define optname-from-date (N_ "Start Date"))
@@ -313,8 +317,8 @@
(gnc:html-barchart-set-subtitle!
chart (sprintf #f
(_ "%s to %s")
- (gnc-print-date from-date-tp)
- (gnc-print-date to-date-tp)))
+ (jqplot-escape-string (gnc-print-date from-date-tp))
+ (jqplot-escape-string (gnc-print-date to-date-tp))))
(gnc:html-barchart-set-width! chart width)
(gnc:html-barchart-set-height! chart height)
(gnc:html-barchart-set-row-labels! chart date-string-list)
diff --git a/src/report/utility-reports/test-graphing.scm b/src/report/utility-reports/test-graphing.scm
index 4bee477..4b01b69 100644
--- a/src/report/utility-reports/test-graphing.scm
+++ b/src/report/utility-reports/test-graphing.scm
@@ -31,7 +31,7 @@
(let ((chart (gnc:make-html-barchart))
(text (gnc:make-html-text (gnc:html-markup-p "[bar goes here]"))))
(gnc:html-barchart-set-title! chart "Bar Chart Title")
- (gnc:html-barchart-set-subtitle! chart "Bar Chart SubTitle")
+ (gnc:html-barchart-set-subtitle! chart (jqplot-escape-string "Bar Chart SubTitle"))
(gnc:html-barchart-append-row! chart '(25 45 30))
(gnc:html-barchart-append-row! chart '(75 55 70))
(gnc:html-barchart-set-width! chart 320)
Summary of changes:
src/report/report-system/html-barchart.scm | 24 ++++++++++++++++++++---
src/report/standard-reports/budget-barchart.scm | 9 ++++++++-
src/report/standard-reports/category-barchart.scm | 8 ++++++--
src/report/standard-reports/net-barchart.scm | 8 ++++++--
src/report/utility-reports/test-graphing.scm | 2 +-
5 files changed, 42 insertions(+), 9 deletions(-)
More information about the gnucash-changes
mailing list