Merge branch 'maint'

This commit is contained in:
John Ralls 2014-08-07 11:47:27 -07:00
commit 4e7e52a311
3 changed files with 61 additions and 47 deletions

View File

@ -33,7 +33,15 @@ GNUCASH_NANO_VERSION=0
#storage-compatible with the current version. See the comments in #storage-compatible with the current version. See the comments in
#src/backend/dbi/gnc-backend-dbi.c:gnc_dbi_load. #src/backend/dbi/gnc-backend-dbi.c:gnc_dbi_load.
GNUCASH_RESAVE_VERSION=19920 GNUCASH_RESAVE_VERSION=19920
# Initialize automake -- make sure we have at least version 1.9 # Initialize automake -- make sure we have at least version 1.9 Note:
# Automake 1.14 issues a ton of warnings about subdir-objects, which
# will become the default in automake 2.0; unfortunately this option
# is broken and prevents building without passing
# --disable-dependency-tracking to configure, which make-distcheck
# doesn't do. See
# http://lists.gnu.org/archive/html/automake/2014-04/msg00002.html and
# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13928 for details.
# In the meantime the best option is to use Automake 1.13 or earlier.
AM_INIT_AUTOMAKE([1.9 dist-bzip2]) AM_INIT_AUTOMAKE([1.9 dist-bzip2])
# Parse out the version number # Parse out the version number

View File

