Fix indirect libguile dependency in business ledger

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22908 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens 2013-04-15 20:02:43 +00:00
parent 20f468ca0c
commit cb9ede4b5c
5 changed files with 106 additions and 18 deletions

View File

@ -1,5 +1,6 @@
# This is a list of files which contain translatable strings. # This is a list of files which contain translatable strings.
# This file was generated by ../make-gnucash-potfiles. # This file was generated by ../make-gnucash-potfiles.
src/app-utils/business-helpers.c
src/app-utils/business-options.c src/app-utils/business-options.c
src/app-utils/calculation/expression_parser.c src/app-utils/calculation/expression_parser.c
src/app-utils/calculation/fin.c src/app-utils/calculation/fin.c
@ -179,14 +180,14 @@ src/gnome/assistant-loan.c
src/gnome/assistant-stock-split.c src/gnome/assistant-stock-split.c
src/gnome/dialog-commodities.c src/gnome/dialog-commodities.c
src/gnome/dialog-fincalc.c src/gnome/dialog-fincalc.c
src/gnome/dialog-find-transactions.c
src/gnome/dialog-find-transactions2.c src/gnome/dialog-find-transactions2.c
src/gnome/dialog-find-transactions.c
src/gnome/dialog-lot-viewer.c src/gnome/dialog-lot-viewer.c
src/gnome/dialog-new-user.c src/gnome/dialog-new-user.c
src/gnome/dialog-price-edit-db.c src/gnome/dialog-price-edit-db.c
src/gnome/dialog-price-editor.c src/gnome/dialog-price-editor.c
src/gnome/dialog-print-check.c
src/gnome/dialog-print-check2.c src/gnome/dialog-print-check2.c
src/gnome/dialog-print-check.c
src/gnome/dialog-progress.c src/gnome/dialog-progress.c
src/gnome/dialog-sx-editor.c src/gnome/dialog-sx-editor.c
src/gnome/dialog-sx-from-trans.c src/gnome/dialog-sx-from-trans.c
@ -351,8 +352,8 @@ src/gnome-utils/schemas/apps_gnucash_history.schemas.in
src/gnome-utils/search-param.c src/gnome-utils/search-param.c
src/gnome-utils/window-main-summarybar.c src/gnome-utils/window-main-summarybar.c
src/gnome/window-autoclear.c src/gnome/window-autoclear.c
src/gnome/window-reconcile.c
src/gnome/window-reconcile2.c src/gnome/window-reconcile2.c
src/gnome/window-reconcile.c
src/html/gnc-html.c src/html/gnc-html.c
src/html/gnc-html-factory.c src/html/gnc-html-factory.c
src/html/gnc-html-history.c src/html/gnc-html-history.c

View File

@ -39,6 +39,7 @@ libgncmod_app_utils_la_SOURCES = \
calculation/expression_parser.c \ calculation/expression_parser.c \
calculation/fin.c \ calculation/fin.c \
swig-app-utils-guile.c \ swig-app-utils-guile.c \
business-helpers.c \
business-options.c \ business-options.c \
QuickFill.c \ QuickFill.c \
file-utils.c \ file-utils.c \
@ -62,6 +63,7 @@ libgncmod_app_utils_la_SOURCES = \
gncincludedir = ${GNC_INCLUDE_DIR} gncincludedir = ${GNC_INCLUDE_DIR}
gncinclude_HEADERS = \ gncinclude_HEADERS = \
QuickFill.h \ QuickFill.h \
business-helpers.h \
business-options.h \ business-options.h \
file-utils.h \ file-utils.h \
gfec.h \ gfec.h \

View File

@ -0,0 +1,60 @@
/*
* business-options.c -- non-GUI helper functions for business features
*
* Written By: Derek Atkins <warlord@MIT.EDU>
* Copyright (C) 2003 Derek Atkins
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, contact:
*
* Free Software Foundation Voice: +1-617-542-5942
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
* Boston, MA 02110-1301, USA gnu@gnu.org
*/
#include "config.h"
#include "business-options.h"
#include "business-helpers.h"
GncTaxTable* gnc_business_get_default_tax_table (QofBook *book, GncOwnerType ownertype)
{
GncTaxTable *table;
GNCOptionDB *odb;
odb = gnc_option_db_new_for_type (GNC_ID_BOOK);
gnc_option_db_load_from_kvp (odb, qof_book_get_slots (book));
switch (ownertype)
{
case GNC_OWNER_CUSTOMER:
table = gnc_option_db_lookup_taxtable_option (odb,
"Business",
"Default Customer TaxTable",
NULL);
break;
case GNC_OWNER_VENDOR:
table = gnc_option_db_lookup_taxtable_option (odb,
"Business",
"Default Vendor TaxTable",
NULL);
break;
default:
break;
}
gnc_option_db_destroy (odb);
return table;
}

