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.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18251 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Phil Longstaff 2009-08-15 21:08:39 +00:00
parent 5f6813ed1e
commit f4d7272312

View File

@ -284,9 +284,16 @@ write_account_tree( GncSqlBackend* be, Account* root )
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 @@ write_template_transactions( GncSqlBackend* be )
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;