Clean up some more cases where KVP was set without committing an edit.

BP

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21743 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls 2011-12-19 00:47:20 +00:00
parent 0c5a2cbc90
commit eabb8af132
5 changed files with 18 additions and 4 deletions

View File

@ -243,10 +243,11 @@ gnc_payment_dialog_remember_account(PaymentWindow *pw, Account *acc)
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! */
}

View File

@ -1211,11 +1211,14 @@ static void
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

View File

@ -681,12 +681,14 @@ GNCLot * gnc_lot_make_default (Account *acc)
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;
}

View File

@ -1064,9 +1064,11 @@ gncInvoiceDetachFromLot (GNCLot *lot)
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 @@ gncInvoiceAttachToLot (GncInvoice *invoice, GNCLot *lot)
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);
}

View File

@ -573,6 +573,7 @@ void gncOwnerAttachToLot (const GncOwner *owner, GNCLot *lot)
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 @@ void gncOwnerAttachToLot (const GncOwner *owner, GNCLot *lot)
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);
}