r21745 - gnucash/branches/2.4/src - [r21743]Clean up some more cases where KVP was set without committing an

John Ralls jralls at code.gnucash.org
Sun Dec 18 20:27:04 EST 2011


Author: jralls
Date: 2011-12-18 20:27:03 -0500 (Sun, 18 Dec 2011)
New Revision: 21745
Trac: http://svn.gnucash.org/trac/changeset/21745

Modified:
   gnucash/branches/2.4/src/business/business-gnome/dialog-payment.c
   gnucash/branches/2.4/src/engine/Scrub.c
   gnucash/branches/2.4/src/engine/gnc-lot.c
   gnucash/branches/2.4/src/engine/gncInvoice.c
   gnucash/branches/2.4/src/engine/gncOwner.c
Log:
[r21743]Clean up some more cases where KVP was set without committing an
edit.

Modified: gnucash/branches/2.4/src/business/business-gnome/dialog-payment.c
===================================================================
--- gnucash/branches/2.4/src/business/business-gnome/dialog-payment.c	2011-12-19 01:26:54 UTC (rev 21744)
+++ gnucash/branches/2.4/src/business/business-gnome/dialog-payment.c	2011-12-19 01:27:03 UTC (rev 21745)
@@ -189,10 +189,11 @@
     value = kvp_value_new_guid(xaccAccountGetGUID(acc));
     if (!value) return;
 
+    xaccAccountBeginEdit (acc);
     kvp_frame_set_slot_path(slots, value, "payment", "last_acct", NULL);
+    qof_instance_set_dirty (QOF_INSTANCE (acc));
+    xaccAccountCommitEdit (acc);
     kvp_value_delete(value);
-
-    /* XXX: FIXME:  Need a commit_edit here to save the data! */
 }
 
 

Modified: gnucash/branches/2.4/src/engine/Scrub.c
===================================================================
--- gnucash/branches/2.4/src/engine/Scrub.c	2011-12-19 01:26:54 UTC (rev 21744)
+++ gnucash/branches/2.4/src/engine/Scrub.c	2011-12-19 01:27:03 UTC (rev 21745)
@@ -1211,11 +1211,14 @@
 xaccAccountDeleteOldData (Account *account)
 {
     if (!account) return;
+    xaccAccountBeginEdit (account);
 
     kvp_frame_set_slot_nc (account->inst.kvp_data, "old-currency", NULL);
     kvp_frame_set_slot_nc (account->inst.kvp_data, "old-security", NULL);
     kvp_frame_set_slot_nc (account->inst.kvp_data, "old-currency-scu", NULL);
     kvp_frame_set_slot_nc (account->inst.kvp_data, "old-security-scu", NULL);
+    qof_instance_set_dirty (QOF_INSTANCE (account));
+    xaccAccountCommitEdit (account);
 }
 
 static int

Modified: gnucash/branches/2.4/src/engine/gnc-lot.c
===================================================================
--- gnucash/branches/2.4/src/engine/gnc-lot.c	2011-12-19 01:26:54 UTC (rev 21744)
+++ gnucash/branches/2.4/src/engine/gnc-lot.c	2011-12-19 01:27:03 UTC (rev 21745)
@@ -700,12 +700,14 @@
     lot = gnc_lot_new (qof_instance_get_book(acc));
 
     /* Provide a reasonable title for the new lot */
+    xaccAccountBeginEdit (acc);
     id = kvp_frame_get_gint64 (xaccAccountGetSlots (acc), "/lot-mgmt/next-id");
     snprintf (buff, 200, ("%s %" G_GINT64_FORMAT), _("Lot"), id);
     kvp_frame_set_str (gnc_lot_get_slots (lot), "/title", buff);
     id ++;
     kvp_frame_set_gint64 (xaccAccountGetSlots (acc), "/lot-mgmt/next-id", id);
-
+    qof_instance_set_dirty (QOF_INSTANCE(acc));
+    xaccAccountCommitEdit (acc);
     return lot;
 }
 

Modified: gnucash/branches/2.4/src/engine/gncInvoice.c
===================================================================
--- gnucash/branches/2.4/src/engine/gncInvoice.c	2011-12-19 01:26:54 UTC (rev 21744)
+++ gnucash/branches/2.4/src/engine/gncInvoice.c	2011-12-19 01:27:03 UTC (rev 21745)
@@ -1087,9 +1087,11 @@
     KvpFrame *kvp;
 
     if (!lot) return;
-
+    gnc_lot_begin_edit (lot);
     kvp = gnc_lot_get_slots (lot);
     kvp_frame_set_slot_path (kvp, NULL, GNC_INVOICE_ID, GNC_INVOICE_GUID, NULL);
+    qof_instance_set_dirty (QOF_INSTANCE (lot));
+    gnc_log_commit_edit (lot);
 }
 
 static void
@@ -1103,9 +1105,12 @@
 
     if (invoice->posted_lot) return;	/* Cannot reset invoice's lot */
 
+    gnc_lot_begin_edit (lot);
     kvp = gnc_lot_get_slots (lot);
     value = kvp_value_new_guid (qof_instance_get_guid (QOF_INSTANCE(invoice)));
     kvp_frame_set_slot_path (kvp, value, GNC_INVOICE_ID, GNC_INVOICE_GUID, NULL);
+    qof_instance_set_dirty (QOF_INSTANCE (lot));
+    gnc_log_commit_edit (lot);
     kvp_value_delete (value);
     gncInvoiceSetPostedLot (invoice, lot);
 }

Modified: gnucash/branches/2.4/src/engine/gncOwner.c
===================================================================
--- gnucash/branches/2.4/src/engine/gncOwner.c	2011-12-19 01:26:54 UTC (rev 21744)
+++ gnucash/branches/2.4/src/engine/gncOwner.c	2011-12-19 01:27:03 UTC (rev 21745)
@@ -488,6 +488,7 @@
         return;
 
     kvp = gnc_lot_get_slots (lot);
+    gnc_lot_begin_edit (lot);
 
     value = kvp_value_new_gint64 (gncOwnerGetType (owner));
     kvp_frame_set_slot_path (kvp, value, GNC_OWNER_ID, GNC_OWNER_TYPE, NULL);
@@ -495,6 +496,8 @@
 
     value = kvp_value_new_guid (gncOwnerGetGUID (owner));
     kvp_frame_set_slot_path (kvp, value, GNC_OWNER_ID, GNC_OWNER_GUID, NULL);
+    qof_instance_set_dirty (QOF_INSTANCE (lot));
+    gnc_log_commit_edit (lot);
     kvp_value_delete (value);
 
 }



More information about the gnucash-changes mailing list