r18251 - gnucash/trunk/src/backend/sql - Ensure template root account is stored even if no scheduled transactions. Otherwise, when it
Phil Longstaff
plongstaff at code.gnucash.org
Sat Aug 15 17:08:40 EDT 2009
Author: plongstaff
Date: 2009-08-15 17:08:39 -0400 (Sat, 15 Aug 2009)
New Revision: 18251
Trac: http://svn.gnucash.org/trac/changeset/18251
Modified:
gnucash/trunk/src/backend/sql/gnc-backend-sql.c
Log:
Ensure template root account is stored even if no scheduled transactions. Otherwise, when it
comes time to store the template account before the root, the account has a dangling parent guid.
Modified: gnucash/trunk/src/backend/sql/gnc-backend-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-backend-sql.c 2009-08-15 19:02:27 UTC (rev 18250)
+++ gnucash/trunk/src/backend/sql/gnc-backend-sql.c 2009-08-15 21:08:39 UTC (rev 18251)
@@ -284,9 +284,16 @@
static gboolean
write_accounts( GncSqlBackend* be )
{
+ gboolean is_ok;
+
g_return_val_if_fail( be != NULL, FALSE );
- return write_account_tree( be, gnc_book_get_root_account( be->primary_book ) );
+ is_ok = write_account_tree( be, gnc_book_get_root_account( be->primary_book ) );
+ if( is_ok ) {
+ is_ok = write_account_tree( be, gnc_book_get_template_root( be->primary_book ) );
+ }
+
+ return is_ok;
}
static int
@@ -334,10 +341,7 @@
data.be = be;
ra = gnc_book_get_template_root( be->primary_book );
if( gnc_account_n_descendants( ra ) > 0 ) {
- data.is_ok = write_account_tree( be, ra );
- if( data.is_ok ) {
- (void)xaccAccountTreeForEachTransaction( ra, write_tx, &data );
- }
+ (void)xaccAccountTreeForEachTransaction( ra, write_tx, &data );
}
return data.is_ok;
More information about the gnucash-changes
mailing list