r23166 - gnucash/trunk/src/plugins/bi_import - Bug #682280 - bill/invoice importer fails to save imported bills/invoices
John Ralls
jralls at code.gnucash.org
Fri Sep 13 19:36:23 EDT 2013
Author: jralls
Date: 2013-09-13 19:36:22 -0400 (Fri, 13 Sep 2013)
New Revision: 23166
Trac: http://svn.gnucash.org/trac/changeset/23166
Modified:
gnucash/trunk/src/plugins/bi_import/dialog-bi-import.c
Log:
Bug #682280 - bill/invoice importer fails to save imported bills/invoices
The first attempt to commit when creating the invoice failed because
the commodity had not yet been set. Wrapped the creation routine in
begin/commit to allow the invoice to be fully populated before trying
to write the DB.
Modified: gnucash/trunk/src/plugins/bi_import/dialog-bi-import.c
===================================================================
--- gnucash/trunk/src/plugins/bi_import/dialog-bi-import.c 2013-09-12 23:31:16 UTC (rev 23165)
+++ gnucash/trunk/src/plugins/bi_import/dialog-bi-import.c 2013-09-13 23:36:22 UTC (rev 23166)
@@ -562,6 +562,9 @@
{
// new invoice
invoice = gncInvoiceCreate (book);
+/* Protect against thrashing the DB and trying to write the invoice
+ * record prematurely */
+ gncInvoiceBeginEdit (invoice);
gncInvoiceSetID (invoice, id);
owner = gncOwnerNew ();
if (g_ascii_strcasecmp (type, "BILL") == 0)
@@ -601,6 +604,7 @@
iw = gnc_ui_invoice_edit (invoice);
gnc_plugin_page_invoice_new (iw);
}
+ gncInvoiceCommitEdit (invoice);
}
// I want to warn the user that an existing billvoice exists, but not every
// time.
More information about the gnucash-changes
mailing list