r18102 - gnucash/trunk/src/report/report-system - Bug #584564: Patch by Chris Dennis to allow a report to be either a string or an html-doc

Phil Longstaff plongstaff at code.gnucash.org
Tue Jun 2 18:28:48 EDT 2009


Author: plongstaff
Date: 2009-06-02 18:28:48 -0400 (Tue, 02 Jun 2009)
New Revision: 18102
Trac: http://svn.gnucash.org/trac/changeset/18102

Modified:
   gnucash/trunk/src/report/report-system/report.scm
Log:
Bug #584564: Patch by Chris Dennis to allow a report to be either a string or an html-doc


Modified: gnucash/trunk/src/report/report-system/report.scm
===================================================================
--- gnucash/trunk/src/report/report-system/report.scm	2009-06-02 08:04:27 UTC (rev 18101)
+++ gnucash/trunk/src/report/report-system/report.scm	2009-06-02 22:28:48 UTC (rev 18102)
@@ -616,6 +616,8 @@
 ;; gets the stylesheet from the report;
 ;; renders the html doc and caches the resulting string;
 ;; returns the html string.
+;; Now accepts either an html-doc or finished HTML from the renderer -
+;; the former requires further processing, the latter is just returned.
 (define (gnc:report-render-html report headers?)
   (if (and (not (gnc:report-dirty? report))
            (gnc:report-ctext report))
@@ -633,8 +635,11 @@
                              (stylesheet (gnc:report-stylesheet report))
                              (doc (renderer report))
                              (html #f))
-                        (gnc:html-document-set-style-sheet! doc stylesheet)
-                        (set! html (gnc:html-document-render doc headers?))
+                        (if (string? doc)
+                          (set! html doc)
+                          (begin 
+                            (gnc:html-document-set-style-sheet! doc stylesheet)
+                            (set! html (gnc:html-document-render doc headers?))))
                         (gnc:report-set-ctext! report html) ;; cache the html
                         (gnc:report-set-dirty?! report #f)  ;; mark it clean
                         html)
@@ -677,4 +682,4 @@
      (begin
        (gnc:debug "Deleting report " report)
        (hash-remove! *gnc:_report-templates_* report)
-       (gnc:save-all-reports))))
\ No newline at end of file
+       (gnc:save-all-reports))))



More information about the gnucash-changes mailing list