Better fix for bug 798204, doesn't break trading account selection.

pull/1032/head
John Ralls 5 years ago
parent 9eeff5dd7e
commit 6aa35ea7fb

@ -3145,6 +3145,18 @@ gnc_account_lookup_by_type_and_commodity (Account* root,
retval = g_list_prepend(retval, account);
}
}
if (!retval) // Recurse through the children
for (auto node = rpriv->children; node; node = node->next)
{
auto account{static_cast<Account*>(node->data)};
auto result = gnc_account_lookup_by_type_and_commodity(account,
name,
acctype,
commodity);
if (result)
retval = g_list_concat(result, retval);
}
return retval;
}

@ -1453,19 +1453,6 @@ 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…
Cancel
Save