Addendum to fd3ec14f6 optionally raises descendants' editlevel

This commit is contained in:
Christopher Lam 2022-01-01 13:24:48 +08:00
parent 43d4c4a6a3
commit 778cabb8d2

View File

@ -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);