From b2390c772e642d4069665d006d4f2cd88fe3248c Mon Sep 17 00:00:00 2001 From: Derek Atkins Date: Mon, 24 Jan 2005 04:33:29 +0000 Subject: [PATCH] Properly accumulate splits (bug #165053). * src/business/business-core/gncInvoice.c: Properly accumulate splits (bug #165053). Also fixes a (related) memory leak (caused by the same lack-of-reference to accumulated splits). git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@10424 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 6 ++++++ src/business/business-core/gncInvoice.c | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a698a8d65..1e67e91168 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-01-23 Derek Atkins + + * src/business/business-core/gncInvoice.c: Properly accumulate + splits (bug #165053). Also fixes a (related) memory leak + (caused by the same lack-of-reference to accumulated splits). + 2005-01-16 Christian Stimming * src/app-utils/gnc-ui-util.c: Modify tax option code to load diff --git a/src/business/business-core/gncInvoice.c b/src/business/business-core/gncInvoice.c index 3ab24483aa..0224120c88 100644 --- a/src/business/business-core/gncInvoice.c +++ b/src/business/business-core/gncInvoice.c @@ -855,23 +855,23 @@ Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc, if (this_acc) { if (gnc_numeric_check (value) == GNC_ERROR_OK) { if (accumulatesplits) { - gncAccountValueAdd (splitinfo, this_acc, value); + splitinfo = gncAccountValueAdd (splitinfo, this_acc, value); } else { - Split *split; + Split *split; - split = xaccMallocSplit (invoice->inst.book); - /* set action and memo? */ + split = xaccMallocSplit (invoice->inst.book); + /* set action and memo? */ - xaccSplitSetMemo (split, gncEntryGetDescription (entry)); - xaccSplitSetAction (split, type); + xaccSplitSetMemo (split, gncEntryGetDescription (entry)); + xaccSplitSetAction (split, type); - xaccSplitSetBaseValue (split, (reverse ? gnc_numeric_neg (value) - : value), + xaccSplitSetBaseValue (split, (reverse ? gnc_numeric_neg (value) + : value), invoice->currency); - xaccAccountBeginEdit (this_acc); - xaccAccountInsertSplit (this_acc, split); - xaccAccountCommitEdit (this_acc); - xaccTransAppendSplit (txn, split); + xaccAccountBeginEdit (this_acc); + xaccAccountInsertSplit (this_acc, split); + xaccAccountCommitEdit (this_acc); + xaccTransAppendSplit (txn, split); } /* If there is a credit-card account, and this is a CCard