GNOME Bugzilla – Bug 447339
custom reports with similar names misbehaving
Last modified: 2018-06-29 21:39:00 UTC
[<http://lists.gnucash.org/pipermail/gnucash-user/2007-June/020606.html>:] On Mon, 28 May 2007 19:27:39 +0100 "Maf. King" wrote: > On Monday 28 May 2007, Phil Groschwitz wrote: [...] > > However, in Gnucash when I select Reports->Custom only the last > > report in the saved-reports-2.0 file is listed. And it is listed > > as many times as there are separate reports defined in > > saved-reports-2.0. > > > > For example, I have 3 saved reports: Jan_PNL, Feb_PNL, and Mar_PNL. > > They're all in saved-reports-2.0. On the Custom menu, Mar_PNL is > > listed 3 times. [...] > I saw something very similar to this a while back with several custom > reports which were named similarly. > > IIRC, the problem seemed to be caused by GC trying to allocate an > ATL+? key combo in the menu, and changing various report titles > around fixed it for me (eg, try Jan_PNL, Feb_PNL, Mar_ProfNLoss) [...] Thanks for this tip! Yes, after naming them differently they showed up. I was naming them very similarly - I was actually naming them with the year like 2007-JanPnL, 2007-FebPnL, etc. I got rid of the year and spelled out the month and they now show up on the menu.
I saw this behavior come in and out as I was working on report-guid. I think it's possible that report-guid could (though it does not yet) help with this issue. That assumes that it's *not* caused by the Alt+<key> stuff, but is instead because of the fact that the reports were referred to by name.
I see this in 2.2.9. It seems to be that report names which only differ in numerical characters compare as the same for some purpose at least. So that if ~/.gnucash/saved-reports-2.0 file has menu entries (the actual report name doesn't matter) "Transactions 07/08" "Transactions 08/09" The custom menu entries you see are duplicated: "Transactions 07/08" "Transactions 07/08" And there is no way through the gui to see the "Transactions 08/09" report. If you edit the ~/.gnucash/saved-reports-2.0 file to change the "07/08" to "seven/eight" etc. Then everything works. (gnc:define-report 'version 1 'name "Transactions seven/eight" 'options-generator options-gen 'menu-path (list gnc:menuname-custom) 'renderer (gnc:report-template-renderer/name "Transaction Report"))) This is very annoying because reports whose titles differ in the year only are a common thing to want to do and it is a pain (and ugly) to have to enter numbers in alphabetic form. Maybe I could go for the chinese astological calendar and call it "Year of the Pig" etc!
I've just experienced the same problem. And the same annoyance of wanting to name reports by year.
I just checked in a change in r18534 that should help with this problem. Reports should show up so long as they all have unique names considering only alphanumeric characters. Before they had to be unique considering only alphabetic characters. I've been running with this change in my copy of GnuCash for years and it hasn't caused any noticeable problems. It's a trivial change and could easily be backported to an earlier version of GnuCash.
On top of Mike's change, I have implemented Andrew's suggestion to refer to reports internally based on their report-guid instead of their name. (See commit r19337). I have tested this with report names like 2007+Something 2007-Something Before my commit, this results in duplicate reports, after my commit, the two reports are unique.
I forgot to mention this fix will first appear in the unstable GnuCash release 2.3.15, which will eventually lead up to a stable 2.4. I expect it will be a couple of months before that release comes out. I don't know when Debian will then eventually package it... If that will be too far in the future, you can indeed already rebuild gnucash with Mike's trivial patch (see http://svn.gnucash.org/trac/changeset/18534 for the change). It will resolve 99% of the problems. My additional patch is only required if two report names only differ in punctuation and whitespace. For completeness, I'll add that in the 2.2.x series, I can't reproduce the problem with report names like Jan_Trans, Feb_Trans, Mar_Trans as described in the original post. There is a side effect with the _ character though: it is interpreted by Gtk in menu names to assign an Alt modifier to the menu item, but it doesn't cause the same menu to appear three times. If you don't want the Alt modifier, it's best to avoid the _ character in report names. In the unstable series, the custom reports are no longer in a submenu. Instead they are opened via a dialog box and no Alt combinations are assigned anymore.
*** Bug 461468 has been marked as a duplicate of this bug. ***
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=447339. Please update any external references or bookmarks.