After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 569735 - Don't create a new nested template root account when a file is opened
Don't create a new nested template root account when a file is opened
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Scheduled Transactions
git-master
Other All
: Normal normal
: ---
Assigned To: Josh Sled
Josh Sled
Depends on:
Blocks: backport
 
 
Reported: 2009-01-29 21:56 UTC by Mike Alexander
Modified: 2018-06-29 22:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to avoid creating nested root accounts (1.19 KB, patch)
2009-01-29 22:02 UTC, Mike Alexander
committed Details | Review
Script to fix GnuCash XML files affected by this issue (4.43 KB, text/x-python)
2014-04-26 22:44 UTC, Simon Arlott
  Details

Description Mike Alexander 2009-01-29 21:56:34 UTC
Whenever an XML file is opened, Gnucash creates a new template root account and makes the old one a child of it.  My main accounts file had them nested over 540 deep before I got annoyed enough to fix this.  The problem is that sxtg_book_begin creates a root account when the book is opened.  Then add_template_transaction_local tries to replace this new root account with the one read from the file.  However the code that does this is rather badly broken and the result is that the one read from the file becomes a child of the one created in sxtg_book_begin.
Comment 1 Mike Alexander 2009-01-29 22:02:37 UTC
Created attachment 127497 [details] [review]
Patch to avoid creating nested root accounts

This patch avoids creating any more nested root accounts, but it doesn't get rid of the ones that are already there.  This is slightly more tricky than just deleting them since, although most of them have no children (other than the next root account), some do.  Accounts created for template transactions will be children of whatever root account happens to be at the top of the tree then.  As the file is saved and reopened, this will get pushed down into the tree of accounts.  In my case about 5 of the 540 or so root accounts had other children.
Comment 2 Christian Stimming 2009-01-31 19:50:45 UTC
trunk, r17868
Comment 3 Andreas Köhler 2009-02-15 17:51:17 UTC
branches, r17922.
Thanks a lot, Mike!
Comment 4 Simon Arlott 2014-04-26 22:44:15 UTC
Created attachment 275240 [details]
Script to fix GnuCash XML files affected by this issue
Comment 5 John Ralls 2018-06-29 22:17:01 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=569735. Please update any external references or bookmarks.