Skip to content

Commit

Permalink
Bug 798204 - Creation of Imbalance Accounts
Browse files Browse the repository at this point in the history
Search recursively when getting account by name.
  • Loading branch information
jralls committed Jun 12, 2021
1 parent 68ec80e commit 9eeff5d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion libgnucash/engine/Scrub.c
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 9eeff5d

Please sign in to comment.