mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
handle category sub-accounts
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@171 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
1f38e5434e
commit
243464af30
@ -485,6 +485,7 @@ xaccGetRootGroupOfAcct (Account *acc)
|
||||
|
||||
/* recursively walk up the tree of parents */
|
||||
grp = acc->parent;
|
||||
if (!grp) return NULL;
|
||||
acc = grp->parent;
|
||||
while (acc) {
|
||||
grp = acc->parent;
|
||||
|
29
src/QIFIO.c
29
src/QIFIO.c
@ -202,6 +202,7 @@ char * xaccReadQIFCatList (int fd, AccountGroup *grp)
|
||||
{
|
||||
char * qifline;
|
||||
Account *acc;
|
||||
char *str, *tok;
|
||||
|
||||
if (!grp) return 0x0;
|
||||
do {
|
||||
@ -217,10 +218,36 @@ char * xaccReadQIFCatList (int fd, AccountGroup *grp)
|
||||
freeAccount(acc);
|
||||
continue;
|
||||
}
|
||||
insertAccount( grp, acc );
|
||||
|
||||
/* check to see if this is a sub-account.
|
||||
* Sub-accounts will have a colon in the name */
|
||||
str = acc->accountName;
|
||||
tok = strchr (str, ':');
|
||||
if (tok) {
|
||||
Account *parent;
|
||||
|
||||
/* find the parent account, and parent to it */
|
||||
*tok = 0x0;
|
||||
parent = xaccGetAccountFromName (grp, str);
|
||||
*tok = ':';
|
||||
|
||||
if (parent) {
|
||||
xaccInsertSubAccount( parent, acc );
|
||||
/* trim off the parent account name ... */
|
||||
/* tok += sizeof(char); leave behind the colon ... */
|
||||
str = XtNewString (tok);
|
||||
XtFree (acc->accountName);
|
||||
acc->accountName = str;
|
||||
} else {
|
||||
insertAccount( grp, acc );
|
||||
}
|
||||
} else {
|
||||
insertAccount( grp, acc );
|
||||
}
|
||||
|
||||
} while (qifline);
|
||||
|
||||
|
||||
return qifline;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user