diff --git a/gnucash/gnome/window-reconcile.c b/gnucash/gnome/window-reconcile.c index bffe43cd90..a76b347bfc 100644 --- a/gnucash/gnome/window-reconcile.c +++ b/gnucash/gnome/window-reconcile.c @@ -2257,6 +2257,19 @@ find_payment_account(Account *account) return NULL; } +typedef void (*AccountProc) (Account *a); +static void traverse_fn (Account *acct, AccountProc fn) +{ + fn (acct); +} + +static void +acct_traverse_descendants (Account *acct, AccountProc fn) +{ + fn (acct); + if (xaccAccountGetReconcileChildrenStatus (acct)) + gnc_account_foreach_descendant (acct, (AccountCb)traverse_fn, fn); +} /********************************************************************\ * recnFinishCB * @@ -2288,10 +2301,10 @@ recnFinishCB (GtkAction *action, RecnWindow *recnData) recnData->delete_refresh = TRUE; account = recn_get_account (recnData); - xaccAccountBeginEdit (account); + acct_traverse_descendants (account, xaccAccountBeginEdit); gnc_reconcile_view_commit(GNC_RECONCILE_VIEW(recnData->credit), date); gnc_reconcile_view_commit(GNC_RECONCILE_VIEW(recnData->debit), date); - xaccAccountCommitEdit (account); + acct_traverse_descendants (account, xaccAccountCommitEdit); auto_payment = gnc_prefs_get_bool(GNC_PREFS_GROUP_RECONCILE, GNC_PREF_AUTO_CC_PAYMENT); @@ -2344,10 +2357,10 @@ recnPostponeCB (GtkAction *action, gpointer data) recnData->delete_refresh = TRUE; account = recn_get_account (recnData); - xaccAccountBeginEdit (account); + acct_traverse_descendants (account, xaccAccountBeginEdit); gnc_reconcile_view_postpone (GNC_RECONCILE_VIEW(recnData->credit)); gnc_reconcile_view_postpone (GNC_RECONCILE_VIEW(recnData->debit)); - xaccAccountCommitEdit (account); + acct_traverse_descendants (account, xaccAccountCommitEdit); xaccAccountSetReconcilePostponeDate (account, recnData->statement_date); xaccAccountSetReconcilePostponeBalance (account, recnData->new_ending);