AUDIT: r21743 - gnucash/trunk/src - Clean up some more cases where KVP was set without committing an edit.
John Ralls
jralls at code.gnucash.org
Sun Dec 18 19:47:21 EST 2011
Author: jralls
Date: 2011-12-18 19:47:20 -0500 (Sun, 18 Dec 2011)
New Revision: 21743
Trac: http://svn.gnucash.org/trac/changeset/21743
Modified:
gnucash/trunk/src/business/business-gnome/dialog-payment.c
gnucash/trunk/src/engine/Scrub.c
gnucash/trunk/src/engine/gnc-lot.c
gnucash/trunk/src/engine/gncInvoice.c
gnucash/trunk/src/engine/gncOwner.c
Log:
Clean up some more cases where KVP was set without committing an edit.
BP
Modified: gnucash/trunk/src/business/business-gnome/dialog-payment.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-payment.c 2011-12-19 00:47:11 UTC (rev 21742)
+++ gnucash/trunk/src/business/business-gnome/dialog-payment.c 2011-12-19 00:47:20 UTC (rev 21743)
@@ -243,10 +243,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/trunk/src/engine/Scrub.c
===================================================================
--- gnucash/trunk/src/engine/Scrub.c 2011-12-19 00:47:11 UTC (rev 21742)
+++ gnucash/trunk/src/engine/Scrub.c 2011-12-19 00:47:20 UTC (rev 21743)
@@ -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/trunk/src/engine/gnc-lot.c
===================================================================
--- gnucash/trunk/src/engine/gnc-lot.c 2011-12-19 00:47:11 UTC (rev 21742)
+++ gnucash/trunk/src/engine/gnc-lot.c 2011-12-19 00:47:20 UTC (rev 21743)
@@ -681,12 +681,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/trunk/src/engine/gncInvoice.c
===================================================================
--- gnucash/trunk/src/engine/gncInvoice.c 2011-12-19 00:47:11 UTC (rev 21742)
+++ gnucash/trunk/src/engine/gncInvoice.c 2011-12-19 00:47:20 UTC (rev 21743)
@@ -1064,9 +1064,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
@@ -1080,9 +1082,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/trunk/src/engine/gncOwner.c
===================================================================
--- gnucash/trunk/src/engine/gncOwner.c 2011-12-19 00:47:11 UTC (rev 21742)
+++ gnucash/trunk/src/engine/gncOwner.c 2011-12-19 00:47:20 UTC (rev 21743)
@@ -573,6 +573,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);
@@ -580,6 +581,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