From b72cf9f7fa1a995acfb06940666cc6b41c033afe Mon Sep 17 00:00:00 2001 From: Joshua Sled Date: Sun, 25 Feb 2007 20:36:10 +0000 Subject: [PATCH] Bug#342206: evaluate the saved form of the report to get it added to the runtime environment; if the result of the eval is not a record (i.e., the report), then assume that the report has the same name as an existing report, and don't write it to the saved reports file. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15662 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/report/report-system/report.scm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/report/report-system/report.scm b/src/report/report-system/report.scm index e18c0219e1..0cff014f04 100644 --- a/src/report/report-system/report.scm +++ b/src/report/report-system/report.scm @@ -395,11 +395,18 @@ (gnc-build-dotgnucash-path "saved-reports-2.0")) (define (gnc:report-save-to-savefile report) - (let ((conf-file-name gnc:current-saved-reports)) - ;;(display conf-file-name) - (display (gnc:report-generate-saved-forms report) - (open-file conf-file-name "a")) - (force-output))) + (let* ((conf-file-name gnc:current-saved-reports) + (saved-form (gnc:report-generate-saved-forms report)) + ;; Immediate evaluate the saved form to both load it into the + ;; runtime, but also so we can check if it's "allowed" to actually + ;; be written to the saved reports file by inspecting the result. + ;; #Bug#342206. + (save-result (eval-string saved-form))) + (if (record? save-result) + (begin + (display saved-form + (open-file conf-file-name "a")) + (force-output))))) ;; gets the renderer from the report template; ;; gets the stylesheet from the report;