Replace overly indirect gnc_business_get_default_tax_table.

With gncTaxTableGetDefault.

qof_book_get_default_tax_table would have been even better but it
would have created a circular dependency between QofBook and
GncTaxTable.
This commit is contained in:
John Ralls
2019-08-22 12:23:09 -07:00
parent 33b1a19eb2
commit fcc1653822
9 changed files with 64 additions and 130 deletions

View File

@@ -681,6 +681,26 @@ GncTaxTable *gncTaxTableLookupByName (QofBook *book, const char *name)
return NULL;
}
GncTaxTable*
gncTaxTableGetDefault (QofBook *book, GncOwnerType type)
{
GSList *path = NULL;
const GncGUID *guid = NULL;
const char *vendor = "Default Vendor TaxTable";
const char *customer = "Default Customer TaxTable";
const char *section = "Business";
g_return_val_if_fail (book != NULL, NULL);
g_return_val_if_fail (type == GNC_OWNER_CUSTOMER || \
type == GNC_OWNER_VENDOR, NULL);
path = g_slist_prepend (path, type == GNC_OWNER_CUSTOMER ? (void*)customer : (void*)vendor);
path = g_slist_prepend (path, (void*)section);
guid = qof_book_get_guid_option (book, path);
g_return_val_if_fail (guid, NULL);
return gncTaxTableLookup (book, guid);
}
GncTaxTableList * gncTaxTableGetTables (QofBook *book)
{
struct _book_info *bi;