mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 798204 - Creation of Imbalance Accounts
Search recursively when getting account by name.
This commit is contained in:
parent
68ec80e68d
commit
9eeff5dd7e
@ -463,7 +463,7 @@ find_root_currency(void)
|
||||
if (xaccAccountGetType (child) == ACCT_TYPE_INCOME)
|
||||
root_currency = xaccAccountGetCommodity (child);
|
||||
}
|
||||
g_free (children);
|
||||
g_list_free (children);
|
||||
}
|
||||
return root_currency;
|
||||
}
|
||||
@ -1453,6 +1453,19 @@ xaccScrubUtilityGetOrMakeAccount (Account *root, gnc_commodity * currency,
|
||||
|
||||
g_return_val_if_fail (root, NULL);
|
||||
|
||||
/* If we're looking for a name, search the whole hierarchy for the name */
|
||||
|
||||
if (checkname)
|
||||
{
|
||||
if (!accname)
|
||||
return NULL;
|
||||
acc = gnc_account_lookup_by_name (root, accname);
|
||||
return acc ? acc : construct_account (root, currency, accname,
|
||||
acctype, placeholder);
|
||||
}
|
||||
/* Otherwise search just the current level. This is used to build
|
||||
* a hierarchy directly under the root account for trading accounts.
|
||||
*/
|
||||
acc_list =
|
||||
gnc_account_lookup_by_type_and_commodity (root,
|
||||
checkname ? accname : NULL,
|
||||
|
Loading…
Reference in New Issue
Block a user