r17475 - gnucash/trunk/src/business/business-core - Add begin-edit/commit-edit calls around lot manipulation when posting

Phil Longstaff plongstaff at cvs.gnucash.org
Wed Aug 20 08:31:00 EDT 2008


Author: plongstaff
Date: 2008-08-20 08:31:00 -0400 (Wed, 20 Aug 2008)
New Revision: 17475
Trac: http://svn.gnucash.org/trac/changeset/17475

Modified:
   gnucash/trunk/src/business/business-core/gncInvoice.c
Log:
Add begin-edit/commit-edit calls around lot manipulation when posting
an invoice.  This keeps the sql backend from trying to save a lot with
a null account.



Modified: gnucash/trunk/src/business/business-core/gncInvoice.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncInvoice.c	2008-08-20 12:09:10 UTC (rev 17474)
+++ gnucash/trunk/src/business/business-core/gncInvoice.c	2008-08-20 12:31:00 UTC (rev 17475)
@@ -906,6 +906,7 @@
   /* Create a new lot for this invoice, if we need to do so */
   if (!lot)
     lot = gnc_lot_new (book);
+  gnc_lot_begin_edit (lot);
 
   type = gncInvoiceGetType (invoice);
 
@@ -1126,6 +1127,7 @@
 
     t2 = xaccMallocTransaction (book);
     lot2 = gnc_lot_new (book);
+	gnc_lot_begin_edit (lot2);
     gncOwnerAttachToLot (gncOwnerGetEndOwner (gncInvoiceGetOwner (invoice)),
 			 lot2);
     
@@ -1162,10 +1164,12 @@
     xaccSplitSetBaseValue (split, total, invoice->currency);
     gnc_lot_add_split (lot2, split);
 
+	gnc_lot_commit_edit (lot2);
     xaccTransCommitEdit (t2);
     xaccAccountCommitEdit (acc);
   }
 
+  gnc_lot_commit_edit (lot);
   gncInvoiceCommitEdit (invoice);
 
   return txn;



More information about the gnucash-changes mailing list