mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Save and restore root account to SQL dbs
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18240 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
6356b0dcbf
commit
f9822bd334
@ -167,9 +167,10 @@ load_single_account( GncSqlBackend* be, GncSqlRow* row,
|
||||
gnc_sql_load_object( be, row, GNC_ID_ACCOUNT, pAccount, col_table );
|
||||
xaccAccountCommitEdit( pAccount );
|
||||
|
||||
/* If we don't have a parent, it might be because the parent account hasn't
|
||||
been loaded yet. Remember the account and its parent guid for later. */
|
||||
if( gnc_account_get_parent( pAccount ) == NULL ) {
|
||||
/* If we don't have a parent and this isn't the root account, it might be because the parent
|
||||
account hasn't been loaded yet. Remember the account and its parent guid for later. */
|
||||
if( gnc_account_get_parent( pAccount ) == NULL
|
||||
&& pAccount != gnc_book_get_root_account( be->primary_book ) ) {
|
||||
account_parent_guid_struct* s = g_malloc( (gsize)sizeof(account_parent_guid_struct) );
|
||||
g_assert( s != NULL );
|
||||
|
||||
|
@ -267,12 +267,16 @@ write_account_tree( GncSqlBackend* be, Account* root )
|
||||
g_return_val_if_fail( be != NULL, FALSE );
|
||||
g_return_val_if_fail( root != NULL, FALSE );
|
||||
|
||||
is_ok = gnc_sql_save_account( be, QOF_INSTANCE(root) );
|
||||
if( is_ok ) {
|
||||
descendants = gnc_account_get_descendants( root );
|
||||
for( node = descendants; node != NULL && is_ok; node = g_list_next(node) ) {
|
||||
is_ok = gnc_sql_save_account( be, QOF_INSTANCE(GNC_ACCOUNT(node->data)) );
|
||||
if( !is_ok ) break;
|
||||
update_save_progress( be );
|
||||
}
|
||||
g_list_free( descendants );
|
||||
}
|
||||
|
||||
return is_ok;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user