From 745afb94dd25458099a37462cc313bb412e21b5a Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Wed, 4 Sep 2013 12:55:49 +0000 Subject: [PATCH] Prevent 2.4 from crashing when loading a book that was opened with 2.6 before. The core issue is that open reports are using a new restore function in 2.6, which doesn't exist in 2.4 and older. The restore code now checks for the existence of this new function and falls back to the old one if necessary. The (mild) side effect is that in 2.4 any link to a custom template is lost. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23159 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/report/report-system/report.scm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/report/report-system/report.scm b/src/report/report-system/report.scm index beed4d6312..804846e125 100644 --- a/src/report/report-system/report.scm +++ b/src/report/report-system/report.scm @@ -525,12 +525,24 @@ #f "(let ((options (gnc:report-template-new-options/report-guid ~S ~S)))\n" (gnc:report-type report) (gnc:report-template-name (hash-ref *gnc:_report-templates_* (gnc:report-type report)))) (gnc:generate-restore-forms (gnc:report-options report) "options") + ;; 2.6->2.4 compatibility code prefix + ;; Temporary check to make the new report saving code more or less backwards + ;; compatible with older gnucash versions. This can be removed again in 2.8. + "(if (defined? 'gnc:restore-report-by-guid-with-custom-template)\n" + ;; end of 2.6->2.4 compatibility code prefix. (format - #f " (gnc:restore-report-by-guid-with-custom-template ~S ~S ~S ~S options))\n" + #f " (gnc:restore-report-by-guid-with-custom-template ~S ~S ~S ~S options)\n" (gnc:report-id report) (gnc:report-type report) (gnc:report-template-name (hash-ref *gnc:_report-templates_* (gnc:report-type report))) - (gnc:report-custom-template report) - ))) + (gnc:report-custom-template report)) + ;; 2.6->2.4 compatibility code suffix + (format + #f " (gnc:restore-report-by-guid ~S ~S ~S options))\n" + (gnc:report-id report) (gnc:report-type report) + (gnc:report-template-name (hash-ref *gnc:_report-templates_* (gnc:report-type report)))) + ;; end of 2.6->2.4 compatibility code suffix. + ")" + )) ;; Loop over embedded reports and concat result of each gnc:report-generate-restore-forms (define (gnc:report-generate-options-embedded report)