Skip to content

Commit

Permalink
Bug #682280 - bill/invoice importer fails to save imported bills/invo…
Browse files Browse the repository at this point in the history
…ices

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.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23166 57a11ea4-9604-0410-9ed3-97b8803252fd
  • Loading branch information
jralls committed Sep 13, 2013
1 parent c7f6d0e commit 818c006
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/plugins/bi_import/dialog-bi-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,9 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
{
// 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)
Expand Down Expand Up @@ -601,6 +604,7 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
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.
Expand Down

0 comments on commit 818c006

Please sign in to comment.