Don't load a custom report that has the same name as a standard

report.  Fixes #168250.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13877 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton
2006-04-29 07:27:45 +00:00
parent 599d37402b
commit 2932ad7c5a
2 changed files with 14 additions and 2 deletions

View File

@@ -1,5 +1,8 @@
2006-04-29 David Hampton <hampton@employees.org>
* src/report/report-system/report.scm: Don't load a custom report
that has the same name as a standard report. Fixes #168250.
* src/bin/gnucash-bin.c: Load the user config earlier in startup.
Fixes the missing custom report problem #338668.

View File

@@ -92,14 +92,23 @@
(let ((report-rec (args-to-defn #f args)))
(if (and report-rec
(gnc:report-template-name report-rec))
(hash-set! *gnc:_report-templates_*
(gnc:report-template-name report-rec) report-rec)
(let* ((name (gnc:report-template-name report-rec))
(tmpl (hash-ref *gnc:_report-templates_* name)))
(if (not tmpl)
(hash-set! *gnc:_report-templates_*
(gnc:report-template-name report-rec) report-rec)
(begin
(gnc:error (_ "Refusing to add custom report with the same name as an existing report."))
(gnc:error (_ "Please edit your saved-reports file and delete the section for: ") name)
)))
(gnc:warn "gnc:define-report: bad report"))))
(define gnc:report-template-version
(record-accessor <report-template> 'version))
(define gnc:report-template-name
(record-accessor <report-template> 'name))
(define gnc:report-template-set-name
(record-modifier <report-template> 'name))
(define gnc:report-template-options-generator
(record-accessor <report-template> 'options-generator))
(define gnc:report-template-options-cleanup-cb