GNOME Bugzilla – Bug 342206
"Add Report" button permits adding multiple different reports under the same name.
Last modified: 2018-06-29 21:04:41 UTC
Please describe the problem: The "Add Report" button will accept and save multiple different reports under the same name. I am only seeing this problem if the colliding reports were created during the same session, i.e., they have not yet been saved or written out to saved-reports-2.0. When GnuCash restarts, only one of these reports is available via the Custom menu, although both reports are saved. Steps to reproduce: 1. Create a transaction report. 2. Edit the name to be "foo". 3. Create another transaction report, changing some options. 4. Edit the name to be "foo". 5. For each report foo, click the "Add Report" button. 6. Save and restart GnuCash. Actual results: Both reports will be added to saved-reports-2.0, both under the name foo. When gnucash reloads, it will complain: gnucash: [E] "Refusing to add custom report with the same name as an existing report." gnucash: [E] "Please edit your saved-reports file and delete the section for: ""foo" (Incidentally, I just noticed that there seems to be an extra double-quote in the error message.) The following is appended to my saved-reports-2.0: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Options for saved report "foo", based on template "Transaction Report" (let () (define (options-gen) (let ((options (gnc:report-template-new-options/name "Transaction Report"))) ; Section: Sorting ; Section: Display ; Section: Accounts ; Section: General (let ((option (gnc:lookup-option options "General" "Report name"))) ((lambda (option) (if option ((gnc:option-setter option) "foo"))) option)) options)) (gnc:define-report 'version 1 'name "foo" 'options-generator options-gen 'menu-path (list gnc:menuname-custom) 'renderer (gnc:report-template-renderer/name "Transaction Report"))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Options for saved report "foo", based on template "Transaction Report" (let () (define (options-gen) (let ((options (gnc:report-template-new-options/name "Transaction Report"))) ; Section: Sorting ; Section: Display ; Section: Accounts ; Section: General (let ((option (gnc:lookup-option options "General" "Report name"))) ((lambda (option) (if option ((gnc:option-setter option) "foo"))) option)) (let ((option (gnc:lookup-option options "General" "From"))) ((lambda (option) (if option ((gnc:option-setter option) '(relative . start-this-month)))) option)) options)) (gnc:define-report 'version 1 'name "foo" 'options-generator options-gen 'menu-path (list gnc:menuname-custom) 'renderer (gnc:report-template-renderer/name "Transaction Report"))) Expected results: The "Add Report" button should decline to add a report if there is already a report by that name. It should pop up a dialog asking the user to rename the report, or try adding it later after editing the name of the colliding report. Does this happen every time? Yes. Other information: I discovered this when I switched from 1.8 to 1.9.6. I had several transaction reports open at the time, and only some of them were saved. Some of my reports were lost, and in trying to figure out which ones were lost, I discovered this bug. I orignally thought that I lost my old reports when I first used the "Add Report" button, but I haven't yet been able to reproduce that. This may be related, though.
I guess this is related to the issue that a newly added report won't show up in the "Reports->Custom" menu, but it will show up only at the new program start. (I looked for an extra bugreport for that issue, but there doesn't seem to be any.) This bug here is probably fixed as soon as "Add report" will immediately add a report to the menu, not only at the next startup.
I'm seeing this bug in the 2.0.2 version as well. I'm also seing a problem with re-saving the same report. The report is not actually saved the second time. it should be updated.
r15662. The to-be-saved string form of the report is evaluted. If it's valid, then it's already added to the runtime environment, and we write it to the saved-reports file. If not, the user will see the error, we won't write it to the file again, and life will be incrementally better. Note, however, Bug#412016, for the fact that we don't add the relevant menu to any existing window.... ...but at least it's a little bit less broken. :(
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=342206. Please update any external references or bookmarks.