r22908 - gnucash/trunk - Fix indirect libguile dependency in business ledger

Geert Janssens gjanssens at code.gnucash.org
Mon Apr 15 16:02:44 EDT 2013


Author: gjanssens
Date: 2013-04-15 16:02:43 -0400 (Mon, 15 Apr 2013)
New Revision: 22908
Trac: http://svn.gnucash.org/trac/changeset/22908

Added:
   gnucash/trunk/src/app-utils/business-helpers.c
   gnucash/trunk/src/app-utils/business-helpers.h
Modified:
   gnucash/trunk/po/POTFILES.in
   gnucash/trunk/src/app-utils/Makefile.am
   gnucash/trunk/src/business/business-ledger/gncEntryLedgerLoad.c
Log:
Fix indirect libguile dependency in business ledger

Modified: gnucash/trunk/po/POTFILES.in
===================================================================
--- gnucash/trunk/po/POTFILES.in	2013-04-15 19:36:39 UTC (rev 22907)
+++ gnucash/trunk/po/POTFILES.in	2013-04-15 20:02:43 UTC (rev 22908)
@@ -1,5 +1,6 @@
 # This is a list of files which contain translatable strings.
 # This file was generated by ../make-gnucash-potfiles.
+src/app-utils/business-helpers.c
 src/app-utils/business-options.c
 src/app-utils/calculation/expression_parser.c
 src/app-utils/calculation/fin.c
@@ -179,14 +180,14 @@
 src/gnome/assistant-stock-split.c
 src/gnome/dialog-commodities.c
 src/gnome/dialog-fincalc.c
+src/gnome/dialog-find-transactions2.c
 src/gnome/dialog-find-transactions.c
-src/gnome/dialog-find-transactions2.c
 src/gnome/dialog-lot-viewer.c
 src/gnome/dialog-new-user.c
 src/gnome/dialog-price-edit-db.c
 src/gnome/dialog-price-editor.c
+src/gnome/dialog-print-check2.c
 src/gnome/dialog-print-check.c
-src/gnome/dialog-print-check2.c
 src/gnome/dialog-progress.c
 src/gnome/dialog-sx-editor.c
 src/gnome/dialog-sx-from-trans.c
@@ -351,8 +352,8 @@
 src/gnome-utils/search-param.c
 src/gnome-utils/window-main-summarybar.c
 src/gnome/window-autoclear.c
+src/gnome/window-reconcile2.c
 src/gnome/window-reconcile.c
-src/gnome/window-reconcile2.c
 src/html/gnc-html.c
 src/html/gnc-html-factory.c
 src/html/gnc-html-history.c

Modified: gnucash/trunk/src/app-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/app-utils/Makefile.am	2013-04-15 19:36:39 UTC (rev 22907)
+++ gnucash/trunk/src/app-utils/Makefile.am	2013-04-15 20:02:43 UTC (rev 22908)
@@ -39,6 +39,7 @@
   calculation/expression_parser.c \
   calculation/fin.c \
   swig-app-utils-guile.c \
+  business-helpers.c \
   business-options.c \
   QuickFill.c \
   file-utils.c \
@@ -62,6 +63,7 @@
 gncincludedir = ${GNC_INCLUDE_DIR}
 gncinclude_HEADERS = \
   QuickFill.h \
+  business-helpers.h \
   business-options.h \
   file-utils.h \
   gfec.h \

Added: gnucash/trunk/src/app-utils/business-helpers.c
===================================================================
--- gnucash/trunk/src/app-utils/business-helpers.c	                        (rev 0)
+++ gnucash/trunk/src/app-utils/business-helpers.c	2013-04-15 20:02:43 UTC (rev 22908)
@@ -0,0 +1,60 @@
+/*
+ * business-options.c -- non-GUI helper functions for business features
+ *
+ * Written By: Derek Atkins <warlord at 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 at 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;
+}

Added: gnucash/trunk/src/app-utils/business-helpers.h
===================================================================
--- gnucash/trunk/src/app-utils/business-helpers.h	                        (rev 0)
+++ gnucash/trunk/src/app-utils/business-helpers.h	2013-04-15 20:02:43 UTC (rev 22908)
@@ -0,0 +1,35 @@
+/*
+ * business-helpers.h -- non-GUI helper functions for business features
+ *
+ * Written By: Derek Atkins <warlord at MIT.EDU>
+ * Copyright (C) 2003 Derek Atkins <warlord at 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 at 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_ */

Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedgerLoad.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedgerLoad.c	2013-04-15 19:36:39 UTC (rev 22907)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedgerLoad.c	2013-04-15 20:02:43 UTC (rev 22908)
@@ -34,7 +34,7 @@
 #include "gnc-ui-util.h"
 #include "recncell.h"
 
-#include "business-options.h"
+#include "business-helpers.h"
 
 #include "gncEntry.h"
 #include "gncEntryLedger.h"
@@ -373,7 +373,6 @@
                 GncTaxIncluded taxincluded_p = GNC_TAXINCLUDED_USEGLOBAL;
                 gboolean taxincluded = FALSE;
                 gnc_numeric discount = gnc_numeric_zero ();
-                GNCOptionDB *odb;
 
                 /* Determine the TaxIncluded and Discount values */
                 switch (gncOwnerGetType (owner))
@@ -411,26 +410,19 @@
                 }
 
                 /* 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))
                 {
                 case GNC_OWNER_CUSTOMER:
-                    table = gnc_option_db_lookup_taxtable_option (odb,
-                            "Business",
-                            "Default Customer TaxTable",
-                            NULL);
+                    table = gnc_business_get_default_tax_table (ledger->book,
+                            GNC_OWNER_CUSTOMER);
 
                     if (gncCustomerGetTaxTableOverride (owner->owner.customer))
                         table = gncCustomerGetTaxTable (owner->owner.customer);
                     break;
 
                 case GNC_OWNER_VENDOR:
-                    table = gnc_option_db_lookup_taxtable_option (odb,
-                            "Business",
-                            "Default Vendor TaxTable",
-                            NULL);
+                    table = gnc_business_get_default_tax_table (ledger->book,
+                            GNC_OWNER_VENDOR);
 
                     if (gncVendorGetTaxTableOverride (owner->owner.vendor))
                         table = gncVendorGetTaxTable (owner->owner.vendor);
@@ -440,8 +432,6 @@
                     break;
                 }
 
-                gnc_option_db_destroy (odb);
-
                 if (ledger->is_cust_doc)
                 {
                     gncEntrySetInvTaxTable (blank_entry, table);



More information about the gnucash-changes mailing list