r23069 - gnucash/trunk/src/report/report-system - Report system - emit warning when trying to restore named-based saved reports

Geert Janssens gjanssens at code.gnucash.org
Thu Jun 27 05:09:05 EDT 2013

Author: gjanssens
Date: 2013-06-27 05:09:04 -0400 (Thu, 27 Jun 2013)
New Revision: 23069
Trac: http://svn.gnucash.org/trac/changeset/23069

Report system - emit warning when trying to restore named-based saved reports

Modified: gnucash/trunk/src/report/report-system/report.scm
--- gnucash/trunk/src/report/report-system/report.scm	2013-06-27 09:08:52 UTC (rev 23068)
+++ gnucash/trunk/src/report/report-system/report.scm	2013-06-27 09:09:04 UTC (rev 23069)
@@ -721,14 +721,22 @@
            (set! template-id id))) *gnc:_report-templates_*)
+;; We want to warn users when we are trying to restore reports stored in the legacy
+;; format (based on name instead of guid), but only once
+(define gnc:old-style-restore-warned #f)
 ;; Legacy: this function is needed only to restore
 ;; a saved report when loading a book last saved in GnuCash 2.2
 (define (gnc:restore-report id template-name options)
   (if options
       (let ((r ((record-constructor <report>)
                 (gnc:report-template-name-to-id template-name) id options #t #t #f #f)))
-        (gnc-report-add r))
+           ;; Warn user (one time) we're attempting to restore old style reports
+           (if (not gnc:old-style-restore-warned)
+               (begin
+                 (set! gnc:old-style-restore-warned #t)
+                 (gnc-warning-dialog '() (string-append (_ "Some reports stored in a legacy format were found. This format is not supported anymore so these reports may not have been restored properly.")))))
+           (gnc-report-add r))
         (gnc-error-dialog '() (string-append "Report Failed! One of your previously opened reports has failed to open. The template on which it was based: " template-name ", was not found."))
-        #f))
-  )
+        #f)))

More information about the gnucash-changes mailing list