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
#src/backend/dbi/gnc-backend-dbi.c:gnc_dbi_load.
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])
# Parse out the version number

View File

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

View File

@ -520,7 +520,7 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
GncInvoice *invoice;
GncEntry *entry;
gint day, month, year;
gnc_numeric n;
gnc_numeric value;
GncOwner *owner;
Account *acc;
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;
InvoiceWindow *iw;
gchar *new_id = NULL;
gint64 denom = 0;
gnc_commodity *currency;
// these arguments are needed
g_return_if_fail (store && book);
@ -693,6 +695,9 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
// add entry to invoice/bill
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!
qof_scan_date (date, &day, &month, &year);
{
@ -705,42 +710,39 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
gncEntrySetDescription (entry, desc);
gncEntrySetAction (entry, action);
n = gnc_numeric_zero ();
gnc_exp_parser_parse (quantity, &n, NULL);
gncEntrySetQuantity (entry, n);
gnc_exp_parser_parse (quantity, &value, NULL);
gncEntrySetQuantity (entry, value);
acc = gnc_account_lookup_for_register (gnc_get_current_root_account (),
account);
if (g_ascii_strcasecmp (type, "BILL") == 0)
{
gncEntrySetBillAccount (entry, acc);
n = gnc_numeric_zero ();
gnc_exp_parser_parse (price, &n, NULL);
gncEntrySetBillPrice (entry, n);
gnc_exp_parser_parse (price, &value, NULL);
value = gnc_numeric_convert (value, denom, GNC_HOW_RND_NEVER);
gncEntrySetBillPrice (entry, value);
gncEntrySetBillTaxable (entry, text2bool (taxable));
gncEntrySetBillTaxIncluded (entry, text2bool (taxincluded));
gncEntrySetBillTaxTable (entry,
gncTaxTableLookupByName (book, tax_table));
n = gnc_numeric_zero ();
gnc_exp_parser_parse (discount, &n, NULL);
gncEntrySetBillTaxTable (entry, gncTaxTableLookupByName (book, tax_table));
gncEntryCommitEdit(entry);
gncBillAddEntry (invoice, entry);
}
else if (g_ascii_strcasecmp (type, "INVOICE") == 0)
{
gncEntrySetNotes (entry, notes);
gncEntrySetInvAccount (entry, acc);
n = gnc_numeric_zero ();
gnc_exp_parser_parse (price, &n, NULL);
gncEntrySetInvPrice (entry, n);
gnc_exp_parser_parse (price, &value, NULL);
value = gnc_numeric_convert (value, denom, GNC_HOW_RND_NEVER);
gncEntrySetInvPrice (entry, value);
gncEntrySetInvTaxable (entry, text2bool (taxable));
gncEntrySetInvTaxIncluded (entry, text2bool (taxincluded));
gncEntrySetInvTaxTable (entry,
gncTaxTableLookupByName (book, tax_table));
n = gnc_numeric_zero ();
gnc_exp_parser_parse (discount, &n, NULL);
gncEntrySetInvDiscount (entry, n);
gncEntrySetInvTaxTable (entry, gncTaxTableLookupByName (book, tax_table));
gnc_exp_parser_parse (discount, &value, NULL);
value = gnc_numeric_convert (value, denom, GNC_HOW_RND_NEVER);
gncEntrySetInvDiscount (entry, value);
gncEntrySetInvDiscountType (entry, text2disc_type (disc_type));
gncEntrySetInvDiscountHow (entry, text2disc_how (disc_how));
gncEntryCommitEdit(entry);
gncInvoiceAddEntry (invoice, entry);
}
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
g_free (new_id);
g_free (id);
g_free (date_opened);
g_free (owner_id);
@ -803,5 +806,5 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
g_free (account_posted);
g_free (memo_posted);
g_free (accumulatesplits);
}
}