@ -36,7 +36,7 @@
#if LIBDBI_VERSION >= 900 #if LIBDBI_VERSION >= 900
#define HAVE_LIBDBI_R 1 #define HAVE_LIBDBI_R 1
static dbi_inst dbi_instance; static dbi_inst dbi_instance = NULL;
#else #else
#define HAVE_LIBDBI_R 0 #define HAVE_LIBDBI_R 0
#endif #endif
@ -597,8 +597,11 @@ test_suite_gnc_backend_dbi (void)
dbi_driver driver = NULL; dbi_driver driver = NULL;
GList *drivers = NULL; GList *drivers = NULL;
#if HAVE_LIBDBI_R #if HAVE_LIBDBI_R
if (dbi_instance == NULL)
dbi_initialize_r (NULL, &dbi_instance);
while ((driver = dbi_driver_list_r (driver, dbi_instance))) while ((driver = dbi_driver_list_r (driver, dbi_instance)))
#else #else
dbi_initialize (NULL);
while ((driver = dbi_driver_list (driver))) while ((driver = dbi_driver_list (driver)))
#endif #endif
{ {

View File

@ -520,7 +520,7 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
GncInvoice *invoice; GncInvoice *invoice;
GncEntry *entry; GncEntry *entry;
gint day, month, year; gint day, month, year;
gnc_numeric n; gnc_numeric value;
GncOwner *owner; GncOwner *owner;
Account *acc; Account *acc;
enum update {YES = GTK_RESPONSE_YES, NO = GTK_RESPONSE_NO} update; enum update {YES = GTK_RESPONSE_YES, NO = GTK_RESPONSE_NO} update;
@ -528,6 +528,8 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
Timespec today; Timespec today;
InvoiceWindow *iw; InvoiceWindow *iw;
gchar *new_id = NULL; gchar *new_id = NULL;
gint64 denom = 0;
gnc_commodity *currency;
// these arguments are needed // these arguments are needed
g_return_if_fail (store && book); g_return_if_fail (store && book);
@ -693,6 +695,9 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
// add entry to invoice/bill // add entry to invoice/bill
entry = gncEntryCreate (book); entry = gncEntryCreate (book);
gncEntryBeginEdit(entry);
currency = gncInvoiceGetCurrency(invoice);
if (currency) denom = gnc_commodity_get_fraction(currency);
// FIXME: Must check for the return value of qof_scan_date! // FIXME: Must check for the return value of qof_scan_date!
qof_scan_date (date, &day, &month, &year); qof_scan_date (date, &day, &month, &year);
{ {
@ -705,42 +710,39 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
gncEntrySetDescription (entry, desc); gncEntrySetDescription (entry, desc);
gncEntrySetAction (entry, action); gncEntrySetAction (entry, action);
n = gnc_numeric_zero (); gnc_exp_parser_parse (quantity, &value, NULL);
gnc_exp_parser_parse (quantity, &n, NULL); gncEntrySetQuantity (entry, value);
gncEntrySetQuantity (entry, n);
acc = gnc_account_lookup_for_register (gnc_get_current_root_account (), acc = gnc_account_lookup_for_register (gnc_get_current_root_account (),
account); account);
if (g_ascii_strcasecmp (type, "BILL") == 0) if (g_ascii_strcasecmp (type, "BILL") == 0)
{ {
gncEntrySetBillAccount (entry, acc); gncEntrySetBillAccount (entry, acc);
n = gnc_numeric_zero (); gnc_exp_parser_parse (price, &value, NULL);
gnc_exp_parser_parse (price, &n, NULL); value = gnc_numeric_convert (value, denom, GNC_HOW_RND_NEVER);
gncEntrySetBillPrice (entry, n); gncEntrySetBillPrice (entry, value);
gncEntrySetBillTaxable (entry, text2bool (taxable)); gncEntrySetBillTaxable (entry, text2bool (taxable));
gncEntrySetBillTaxIncluded (entry, text2bool (taxincluded)); gncEntrySetBillTaxIncluded (entry, text2bool (taxincluded));
gncEntrySetBillTaxTable (entry, gncEntrySetBillTaxTable (entry, gncTaxTableLookupByName (book, tax_table));
gncTaxTableLookupByName (book, tax_table)); gncEntryCommitEdit(entry);
n = gnc_numeric_zero ();
gnc_exp_parser_parse (discount, &n, NULL);
gncBillAddEntry (invoice, entry); gncBillAddEntry (invoice, entry);
} }
else if (g_ascii_strcasecmp (type, "INVOICE") == 0) else if (g_ascii_strcasecmp (type, "INVOICE") == 0)
{ {
gncEntrySetNotes (entry, notes); gncEntrySetNotes (entry, notes);
gncEntrySetInvAccount (entry, acc); gncEntrySetInvAccount (entry, acc);
n = gnc_numeric_zero (); gnc_exp_parser_parse (price, &value, NULL);
gnc_exp_parser_parse (price, &n, NULL); value = gnc_numeric_convert (value, denom, GNC_HOW_RND_NEVER);
gncEntrySetInvPrice (entry, n); gncEntrySetInvPrice (entry, value);
gncEntrySetInvTaxable (entry, text2bool (taxable)); gncEntrySetInvTaxable (entry, text2bool (taxable));
gncEntrySetInvTaxIncluded (entry, text2bool (taxincluded)); gncEntrySetInvTaxIncluded (entry, text2bool (taxincluded));
gncEntrySetInvTaxTable (entry, gncEntrySetInvTaxTable (entry, gncTaxTableLookupByName (book, tax_table));
gncTaxTableLookupByName (book, tax_table)); gnc_exp_parser_parse (discount, &value, NULL);
n = gnc_numeric_zero (); value = gnc_numeric_convert (value, denom, GNC_HOW_RND_NEVER);
gnc_exp_parser_parse (discount, &n, NULL); gncEntrySetInvDiscount (entry, value);
gncEntrySetInvDiscount (entry, n);
gncEntrySetInvDiscountType (entry, text2disc_type (disc_type)); gncEntrySetInvDiscountType (entry, text2disc_type (disc_type));
gncEntrySetInvDiscountHow (entry, text2disc_how (disc_how)); gncEntrySetInvDiscountHow (entry, text2disc_how (disc_how));
gncEntryCommitEdit(entry);
gncInvoiceAddEntry (invoice, entry); gncInvoiceAddEntry (invoice, entry);
} }
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter); valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter);
@ -777,10 +779,11 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
} }
} }
g_free (new_id);
}
// cleanup // cleanup
g_free (new_id);
g_free (id); g_free (id);
g_free (date_opened); g_free (date_opened);
g_free (owner_id); g_free (owner_id);
@ -803,5 +806,5 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
g_free (account_posted); g_free (account_posted);
g_free (memo_posted); g_free (memo_posted);
g_free (accumulatesplits); g_free (accumulatesplits);
}
} }