From 408f77d8b8a266fba3fbffdd3c0294d1ac3a0a86 Mon Sep 17 00:00:00 2001 From: Derek Atkins Date: Sun, 30 Jan 2005 22:45:25 +0000 Subject: [PATCH] * src/engine/Account.c: - updated implementation of qofAccountSetParent(). git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@10443 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 3 +++ src/engine/Account.c | 22 ++++++++-------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index b11d63bf32..87c5764c5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,9 @@ compatible with QSF: using false instead of FALSE in string output and using the QSF_XSD_TIME for the datestrings. + * src/engine/Account.c: + - updated implementation of qofAccountSetParent(). + 2005-01-29 Derek Atkins David Montenegro's patch for bugs #95551, #124367. diff --git a/src/engine/Account.c b/src/engine/Account.c index 185f6fea25..b69ffc5f0e 100644 --- a/src/engine/Account.c +++ b/src/engine/Account.c @@ -1258,23 +1258,17 @@ xaccAccountSetDescription (Account *acc, const char *str) static void qofAccountSetParent (Account *acc, QofEntity *parent) { - AccountGroup *ag; - if((!acc)||(!parent)) return; - if(acc->parent) return; + Account *parent_acc; + + if((!acc)||(!parent)) { return; } + parent_acc = (Account*)parent; xaccAccountBeginEdit(acc); - g_message("qofAccountSetParent start"); - ag = xaccAccountGetParent((Account*)parent); - acc->parent = ag; -/* FIXME: acc->parent is type AccountGroup but AccountGroup is not a true QOF object -so can't set AccountGroup in the target book because the GUID of any new AccountGroups -is not found. Workaround uses Account as the reference type. - */ - if(!acc->parent) { - g_message("qofAccountSetParent failed."); - } + xaccAccountBeginEdit(parent_acc); + xaccAccountInsertSubAccount(parent_acc, acc); + mark_account (parent_acc); mark_account (acc); - acc->inst.dirty = TRUE; xaccAccountCommitEdit(acc); + xaccAccountCommitEdit(parent_acc); } void