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
This commit is contained in:
Geert Janssens 2013-09-04 12:55:49 +00:00
parent 6ee4202fca
commit 745afb94dd

View File

@ -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)