mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Use one single module to load locale specific tax rather than a module per locale
This simplifies the calls in the rest of gnucash Note that the locale specific reports themselves don't even load this module any more. They don't need it, instead they can directly load the locale specific tax scheme modules.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "guile-mappings.h"
|
||||
#include "guile-util.h"
|
||||
#include "gnc-guile-utils.h"
|
||||
#include "gnc-module.h"
|
||||
|
||||
#include "Account.h"
|
||||
#include "gnc-ui-util.h"
|
||||
@@ -145,6 +146,10 @@ typedef struct
|
||||
static void
|
||||
initialize_getters (void)
|
||||
{
|
||||
if (!gnc_module_load("gnucash/locale/tax", 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
getters.payer_name_source = scm_c_eval_string ("gnc:txf-get-payer-name-source");
|
||||
getters.form = scm_c_eval_string ("gnc:txf-get-form");
|
||||
getters.description = scm_c_eval_string ("gnc:txf-get-description");
|
||||
|
||||
@@ -71,9 +71,9 @@
|
||||
(use-modules (srfi srfi-1))
|
||||
(use-modules (gnucash core-utils)) ; for gnc:version
|
||||
(use-modules (gnucash gettext))
|
||||
(use-modules (gnucash tax-de_DE))
|
||||
|
||||
(use-modules (gnucash gnc-module))
|
||||
(gnc:module-load "gnucash/tax/de_DE" 0)
|
||||
(gnc:module-load "gnucash/report" 0)
|
||||
(gnc:module-load "gnucash/engine" 0)
|
||||
|
||||
|
||||
@@ -103,6 +103,7 @@
|
||||
(use-modules (srfi srfi-1))
|
||||
(use-modules (gnucash gnc-module))
|
||||
(use-modules (gnucash gettext))
|
||||
(use-modules (gnucash tax-us))
|
||||
|
||||
(eval-when
|
||||
(compile load eval expand)
|
||||
@@ -112,7 +113,6 @@
|
||||
(use-modules (gnucash core-utils)) ; for gnc:version
|
||||
|
||||
(gnc:module-load "gnucash/html" 0)
|
||||
(gnc:module-load "gnucash/tax/us" 0)
|
||||
(gnc:module-load "gnucash/report" 0)
|
||||
|
||||
(define reportname (N_ "Tax Schedule Report/TXF Export"))
|
||||
|
||||
@@ -667,23 +667,10 @@ gnc_ui_account_get_tax_info_string (const Account *account)
|
||||
{
|
||||
GNCModule module;
|
||||
const gchar *tax_module;
|
||||
/* load the tax info */
|
||||
/* This is a very simple hack that loads the (new, special) German
|
||||
tax definition file in a German locale, or (default) loads the
|
||||
US tax file. */
|
||||
# ifdef G_OS_WIN32
|
||||
gchar *thislocale = g_win32_getlocale();
|
||||
gboolean is_de_DE = (strncmp(thislocale, "de_DE", 5) == 0);
|
||||
g_free(thislocale);
|
||||
# else /* !G_OS_WIN32 */
|
||||
const char *thislocale = setlocale(LC_ALL, NULL);
|
||||
gboolean is_de_DE = (strncmp(thislocale, "de_DE", 5) == 0);
|
||||
# endif /* G_OS_WIN32 */
|
||||
tax_module = is_de_DE ?
|
||||
"gnucash/tax/de_DE" :
|
||||
"gnucash/tax/us";
|
||||
|
||||
module = gnc_module_load ((char *)tax_module, 0);
|
||||
/* load the tax info
|
||||
Note that the module "gnucash/locale/tax" will handle selecting
|
||||
the proper locale specific tax info */
|
||||
module = gnc_module_load ("gnucash/locale/tax", 0);
|
||||
|
||||
g_return_val_if_fail (module, NULL);
|
||||
|
||||
|
||||
@@ -48,24 +48,13 @@ int libgncmod_tax_us_gnc_module_age = 0;
|
||||
char *
|
||||
libgncmod_tax_us_gnc_module_path(void)
|
||||
{
|
||||
# ifdef G_OS_WIN32
|
||||
gchar *thislocale = g_win32_getlocale();
|
||||
gboolean is_de_DE = (strncmp(thislocale, "de_DE", 5) == 0);
|
||||
g_free(thislocale);
|
||||
# else /* !G_OS_WIN32 */
|
||||
const char *thislocale = setlocale(LC_ALL, NULL);
|
||||
gboolean is_de_DE = (strncmp(thislocale, "de_DE", 5) == 0);
|
||||
# endif /* G_OS_WIN32 */
|
||||
if (is_de_DE)
|
||||
return g_strdup("gnucash/tax/de_DE");
|
||||
else
|
||||
return g_strdup("gnucash/tax/us");
|
||||
return g_strdup("gnucash/locale/tax");
|
||||
}
|
||||
|
||||
char *
|
||||
libgncmod_tax_us_gnc_module_description(void)
|
||||
{
|
||||
return g_strdup("US income tax information");
|
||||
return g_strdup("Locale dependent income tax information. Currently supported are 'us' and 'de_DE'. Default is 'us'");
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
(use-modules (gnucash gnc-module))
|
||||
(gnc:module-system-init)
|
||||
|
||||
(if (gnc:module-load "gnucash/tax/us" 0)
|
||||
(if (gnc:module-load "gnucash/locale/tax" 0)
|
||||
(begin
|
||||
(display "ok\n")
|
||||
(exit 0))
|
||||
|
||||
Reference in New Issue
Block a user