mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
modifications to deal with new engine
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@779 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
7c9818f75e
commit
58cbff5b7c
34
src/Ledger.c
34
src/Ledger.c
@ -56,16 +56,13 @@ LedgerDestroy (BasicRegister *reg)
|
|||||||
/* be sure to destroy the "blank split" */
|
/* be sure to destroy the "blank split" */
|
||||||
if (reg->user_hook) {
|
if (reg->user_hook) {
|
||||||
Split *split;
|
Split *split;
|
||||||
Transaction * trans;
|
|
||||||
Account * acc;
|
Account * acc;
|
||||||
|
|
||||||
split = (Split *) (reg->user_hook);
|
split = (Split *) (reg->user_hook);
|
||||||
|
|
||||||
acc = xaccSplitGetAccount (split);
|
acc = xaccSplitGetAccount (split);
|
||||||
xaccAccountRemoveSplit (acc, split);
|
xaccAccountRemoveSplit (acc, split);
|
||||||
|
xaccSplitDestroy (split);
|
||||||
trans = xaccSplitGetParent (split);
|
|
||||||
xaccFreeTransaction (trans);
|
|
||||||
reg->user_hook = NULL;
|
reg->user_hook = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,25 +90,24 @@ GetOtherAccName (Split *split)
|
|||||||
{
|
{
|
||||||
Account *acc = NULL;
|
Account *acc = NULL;
|
||||||
Transaction *trans;
|
Transaction *trans;
|
||||||
|
Split *s, *other_split;
|
||||||
|
int numsplits;
|
||||||
|
|
||||||
trans = xaccSplitGetParent (split);
|
trans = xaccSplitGetParent (split);
|
||||||
|
|
||||||
if (0 == xaccTransIsSource (trans, split)) {
|
numsplits = xaccTransCountSplits (trans);
|
||||||
Split *split = xaccTransGetSourceSplit (trans);
|
if (2 < numsplits) return SPLIT_STR;
|
||||||
acc = xaccSplitGetAccount (split);
|
|
||||||
} else {
|
|
||||||
Split *split = xaccTransGetDestSplit (trans, 0);
|
|
||||||
if (NULL != split) {
|
|
||||||
Split *nother_split = xaccTransGetDestSplit (trans, 1);
|
|
||||||
|
|
||||||
/* if only one split, then use that */
|
s = xaccTransGetSplit (trans, 0);
|
||||||
if (NULL == nother_split) {
|
if (s == split) {
|
||||||
acc = xaccSplitGetAccount (split);
|
other_split = xaccTransGetSplit (trans, 1);
|
||||||
} else {
|
} else {
|
||||||
return SPLIT_STR;
|
other_split = s;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
acc = xaccSplitGetAccount (other_split);
|
||||||
if (acc) return xaccAccountGetName (acc);
|
if (acc) return xaccAccountGetName (acc);
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,7 +337,7 @@ printf ("load reg of %d entries --------------------------- \n",i);
|
|||||||
} else {
|
} else {
|
||||||
trans = xaccMallocTransaction ();
|
trans = xaccMallocTransaction ();
|
||||||
xaccTransSetDateToday (trans);
|
xaccTransSetDateToday (trans);
|
||||||
split = xaccTransGetSourceSplit (trans);
|
split = xaccTransGetSplit (trans, 0);
|
||||||
xaccAccountInsertSplit (default_source_acc, split);
|
xaccAccountInsertSplit (default_source_acc, split);
|
||||||
reg->user_hook = (void *) split;
|
reg->user_hook = (void *) split;
|
||||||
reg->destroy = LedgerDestroy;
|
reg->destroy = LedgerDestroy;
|
||||||
|
Loading…
Reference in New Issue
Block a user