View File

@ -0,0 +1,35 @@
/*
* business-helpers.h -- non-GUI helper functions for business features
*
* Written By: Derek Atkins <warlord@MIT.EDU>
* Copyright (C) 2003 Derek Atkins <warlord@MIT.EDU>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, contact:
*
* Free Software Foundation Voice: +1-617-542-5942
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
* Boston, MA 02110-1301, USA gnu@gnu.org
*/
#ifndef GNC_BUSINESS_HELPERS_H_
#define GNC_BUSINESS_HELPERS_H_
#include "gncTaxTable.h"
#include "gncOwner.h"
GncTaxTable* gnc_business_get_default_tax_table (QofBook *book, GncOwnerType ownertype);
#endif /* GNC_BUSINESS_HELPERS_H_ */

View File

@ -34,7 +34,7 @@
#include "gnc-ui-util.h" #include "gnc-ui-util.h"
#include "recncell.h" #include "recncell.h"
#include "business-options.h" #include "business-helpers.h"
#include "gncEntry.h" #include "gncEntry.h"
#include "gncEntryLedger.h" #include "gncEntryLedger.h"
@ -373,7 +373,6 @@ void gnc_entry_ledger_load (GncEntryLedger *ledger, GList *entry_list)
GncTaxIncluded taxincluded_p = GNC_TAXINCLUDED_USEGLOBAL; GncTaxIncluded taxincluded_p = GNC_TAXINCLUDED_USEGLOBAL;
gboolean taxincluded = FALSE; gboolean taxincluded = FALSE;
gnc_numeric discount = gnc_numeric_zero (); gnc_numeric discount = gnc_numeric_zero ();
GNCOptionDB *odb;
/* Determine the TaxIncluded and Discount values */ /* Determine the TaxIncluded and Discount values */
switch (gncOwnerGetType (owner)) switch (gncOwnerGetType (owner))
@ -411,26 +410,19 @@ void gnc_entry_ledger_load (GncEntryLedger *ledger, GList *entry_list)
} }
/* Compute the proper taxtable */ /* Compute the proper taxtable */
odb = gnc_option_db_new_for_type (GNC_ID_BOOK);
gnc_option_db_load_from_kvp (odb, qof_book_get_slots (ledger->book));
switch (gncOwnerGetType (owner)) switch (gncOwnerGetType (owner))
{ {
case GNC_OWNER_CUSTOMER: case GNC_OWNER_CUSTOMER:
table = gnc_option_db_lookup_taxtable_option (odb, table = gnc_business_get_default_tax_table (ledger->book,
"Business", GNC_OWNER_CUSTOMER);
"Default Customer TaxTable",
NULL);
if (gncCustomerGetTaxTableOverride (owner->owner.customer)) if (gncCustomerGetTaxTableOverride (owner->owner.customer))
table = gncCustomerGetTaxTable (owner->owner.customer); table = gncCustomerGetTaxTable (owner->owner.customer);
break; break;
case GNC_OWNER_VENDOR: case GNC_OWNER_VENDOR:
table = gnc_option_db_lookup_taxtable_option (odb, table = gnc_business_get_default_tax_table (ledger->book,
"Business", GNC_OWNER_VENDOR);
"Default Vendor TaxTable",
NULL);
if (gncVendorGetTaxTableOverride (owner->owner.vendor)) if (gncVendorGetTaxTableOverride (owner->owner.vendor))
table = gncVendorGetTaxTable (owner->owner.vendor); table = gncVendorGetTaxTable (owner->owner.vendor);
@ -440,8 +432,6 @@ void gnc_entry_ledger_load (GncEntryLedger *ledger, GList *entry_list)
break; break;
} }
gnc_option_db_destroy (odb);
if (ledger->is_cust_doc) if (ledger->is_cust_doc)
{ {
gncEntrySetInvTaxTable (blank_entry, table); gncEntrySetInvTaxTable (blank_entry, table);